Quellcode durchsuchen

PDF.js version 1.6.226 - See mozilla/pdf.js@fb5aa58008d53628bd368aca95799e64886c8ebe

Pdf Bot vor 8 Jahren
Ursprung
Commit
6c932d6d0b
6 geänderte Dateien mit 28 neuen und 61 gelöschten Zeilen
  1. 1 1
      bower.json
  2. 2 2
      build/pdf.combined.js
  3. 2 2
      build/pdf.js
  4. 2 2
      build/pdf.worker.js
  5. 1 1
      package.json
  6. 20 53
      web/pdf_viewer.js

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "pdfjs-dist",
-  "version": "1.6.222",
+  "version": "1.6.226",
   "main": [
     "build/pdf.js",
     "build/pdf.worker.js"

+ 2 - 2
build/pdf.combined.js

@@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfCombined = {}));
   // Use strict in our context only - users might not want it
   'use strict';
 
-var pdfjsVersion = '1.6.222';
-var pdfjsBuild = 'd714873';
+var pdfjsVersion = '1.6.226';
+var pdfjsBuild = 'fb5aa58';
 
   var pdfjsFilePath =
     typeof document !== 'undefined' && document.currentScript ?

+ 2 - 2
build/pdf.js

@@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdf = {}));
   // Use strict in our context only - users might not want it
   'use strict';
 
-var pdfjsVersion = '1.6.222';
-var pdfjsBuild = 'd714873';
+var pdfjsVersion = '1.6.226';
+var pdfjsBuild = 'fb5aa58';
 
   var pdfjsFilePath =
     typeof document !== 'undefined' && document.currentScript ?

+ 2 - 2
build/pdf.worker.js

@@ -28,8 +28,8 @@ factory((root.pdfjsDistBuildPdfWorker = {}));
   // Use strict in our context only - users might not want it
   'use strict';
 
-var pdfjsVersion = '1.6.222';
-var pdfjsBuild = 'd714873';
+var pdfjsVersion = '1.6.226';
+var pdfjsBuild = 'fb5aa58';
 
   var pdfjsFilePath =
     typeof document !== 'undefined' && document.currentScript ?

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "pdfjs-dist",
-  "version": "1.6.222",
+  "version": "1.6.226",
   "main": "build/pdf.js",
   "description": "Generic build of Mozilla's PDF.js library.",
   "keywords": [

+ 20 - 53
web/pdf_viewer.js

@@ -2794,59 +2794,6 @@ var PDFPageView = (function PDFPageViewClosure() {
       }
       return promise;
     },
-
-    beforePrint: function PDFPageView_beforePrint(printContainer) {
-      var CustomStyle = pdfjsLib.CustomStyle;
-      var pdfPage = this.pdfPage;
-
-      var viewport = pdfPage.getViewport(1);
-
-      var canvas = document.createElement('canvas');
-
-      // The size of the canvas in pixels for printing.
-      var PRINT_RESOLUTION = 150;
-      var PRINT_UNITS = PRINT_RESOLUTION / 72.0;
-      canvas.width = Math.floor(viewport.width * PRINT_UNITS);
-      canvas.height = Math.floor(viewport.height * PRINT_UNITS);
-
-      // The physical size of the canvas as specified by the PDF document.
-      canvas.style.width = Math.floor(viewport.width * CSS_UNITS) + 'px';
-      canvas.style.height = Math.floor(viewport.height * CSS_UNITS) + 'px';
-
-      var canvasWrapper = document.createElement('div');
-      canvasWrapper.appendChild(canvas);
-      printContainer.appendChild(canvasWrapper);
-
-      canvas.mozPrintCallback = function(obj) {
-        var ctx = obj.context;
-
-        ctx.save();
-        ctx.fillStyle = 'rgb(255, 255, 255)';
-        ctx.fillRect(0, 0, canvas.width, canvas.height);
-        ctx.restore();
-
-        var renderContext = {
-          canvasContext: ctx,
-          transform: [PRINT_UNITS, 0, 0, PRINT_UNITS, 0, 0],
-          viewport: viewport,
-          intent: 'print'
-        };
-
-        pdfPage.render(renderContext).promise.then(function() {
-          // Tell the printEngine that rendering this canvas/page has finished.
-          obj.done();
-        }, function(error) {
-          console.error(error);
-          // Tell the printEngine that rendering this canvas/page has failed.
-          // This will make the print process stop.
-          if ('abort' in obj) {
-            obj.abort();
-          } else {
-            obj.done();
-          }
-        });
-      };
-    },
   };
 
   return PDFPageView;
@@ -3494,6 +3441,13 @@ var PDFViewer = (function pdfViewer() {
       return this._pages[index];
     },
 
+    /**
+     * @returns {boolean} true if all {PDFPageView} objects are initialized.
+     */
+    get pageViewsReady() {
+      return this._pageViewsReady;
+    },
+
     /**
      * @returns {number}
      */
@@ -3642,6 +3596,7 @@ var PDFViewer = (function pdfViewer() {
       });
       this.pagesPromise = pagesPromise;
       pagesPromise.then(function () {
+        self._pageViewsReady = true;
         self.eventBus.dispatch('pagesloaded', {
           source: self,
           pagesCount: pagesCount
@@ -3747,6 +3702,7 @@ var PDFViewer = (function pdfViewer() {
       this._location = null;
       this._pagesRotation = 0;
       this._pagesRequests = [];
+      this._pageViewsReady = false;
 
       var container = this.viewer;
       while (container.hasChildNodes()) {
@@ -4208,6 +4164,17 @@ var PDFViewer = (function pdfViewer() {
     setFindController: function (findController) {
       this.findController = findController;
     },
+
+    /**
+     * Returns sizes of the pages.
+     * @returns {Array} Array of objects with width/height fields.
+     */
+    getPagesOverview: function () {
+      return this._pages.map(function (pageView) {
+        var viewport = pageView.pdfPage.getViewport(1);
+        return {width: viewport.width, height: viewport.height};
+      });
+    },
   };
 
   return PDFViewer;