From 6c932d6d0bae0ffb1eab3e84bcbeec979e9a177c Mon Sep 17 00:00:00 2001 From: Pdf Bot Date: Tue, 11 Oct 2016 20:29:18 +0100 Subject: [PATCH] PDF.js version 1.6.226 - See mozilla/pdf.js@fb5aa58008d53628bd368aca95799e64886c8ebe --- bower.json | 2 +- build/pdf.combined.js | 4 +-- build/pdf.js | 4 +-- build/pdf.worker.js | 4 +-- package.json | 2 +- web/pdf_viewer.js | 73 ++++++++++++------------------------------- 6 files changed, 28 insertions(+), 61 deletions(-) diff --git a/bower.json b/bower.json index 95c038e40..f7e684c0c 100644 --- a/bower.json +++ b/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" diff --git a/build/pdf.combined.js b/build/pdf.combined.js index c8fe3c9f3..dd016acb4 100644 --- a/build/pdf.combined.js +++ b/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 ? diff --git a/build/pdf.js b/build/pdf.js index 693c470df..be432c04b 100644 --- a/build/pdf.js +++ b/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 ? diff --git a/build/pdf.worker.js b/build/pdf.worker.js index b72bc1e38..bf5c7933d 100644 --- a/build/pdf.worker.js +++ b/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 ? diff --git a/package.json b/package.json index 698b12cc8..9e7af74a7 100644 --- a/package.json +++ b/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": [ diff --git a/web/pdf_viewer.js b/web/pdf_viewer.js index 22d5ccdff..563b13c65 100644 --- a/web/pdf_viewer.js +++ b/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;