Rename the globals to shorter names.

pdfjsDistBuildPdf=pdfjsLib
pdfjsDistWebPdfViewer=pdfjsViewer
pdfjsDistBuildPdfWorker=pdfjsWorker
This commit is contained in:
Brendan Dahl 2018-03-15 13:49:28 -07:00
parent 6662985a20
commit 01bff1a81d
14 changed files with 66 additions and 68 deletions

View file

@ -22,13 +22,13 @@
//
// The workerSrc property shall be specified.
//
pdfjsDistBuildPdf.GlobalWorkerOptions.workerSrc =
pdfjsLib.GlobalWorkerOptions.workerSrc =
'../../node_modules/pdfjs-dist/build/pdf.worker.js';
//
// Asynchronous download PDF
//
pdfjsDistBuildPdf.getDocument(url).then(function getPdfHelloWorld(pdf) {
pdfjsLib.getDocument(url).then(function getPdfHelloWorld(pdf) {
//
// Fetch the first page
//

View file

@ -34,12 +34,12 @@
//
// The workerSrc property shall be specified.
//
pdfjsDistBuildPdf.GlobalWorkerOptions.workerSrc =
pdfjsLib.GlobalWorkerOptions.workerSrc =
'../../node_modules/pdfjs-dist/build/pdf.worker.js';
// Opening PDF by passing its binary data as a string. It is still preferable
// to use Uint8Array, but string or array-like structure will work too.
pdfjsDistBuildPdf.getDocument({data: pdfData}).then(function getPdfHelloWorld(pdf) {
pdfjsLib.getDocument({data: pdfData}).then(function getPdfHelloWorld(pdf) {
// Fetch the first page.
pdf.getPage(1).then(function getPageHelloWorld(page) {
var scale = 1.5;

View file

@ -33,7 +33,7 @@
// pdf.js's one, or the pdf.js is executed via eval(), the workerSrc property
// shall be specified.
//
pdfjsDistBuildPdf.GlobalWorkerOptions.workerSrc =
pdfjsLib.GlobalWorkerOptions.workerSrc =
'../../node_modules/pdfjs-dist/build/pdf.worker.js';
var pdfDoc = null,
@ -117,7 +117,7 @@
/**
* Asynchronously downloads PDF.
*/
pdfjsDistBuildPdf.getDocument(url).then(function (pdfDoc_) {
pdfjsLib.getDocument(url).then(function (pdfDoc_) {
pdfDoc = pdfDoc_;
document.getElementById('page_count').textContent = pdfDoc.numPages;