mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 17:48:07 +02:00
Rename the globals to shorter names.
pdfjsDistBuildPdf=pdfjsLib pdfjsDistWebPdfViewer=pdfjsViewer pdfjsDistBuildPdfWorker=pdfjsWorker
This commit is contained in:
parent
6662985a20
commit
01bff1a81d
14 changed files with 66 additions and 68 deletions
|
@ -15,14 +15,14 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
if (!pdfjsDistBuildPdf.getDocument || !pdfjsDistWebPdfViewer.PDFPageView) {
|
||||
if (!pdfjsLib.getDocument || !pdfjsViewer.PDFPageView) {
|
||||
alert('Please build the pdfjs-dist library using\n' +
|
||||
' `gulp dist-install`');
|
||||
}
|
||||
|
||||
// The workerSrc property shall be specified.
|
||||
//
|
||||
pdfjsDistBuildPdf.GlobalWorkerOptions.workerSrc =
|
||||
pdfjsLib.GlobalWorkerOptions.workerSrc =
|
||||
'../../node_modules/pdfjs-dist/build/pdf.worker.js';
|
||||
|
||||
// Some PDFs need external cmaps.
|
||||
|
@ -37,7 +37,7 @@ var SCALE = 1.0;
|
|||
var container = document.getElementById('pageContainer');
|
||||
|
||||
// Loading document.
|
||||
pdfjsDistBuildPdf.getDocument({
|
||||
pdfjsLib.getDocument({
|
||||
url: DEFAULT_URL,
|
||||
cMapUrl: CMAP_URL,
|
||||
cMapPacked: CMAP_PACKED,
|
||||
|
@ -45,14 +45,14 @@ pdfjsDistBuildPdf.getDocument({
|
|||
// Document loaded, retrieving the page.
|
||||
return pdfDocument.getPage(PAGE_TO_VIEW).then(function (pdfPage) {
|
||||
// Creating the page view with default parameters.
|
||||
var pdfPageView = new pdfjsDistWebPdfViewer.PDFPageView({
|
||||
var pdfPageView = new pdfjsViewer.PDFPageView({
|
||||
container: container,
|
||||
id: PAGE_TO_VIEW,
|
||||
scale: SCALE,
|
||||
defaultViewport: pdfPage.getViewport(SCALE),
|
||||
// We can enable text/annotations layers, if needed
|
||||
textLayerFactory: new pdfjsDistWebPdfViewer.DefaultTextLayerFactory(),
|
||||
annotationLayerFactory: new pdfjsDistWebPdfViewer.DefaultAnnotationLayerFactory(),
|
||||
textLayerFactory: new pdfjsViewer.DefaultTextLayerFactory(),
|
||||
annotationLayerFactory: new pdfjsViewer.DefaultAnnotationLayerFactory(),
|
||||
});
|
||||
// Associates the actual page with the view, and drawing it
|
||||
pdfPageView.setPdfPage(pdfPage);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue