Browse Source

PDF.js version 1.8.423 - See mozilla/pdf.js@8654635b0b97b1e1df2d7164c6d39db6da5e6fcd

master v1.8.423
pdfjsbot 8 years ago
parent
commit
46bf54a001
  1. 2
      bower.json
  2. 12
      build/pdf.combined.js
  3. 2
      build/pdf.combined.js.map
  4. 12
      build/pdf.js
  5. 2
      build/pdf.js.map
  6. 4
      build/pdf.min.js
  7. 4
      build/pdf.worker.js
  8. 2
      build/pdf.worker.js.map
  9. 4
      lib/display/api.js
  10. 4
      lib/display/global.js
  11. 4
      lib/pdf.js
  12. 4
      lib/pdf.worker.js
  13. 112
      lib/web/pdf_thumbnail_view.js
  14. 137
      lib/web/pdf_thumbnail_viewer.js
  15. 2
      package.json

2
bower.json

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

12
build/pdf.combined.js

@ -12809,8 +12809,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -12809,8 +12809,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.8.420';
exports.build = build = '63b89c11';
exports.version = version = '1.8.423';
exports.build = build = '8654635b';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -28147,8 +28147,8 @@ if (!_util.globalScope.PDFJS) { @@ -28147,8 +28147,8 @@ if (!_util.globalScope.PDFJS) {
}
var PDFJS = _util.globalScope.PDFJS;
{
PDFJS.version = '1.8.420';
PDFJS.build = '63b89c11';
PDFJS.version = '1.8.423';
PDFJS.build = '8654635b';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
@ -46762,8 +46762,8 @@ exports.TilingPattern = TilingPattern; @@ -46762,8 +46762,8 @@ exports.TilingPattern = TilingPattern;
"use strict";
var pdfjsVersion = '1.8.420';
var pdfjsBuild = '63b89c11';
var pdfjsVersion = '1.8.423';
var pdfjsBuild = '8654635b';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(26);
var pdfjsDisplayAPI = __w_pdfjs_require__(10);

2
build/pdf.combined.js.map

File diff suppressed because one or more lines are too long

12
build/pdf.js

@ -3538,8 +3538,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -3538,8 +3538,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.8.420';
exports.build = build = '63b89c11';
exports.version = version = '1.8.423';
exports.build = build = '8654635b';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
@ -5512,8 +5512,8 @@ if (!_util.globalScope.PDFJS) { @@ -5512,8 +5512,8 @@ if (!_util.globalScope.PDFJS) {
}
var PDFJS = _util.globalScope.PDFJS;
{
PDFJS.version = '1.8.420';
PDFJS.build = '63b89c11';
PDFJS.version = '1.8.423';
PDFJS.build = '8654635b';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
@ -11052,8 +11052,8 @@ exports.TilingPattern = TilingPattern; @@ -11052,8 +11052,8 @@ exports.TilingPattern = TilingPattern;
"use strict";
var pdfjsVersion = '1.8.420';
var pdfjsBuild = '63b89c11';
var pdfjsVersion = '1.8.423';
var pdfjsBuild = '8654635b';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(9);
var pdfjsDisplayAPI = __w_pdfjs_require__(3);

2
build/pdf.js.map

File diff suppressed because one or more lines are too long

4
build/pdf.min.js vendored

File diff suppressed because one or more lines are too long

4
build/pdf.worker.js vendored

@ -40061,8 +40061,8 @@ exports.Type1Parser = Type1Parser; @@ -40061,8 +40061,8 @@ exports.Type1Parser = Type1Parser;
"use strict";
var pdfjsVersion = '1.8.420';
var pdfjsBuild = '63b89c11';
var pdfjsVersion = '1.8.423';
var pdfjsBuild = '8654635b';
var pdfjsCoreWorker = __w_pdfjs_require__(8);
{
__w_pdfjs_require__(19);

2
build/pdf.worker.js.map vendored

File diff suppressed because one or more lines are too long

4
lib/display/api.js

@ -1418,8 +1418,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() { @@ -1418,8 +1418,8 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.8.420';
exports.build = build = '63b89c11';
exports.version = version = '1.8.423';
exports.build = build = '8654635b';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;

4
lib/display/global.js

@ -39,8 +39,8 @@ if (!_util.globalScope.PDFJS) { @@ -39,8 +39,8 @@ if (!_util.globalScope.PDFJS) {
}
var PDFJS = _util.globalScope.PDFJS;
{
PDFJS.version = '1.8.420';
PDFJS.build = '63b89c11';
PDFJS.version = '1.8.423';
PDFJS.build = '8654635b';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {

4
lib/pdf.js

@ -14,8 +14,8 @@ @@ -14,8 +14,8 @@
*/
'use strict';
var pdfjsVersion = '1.8.420';
var pdfjsBuild = '63b89c11';
var pdfjsVersion = '1.8.423';
var pdfjsBuild = '8654635b';
var pdfjsSharedUtil = require('./shared/util.js');
var pdfjsDisplayGlobal = require('./display/global.js');
var pdfjsDisplayAPI = require('./display/api.js');

4
lib/pdf.worker.js vendored

@ -14,8 +14,8 @@ @@ -14,8 +14,8 @@
*/
'use strict';
var pdfjsVersion = '1.8.420';
var pdfjsBuild = '63b89c11';
var pdfjsVersion = '1.8.423';
var pdfjsBuild = '8654635b';
var pdfjsCoreWorker = require('./core/worker.js');
{
require('./core/network.js');

112
lib/web/pdf_thumbnail_view.js

@ -19,14 +19,19 @@ Object.defineProperty(exports, "__esModule", { @@ -19,14 +19,19 @@ Object.defineProperty(exports, "__esModule", {
});
exports.PDFThumbnailView = undefined;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _pdf = require('../pdf');
var _ui_utils = require('./ui_utils');
var _pdf_rendering_queue = require('./pdf_rendering_queue');
var THUMBNAIL_WIDTH = 98;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var MAX_NUM_SCALING_STEPS = 3;
var THUMBNAIL_CANVAS_BORDER_WIDTH = 1;
var THUMBNAIL_WIDTH = 98;
var TempImageFactory = function TempImageFactoryClosure() {
var tempCanvasCache = null;
return {
@ -56,14 +61,21 @@ var TempImageFactory = function TempImageFactoryClosure() { @@ -56,14 +61,21 @@ var TempImageFactory = function TempImageFactoryClosure() {
}
};
}();
var PDFThumbnailView = function PDFThumbnailViewClosure() {
function PDFThumbnailView(options) {
var container = options.container;
var id = options.id;
var defaultViewport = options.defaultViewport;
var linkService = options.linkService;
var renderingQueue = options.renderingQueue;
var disableCanvasToImageConversion = options.disableCanvasToImageConversion || false;
var PDFThumbnailView = function () {
function PDFThumbnailView(_ref) {
var container = _ref.container,
id = _ref.id,
defaultViewport = _ref.defaultViewport,
linkService = _ref.linkService,
renderingQueue = _ref.renderingQueue,
_ref$disableCanvasToI = _ref.disableCanvasToImageConversion,
disableCanvasToImageConversion = _ref$disableCanvasToI === undefined ? false : _ref$disableCanvasToI,
_ref$l10n = _ref.l10n,
l10n = _ref$l10n === undefined ? _ui_utils.NullL10n : _ref$l10n;
_classCallCheck(this, PDFThumbnailView);
this.id = id;
this.renderingId = 'thumbnail' + id;
this.pageLabel = null;
@ -83,13 +95,13 @@ var PDFThumbnailView = function PDFThumbnailViewClosure() { @@ -83,13 +95,13 @@ var PDFThumbnailView = function PDFThumbnailViewClosure() {
this.canvasWidth = THUMBNAIL_WIDTH;
this.canvasHeight = this.canvasWidth / this.pageRatio | 0;
this.scale = this.canvasWidth / this.pageWidth;
this.l10n = options.l10n || _ui_utils.NullL10n;
this.l10n = l10n;
var anchor = document.createElement('a');
anchor.href = linkService.getAnchorUrl('#page=' + id);
this.l10n.get('thumb_page_title', { page: id }, 'Page {{page}}').then(function (msg) {
anchor.title = msg;
});
anchor.onclick = function stopNavigation() {
anchor.onclick = function () {
linkService.page = id;
return false;
};
@ -111,15 +123,19 @@ var PDFThumbnailView = function PDFThumbnailViewClosure() { @@ -111,15 +123,19 @@ var PDFThumbnailView = function PDFThumbnailViewClosure() {
anchor.appendChild(div);
container.appendChild(anchor);
}
PDFThumbnailView.prototype = {
setPdfPage: function PDFThumbnailView_setPdfPage(pdfPage) {
_createClass(PDFThumbnailView, [{
key: 'setPdfPage',
value: function setPdfPage(pdfPage) {
this.pdfPage = pdfPage;
this.pdfPageRotate = pdfPage.rotate;
var totalRotation = (this.rotation + this.pdfPageRotate) % 360;
this.viewport = pdfPage.getViewport(1, totalRotation);
this.reset();
},
reset: function PDFThumbnailView_reset() {
}
}, {
key: 'reset',
value: function reset() {
this.cancelRendering();
this.pageWidth = this.viewport.width;
this.pageHeight = this.viewport.height;
@ -144,8 +160,10 @@ var PDFThumbnailView = function PDFThumbnailViewClosure() { @@ -144,8 +160,10 @@ var PDFThumbnailView = function PDFThumbnailViewClosure() {
this.image.removeAttribute('src');
delete this.image;
}
},
update: function PDFThumbnailView_update(rotation) {
}
}, {
key: 'update',
value: function update(rotation) {
if (typeof rotation !== 'undefined') {
this.rotation = rotation;
}
@ -155,16 +173,22 @@ var PDFThumbnailView = function PDFThumbnailViewClosure() { @@ -155,16 +173,22 @@ var PDFThumbnailView = function PDFThumbnailViewClosure() {
rotation: totalRotation
});
this.reset();
},
cancelRendering: function PDFThumbnailView_cancelRendering() {
}
}, {
key: 'cancelRendering',
value: function cancelRendering() {
if (this.renderTask) {
this.renderTask.cancel();
this.renderTask = null;
}
this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL;
this.resume = null;
},
_getPageDrawContext: function PDFThumbnailView_getPageDrawContext(noCtxScale) {
}
}, {
key: '_getPageDrawContext',
value: function _getPageDrawContext() {
var noCtxScale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
var canvas = document.createElement('canvas');
this.canvas = canvas;
canvas.mozOpaque = true;
@ -178,8 +202,10 @@ var PDFThumbnailView = function PDFThumbnailViewClosure() { @@ -178,8 +202,10 @@ var PDFThumbnailView = function PDFThumbnailViewClosure() {
ctx.scale(outputScale.sx, outputScale.sy);
}
return ctx;
},
_convertCanvasToImage: function PDFThumbnailView_convertCanvasToImage() {
}
}, {
key: '_convertCanvasToImage',
value: function _convertCanvasToImage() {
var _this = this;
if (!this.canvas) {
@ -215,8 +241,10 @@ var PDFThumbnailView = function PDFThumbnailViewClosure() { @@ -215,8 +241,10 @@ var PDFThumbnailView = function PDFThumbnailViewClosure() {
this.canvas.width = 0;
this.canvas.height = 0;
delete this.canvas;
},
draw: function draw() {
}
}, {
key: 'draw',
value: function draw() {
var _this2 = this;
if (this.renderingState !== _pdf_rendering_queue.RenderingStates.INITIAL) {
@ -266,9 +294,10 @@ var PDFThumbnailView = function PDFThumbnailViewClosure() { @@ -266,9 +294,10 @@ var PDFThumbnailView = function PDFThumbnailViewClosure() {
finishRenderTask(error);
});
return renderCapability.promise;
},
setImage: function PDFThumbnailView_setImage(pageView) {
}
}, {
key: 'setImage',
value: function setImage(pageView) {
if (this.renderingState !== _pdf_rendering_queue.RenderingStates.INITIAL) {
return;
}
@ -287,7 +316,6 @@ var PDFThumbnailView = function PDFThumbnailViewClosure() { @@ -287,7 +316,6 @@ var PDFThumbnailView = function PDFThumbnailViewClosure() {
this._convertCanvasToImage();
return;
}
var MAX_NUM_SCALING_STEPS = 3;
var reducedWidth = canvas.width << MAX_NUM_SCALING_STEPS;
var reducedHeight = canvas.height << MAX_NUM_SCALING_STEPS;
var reducedImage = TempImageFactory.getCanvas(reducedWidth, reducedHeight);
@ -304,11 +332,10 @@ var PDFThumbnailView = function PDFThumbnailViewClosure() { @@ -304,11 +332,10 @@ var PDFThumbnailView = function PDFThumbnailViewClosure() {
}
ctx.drawImage(reducedImage, 0, 0, reducedWidth, reducedHeight, 0, 0, canvas.width, canvas.height);
this._convertCanvasToImage();
},
get pageId() {
return this.pageLabel !== null ? this.pageLabel : this.id;
},
setPageLabel: function PDFThumbnailView_setPageLabel(label) {
}
}, {
key: 'setPageLabel',
value: function setPageLabel(label) {
var _this3 = this;
this.pageLabel = typeof label === 'string' ? label : null;
@ -326,10 +353,19 @@ var PDFThumbnailView = function PDFThumbnailViewClosure() { @@ -326,10 +353,19 @@ var PDFThumbnailView = function PDFThumbnailViewClosure() {
}
});
}
};
PDFThumbnailView.cleanup = function () {
TempImageFactory.destroyCanvas();
};
}, {
key: 'pageId',
get: function get() {
return this.pageLabel !== null ? this.pageLabel : this.id;
}
}], [{
key: 'cleanup',
value: function cleanup() {
TempImageFactory.destroyCanvas();
}
}]);
return PDFThumbnailView;
}();
exports.PDFThumbnailView = PDFThumbnailView;

137
lib/web/pdf_thumbnail_viewer.js

@ -19,31 +19,52 @@ Object.defineProperty(exports, "__esModule", { @@ -19,31 +19,52 @@ Object.defineProperty(exports, "__esModule", {
});
exports.PDFThumbnailViewer = undefined;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _ui_utils = require('./ui_utils');
var _pdf_thumbnail_view = require('./pdf_thumbnail_view');
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var THUMBNAIL_SCROLL_MARGIN = -19;
var PDFThumbnailViewer = function PDFThumbnailViewerClosure() {
function PDFThumbnailViewer(options) {
this.container = options.container;
this.renderingQueue = options.renderingQueue;
this.linkService = options.linkService;
this.l10n = options.l10n || _ui_utils.NullL10n;
var PDFThumbnailViewer = function () {
function PDFThumbnailViewer(_ref) {
var container = _ref.container,
linkService = _ref.linkService,
renderingQueue = _ref.renderingQueue,
_ref$l10n = _ref.l10n,
l10n = _ref$l10n === undefined ? _ui_utils.NullL10n : _ref$l10n;
_classCallCheck(this, PDFThumbnailViewer);
this.container = container;
this.linkService = linkService;
this.renderingQueue = renderingQueue;
this.l10n = l10n;
this.scroll = (0, _ui_utils.watchScroll)(this.container, this._scrollUpdated.bind(this));
this._resetView();
}
PDFThumbnailViewer.prototype = {
_scrollUpdated: function PDFThumbnailViewer_scrollUpdated() {
_createClass(PDFThumbnailViewer, [{
key: '_scrollUpdated',
value: function _scrollUpdated() {
this.renderingQueue.renderHighestPriority();
},
getThumbnail: function PDFThumbnailViewer_getThumbnail(index) {
return this.thumbnails[index];
},
_getVisibleThumbs: function PDFThumbnailViewer_getVisibleThumbs() {
return (0, _ui_utils.getVisibleElements)(this.container, this.thumbnails);
},
scrollThumbnailIntoView: function PDFThumbnailViewer_scrollThumbnailIntoView(page) {
}
}, {
key: 'getThumbnail',
value: function getThumbnail(index) {
return this._thumbnails[index];
}
}, {
key: '_getVisibleThumbs',
value: function _getVisibleThumbs() {
return (0, _ui_utils.getVisibleElements)(this.container, this._thumbnails);
}
}, {
key: 'scrollThumbnailIntoView',
value: function scrollThumbnailIntoView(page) {
var selected = document.querySelector('.thumbnail.selected');
if (selected) {
selected.classList.remove('selected');
@ -61,28 +82,24 @@ var PDFThumbnailViewer = function PDFThumbnailViewerClosure() { @@ -61,28 +82,24 @@ var PDFThumbnailViewer = function PDFThumbnailViewerClosure() {
(0, _ui_utils.scrollIntoView)(thumbnail, { top: THUMBNAIL_SCROLL_MARGIN });
}
}
},
get pagesRotation() {
return this._pagesRotation;
},
set pagesRotation(rotation) {
this._pagesRotation = rotation;
for (var i = 0, l = this.thumbnails.length; i < l; i++) {
var thumb = this.thumbnails[i];
thumb.update(rotation);
}
},
cleanup: function PDFThumbnailViewer_cleanup() {
}
}, {
key: 'cleanup',
value: function cleanup() {
_pdf_thumbnail_view.PDFThumbnailView.cleanup();
},
_resetView: function PDFThumbnailViewer_resetView() {
this.thumbnails = [];
}
}, {
key: '_resetView',
value: function _resetView() {
this._thumbnails = [];
this._pageLabels = null;
this._pagesRotation = 0;
this._pagesRequests = [];
this.container.textContent = '';
},
setDocument: function PDFThumbnailViewer_setDocument(pdfDocument) {
}
}, {
key: 'setDocument',
value: function setDocument(pdfDocument) {
var _this = this;
if (this.pdfDocument) {
@ -106,18 +123,22 @@ var PDFThumbnailViewer = function PDFThumbnailViewerClosure() { @@ -106,18 +123,22 @@ var PDFThumbnailViewer = function PDFThumbnailViewerClosure() {
disableCanvasToImageConversion: false,
l10n: _this.l10n
});
_this.thumbnails.push(thumbnail);
_this._thumbnails.push(thumbnail);
}
});
},
_cancelRendering: function PDFThumbnailViewer_cancelRendering() {
for (var i = 0, ii = this.thumbnails.length; i < ii; i++) {
if (this.thumbnails[i]) {
this.thumbnails[i].cancelRendering();
}
}, {
key: '_cancelRendering',
value: function _cancelRendering() {
for (var i = 0, ii = this._thumbnails.length; i < ii; i++) {
if (this._thumbnails[i]) {
this._thumbnails[i].cancelRendering();
}
}
},
setPageLabels: function PDFThumbnailViewer_setPageLabels(labels) {
}
}, {
key: 'setPageLabels',
value: function setPageLabels(labels) {
if (!this.pdfDocument) {
return;
}
@ -129,13 +150,14 @@ var PDFThumbnailViewer = function PDFThumbnailViewerClosure() { @@ -129,13 +150,14 @@ var PDFThumbnailViewer = function PDFThumbnailViewerClosure() {
} else {
this._pageLabels = labels;
}
for (var i = 0, ii = this.thumbnails.length; i < ii; i++) {
var thumbnailView = this.thumbnails[i];
for (var i = 0, ii = this._thumbnails.length; i < ii; i++) {
var label = this._pageLabels && this._pageLabels[i];
thumbnailView.setPageLabel(label);
this._thumbnails[i].setPageLabel(label);
}
},
_ensurePdfPageLoaded: function _ensurePdfPageLoaded(thumbView) {
}
}, {
key: '_ensurePdfPageLoaded',
value: function _ensurePdfPageLoaded(thumbView) {
var _this2 = this;
if (thumbView.pdfPage) {
@ -152,12 +174,14 @@ var PDFThumbnailViewer = function PDFThumbnailViewerClosure() { @@ -152,12 +174,14 @@ var PDFThumbnailViewer = function PDFThumbnailViewerClosure() {
});
this._pagesRequests[pageNumber] = promise;
return promise;
},
forceRendering: function forceRendering() {
}
}, {
key: 'forceRendering',
value: function forceRendering() {
var _this3 = this;
var visibleThumbs = this._getVisibleThumbs();
var thumbView = this.renderingQueue.getHighestPriority(visibleThumbs, this.thumbnails, this.scroll.down);
var thumbView = this.renderingQueue.getHighestPriority(visibleThumbs, this._thumbnails, this.scroll.down);
if (thumbView) {
this._ensurePdfPageLoaded(thumbView).then(function () {
_this3.renderingQueue.renderView(thumbView);
@ -166,7 +190,20 @@ var PDFThumbnailViewer = function PDFThumbnailViewerClosure() { @@ -166,7 +190,20 @@ var PDFThumbnailViewer = function PDFThumbnailViewerClosure() {
}
return false;
}
};
}, {
key: 'pagesRotation',
get: function get() {
return this._pagesRotation;
},
set: function set(rotation) {
this._pagesRotation = rotation;
for (var i = 0, l = this._thumbnails.length; i < l; i++) {
this._thumbnails[i].update(rotation);
}
}
}]);
return PDFThumbnailViewer;
}();
exports.PDFThumbnailViewer = PDFThumbnailViewer;

2
package.json

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

Loading…
Cancel
Save