Browse Source

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

master v1.6.226
Pdf Bot 9 years ago
parent
commit
6c932d6d0b
  1. 2
      bower.json
  2. 4
      build/pdf.combined.js
  3. 4
      build/pdf.js
  4. 4
      build/pdf.worker.js
  5. 2
      package.json
  6. 73
      web/pdf_viewer.js

2
bower.json

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

4
build/pdf.combined.js

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

4
build/pdf.js

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

4
build/pdf.worker.js vendored

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

2
package.json

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

73
web/pdf_viewer.js

@ -2794,59 +2794,6 @@ var PDFPageView = (function PDFPageViewClosure() {
} }
return promise; 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; return PDFPageView;
@ -3494,6 +3441,13 @@ var PDFViewer = (function pdfViewer() {
return this._pages[index]; return this._pages[index];
}, },
/**
* @returns {boolean} true if all {PDFPageView} objects are initialized.
*/
get pageViewsReady() {
return this._pageViewsReady;
},
/** /**
* @returns {number} * @returns {number}
*/ */
@ -3642,6 +3596,7 @@ var PDFViewer = (function pdfViewer() {
}); });
this.pagesPromise = pagesPromise; this.pagesPromise = pagesPromise;
pagesPromise.then(function () { pagesPromise.then(function () {
self._pageViewsReady = true;
self.eventBus.dispatch('pagesloaded', { self.eventBus.dispatch('pagesloaded', {
source: self, source: self,
pagesCount: pagesCount pagesCount: pagesCount
@ -3747,6 +3702,7 @@ var PDFViewer = (function pdfViewer() {
this._location = null; this._location = null;
this._pagesRotation = 0; this._pagesRotation = 0;
this._pagesRequests = []; this._pagesRequests = [];
this._pageViewsReady = false;
var container = this.viewer; var container = this.viewer;
while (container.hasChildNodes()) { while (container.hasChildNodes()) {
@ -4208,6 +4164,17 @@ var PDFViewer = (function pdfViewer() {
setFindController: function (findController) { setFindController: function (findController) {
this.findController = 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; return PDFViewer;

Loading…
Cancel
Save