pdfjs-dist 2.2.228 → 2.3.200
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pdfjs-dist might be problematic. Click here for more details.
- package/bower.json +1 -1
- package/build/pdf.js +8851 -8582
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +1 -1
- package/build/pdf.worker.js +8717 -8394
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +1 -1
- package/image_decoders/pdf.image_decoders.js +3014 -2864
- package/image_decoders/pdf.image_decoders.js.map +1 -1
- package/image_decoders/pdf.image_decoders.min.js +1 -1
- package/lib/core/annotation.js +203 -39
- package/lib/core/chunked_stream.js +32 -9
- package/lib/core/core_utils.js +48 -22
- package/lib/core/document.js +44 -33
- package/lib/core/evaluator.js +68 -32
- package/lib/core/fonts.js +2 -2
- package/lib/core/glyphlist.js +1 -0
- package/lib/core/image.js +1 -1
- package/lib/core/jbig2.js +23 -6
- package/lib/core/jpg.js +54 -23
- package/lib/core/jpx.js +23 -6
- package/lib/core/obj.js +18 -16
- package/lib/core/operator_list.js +17 -14
- package/lib/core/parser.js +9 -12
- package/lib/core/pattern.js +22 -7
- package/lib/core/pdf_manager.js +4 -4
- package/lib/core/primitives.js +63 -42
- package/lib/core/stream.js +14 -0
- package/lib/core/type1_parser.js +9 -1
- package/lib/core/worker.js +17 -56
- package/lib/display/annotation_layer.js +194 -85
- package/lib/display/api.js +331 -213
- package/lib/display/canvas.js +6 -1
- package/lib/display/content_disposition.js +1 -1
- package/lib/display/display_utils.js +48 -18
- package/lib/display/network_utils.js +6 -0
- package/lib/display/pattern_helper.js +22 -5
- package/lib/display/svg.js +1 -1
- package/lib/display/text_layer.js +62 -53
- package/lib/display/xml_parser.js +1 -1
- package/lib/pdf.js +2 -3
- package/lib/pdf.worker.js +2 -2
- package/lib/shared/compatibility.js +23 -19
- package/lib/shared/message_handler.js +163 -196
- package/lib/shared/streams_polyfill.js +1 -1
- package/lib/shared/util.js +288 -196
- package/lib/test/unit/annotation_spec.js +687 -93
- package/lib/test/unit/api_spec.js +72 -27
- package/lib/test/unit/display_utils_spec.js +1 -1
- package/lib/test/unit/evaluator_spec.js +21 -5
- package/lib/test/unit/fetch_stream_spec.js +3 -1
- package/lib/test/unit/message_handler_spec.js +10 -6
- package/lib/test/unit/network_spec.js +3 -1
- package/lib/test/unit/network_utils_spec.js +14 -0
- package/lib/test/unit/node_stream_spec.js +3 -3
- package/lib/test/unit/primitives_spec.js +2 -2
- package/lib/test/unit/type1_parser_spec.js +1 -1
- package/lib/test/unit/ui_utils_spec.js +1 -1
- package/lib/test/unit/util_spec.js +10 -10
- package/lib/web/app.js +47 -35
- package/lib/web/app_options.js +4 -4
- package/lib/web/base_viewer.js +36 -12
- package/lib/web/chromecom.js +1 -3
- package/lib/web/download_manager.js +1 -1
- package/lib/web/firefox_print_service.js +7 -4
- package/lib/web/firefoxcom.js +10 -5
- package/lib/web/interfaces.js +4 -0
- package/lib/web/pdf_document_properties.js +1 -1
- package/lib/web/pdf_history.js +1 -1
- package/lib/web/pdf_link_service.js +7 -3
- package/lib/web/pdf_outline_viewer.js +2 -1
- package/lib/web/pdf_page_view.js +12 -16
- package/lib/web/pdf_print_service.js +3 -5
- package/lib/web/pdf_sidebar.js +3 -0
- package/lib/web/pdf_viewer.component.js +2 -2
- package/lib/web/toolbar.js +2 -0
- package/lib/web/ui_utils.js +1 -1
- package/package.json +1 -1
- package/web/pdf_viewer.css +5 -9
- package/web/pdf_viewer.js +60 -45
- package/web/pdf_viewer.js.map +1 -1
- package/external/streams/streams-lib.js +0 -3962
- package/external/url/url-lib.js +0 -627
- package/lib/shared/url_polyfill.js +0 -56
package/lib/web/app.js
CHANGED
@@ -78,7 +78,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
78
78
|
|
79
79
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
80
80
|
|
81
|
-
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
81
|
+
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
82
82
|
|
83
83
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
84
84
|
|
@@ -466,7 +466,11 @@ var PDFViewerApplication = {
|
|
466
466
|
eventBus: eventBus
|
467
467
|
});
|
468
468
|
pdfLinkService.setHistory(this.pdfHistory);
|
469
|
-
|
469
|
+
|
470
|
+
if (!this.supportsIntegratedFind) {
|
471
|
+
this.findBar = new _pdf_find_bar.PDFFindBar(appConfig.findBar, eventBus, this.l10n);
|
472
|
+
}
|
473
|
+
|
470
474
|
this.pdfDocumentProperties = new _pdf_document_properties.PDFDocumentProperties(appConfig.documentProperties, this.overlayManager, eventBus, this.l10n);
|
471
475
|
this.pdfCursorTools = new _pdf_cursor_tools.PDFCursorTools({
|
472
476
|
container: container,
|
@@ -525,6 +529,10 @@ var PDFViewerApplication = {
|
|
525
529
|
this.initialize(config).then(webViewerInitialized);
|
526
530
|
},
|
527
531
|
zoomIn: function zoomIn(ticks) {
|
532
|
+
if (this.pdfViewer.isInPresentationMode) {
|
533
|
+
return;
|
534
|
+
}
|
535
|
+
|
528
536
|
var newScale = this.pdfViewer.currentScale;
|
529
537
|
|
530
538
|
do {
|
@@ -536,6 +544,10 @@ var PDFViewerApplication = {
|
|
536
544
|
this.pdfViewer.currentScaleValue = newScale;
|
537
545
|
},
|
538
546
|
zoomOut: function zoomOut(ticks) {
|
547
|
+
if (this.pdfViewer.isInPresentationMode) {
|
548
|
+
return;
|
549
|
+
}
|
550
|
+
|
539
551
|
var newScale = this.pdfViewer.currentScale;
|
540
552
|
|
541
553
|
do {
|
@@ -547,12 +559,8 @@ var PDFViewerApplication = {
|
|
547
559
|
this.pdfViewer.currentScaleValue = newScale;
|
548
560
|
},
|
549
561
|
zoomReset: function zoomReset() {
|
550
|
-
var ignoreDuplicate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
551
|
-
|
552
562
|
if (this.pdfViewer.isInPresentationMode) {
|
553
563
|
return;
|
554
|
-
} else if (ignoreDuplicate && this.pdfViewer.currentScaleValue === _ui_utils.DEFAULT_SCALE_VALUE) {
|
555
|
-
return;
|
556
564
|
}
|
557
565
|
|
558
566
|
this.pdfViewer.currentScaleValue = _ui_utils.DEFAULT_SCALE_VALUE;
|
@@ -677,7 +685,11 @@ var PDFViewerApplication = {
|
|
677
685
|
this.pdfSidebar.reset();
|
678
686
|
this.pdfOutlineViewer.reset();
|
679
687
|
this.pdfAttachmentViewer.reset();
|
680
|
-
|
688
|
+
|
689
|
+
if (this.findBar) {
|
690
|
+
this.findBar.reset();
|
691
|
+
}
|
692
|
+
|
681
693
|
this.toolbar.reset();
|
682
694
|
this.secondaryToolbar.reset();
|
683
695
|
|
@@ -707,7 +719,7 @@ var PDFViewerApplication = {
|
|
707
719
|
_regenerator["default"].mark(function _callee7(file, args) {
|
708
720
|
var _this2 = this;
|
709
721
|
|
710
|
-
var workerParameters, key, parameters, apiParameters, _key,
|
722
|
+
var workerParameters, key, parameters, apiParameters, _key, value, _key2, _value, loadingTask;
|
711
723
|
|
712
724
|
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
713
725
|
while (1) {
|
@@ -743,16 +755,22 @@ var PDFViewerApplication = {
|
|
743
755
|
apiParameters = _app_options.AppOptions.getAll(_app_options.OptionKind.API);
|
744
756
|
|
745
757
|
for (_key in apiParameters) {
|
746
|
-
|
758
|
+
value = apiParameters[_key];
|
759
|
+
|
760
|
+
if (_key === 'docBaseUrl' && !value) {}
|
761
|
+
|
762
|
+
parameters[_key] = value;
|
747
763
|
}
|
748
764
|
|
749
765
|
if (args) {
|
750
|
-
for (
|
751
|
-
|
752
|
-
|
766
|
+
for (_key2 in args) {
|
767
|
+
_value = args[_key2];
|
768
|
+
|
769
|
+
if (_key2 === 'length') {
|
770
|
+
this.pdfDocumentProperties.setFileSize(_value);
|
753
771
|
}
|
754
772
|
|
755
|
-
parameters[
|
773
|
+
parameters[_key2] = _value;
|
756
774
|
}
|
757
775
|
}
|
758
776
|
|
@@ -760,6 +778,8 @@ var PDFViewerApplication = {
|
|
760
778
|
this.pdfLoadingTask = loadingTask;
|
761
779
|
|
762
780
|
loadingTask.onPassword = function (updateCallback, reason) {
|
781
|
+
_this2.pdfLinkService.externalLinkEnabled = false;
|
782
|
+
|
763
783
|
_this2.passwordPrompt.setUpdateCallback(updateCallback, reason);
|
764
784
|
|
765
785
|
_this2.passwordPrompt.open();
|
@@ -984,19 +1004,19 @@ var PDFViewerApplication = {
|
|
984
1004
|
scrollMode: _ui_utils.ScrollMode.UNKNOWN,
|
985
1005
|
spreadMode: _ui_utils.SpreadMode.UNKNOWN
|
986
1006
|
})["catch"](function () {});
|
987
|
-
Promise.all([storePromise, pageLayoutPromise, pageModePromise, openActionDestPromise]).then(
|
1007
|
+
Promise.all([_ui_utils.animationStarted, storePromise, pageLayoutPromise, pageModePromise, openActionDestPromise]).then(
|
988
1008
|
/*#__PURE__*/
|
989
1009
|
function () {
|
990
1010
|
var _ref3 = _asyncToGenerator(
|
991
1011
|
/*#__PURE__*/
|
992
1012
|
_regenerator["default"].mark(function _callee8(_ref2) {
|
993
|
-
var _ref4, _ref4$, values, pageLayout, pageMode, openActionDest, viewOnLoad, initialBookmark, zoom, hash, rotation, sidebarView, scrollMode, spreadMode;
|
1013
|
+
var _ref4, timeStamp, _ref4$, values, pageLayout, pageMode, openActionDest, viewOnLoad, initialBookmark, zoom, hash, rotation, sidebarView, scrollMode, spreadMode;
|
994
1014
|
|
995
1015
|
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
996
1016
|
while (1) {
|
997
1017
|
switch (_context8.prev = _context8.next) {
|
998
1018
|
case 0:
|
999
|
-
_ref4 = _slicedToArray(_ref2,
|
1019
|
+
_ref4 = _slicedToArray(_ref2, 5), timeStamp = _ref4[0], _ref4$ = _ref4[1], values = _ref4$ === void 0 ? {} : _ref4$, pageLayout = _ref4[2], pageMode = _ref4[3], openActionDest = _ref4[4];
|
1000
1020
|
viewOnLoad = _app_options.AppOptions.get('viewOnLoad');
|
1001
1021
|
|
1002
1022
|
_this5._initializePdfHistory({
|
@@ -1160,7 +1180,7 @@ var PDFViewerApplication = {
|
|
1160
1180
|
}
|
1161
1181
|
});
|
1162
1182
|
});
|
1163
|
-
|
1183
|
+
onePageRendered.then(function () {
|
1164
1184
|
pdfDocument.getOutline().then(function (outline) {
|
1165
1185
|
_this5.pdfOutlineViewer.render({
|
1166
1186
|
outline: outline
|
@@ -1327,7 +1347,7 @@ var PDFViewerApplication = {
|
|
1327
1347
|
this.forceRendering();
|
1328
1348
|
printService.layout();
|
1329
1349
|
},
|
1330
|
-
afterPrint: function
|
1350
|
+
afterPrint: function afterPrint() {
|
1331
1351
|
if (this.printService) {
|
1332
1352
|
this.printService.destroy();
|
1333
1353
|
this.printService = null;
|
@@ -1507,13 +1527,13 @@ var validateFileURL;
|
|
1507
1527
|
}
|
1508
1528
|
|
1509
1529
|
try {
|
1510
|
-
var viewerOrigin = new
|
1530
|
+
var viewerOrigin = new URL(window.location.href).origin || 'null';
|
1511
1531
|
|
1512
1532
|
if (HOSTED_VIEWER_ORIGINS.includes(viewerOrigin)) {
|
1513
1533
|
return;
|
1514
1534
|
}
|
1515
1535
|
|
1516
|
-
var _ref8 = new
|
1536
|
+
var _ref8 = new URL(file, window.location.href),
|
1517
1537
|
origin = _ref8.origin,
|
1518
1538
|
protocol = _ref8.protocol;
|
1519
1539
|
|
@@ -1623,9 +1643,6 @@ function webViewerInitialized() {
|
|
1623
1643
|
});
|
1624
1644
|
}
|
1625
1645
|
}, true);
|
1626
|
-
appConfig.sidebar.toggleButton.addEventListener('click', function () {
|
1627
|
-
PDFViewerApplication.pdfSidebar.toggle();
|
1628
|
-
});
|
1629
1646
|
|
1630
1647
|
try {
|
1631
1648
|
webViewerOpenFileViaURL(file);
|
@@ -1830,8 +1847,8 @@ var webViewerFileInputChange;
|
|
1830
1847
|
|
1831
1848
|
var file = evt.fileInput.files[0];
|
1832
1849
|
|
1833
|
-
if (
|
1834
|
-
var url =
|
1850
|
+
if (URL.createObjectURL && !_app_options.AppOptions.get('disableCreateObjectURL')) {
|
1851
|
+
var url = URL.createObjectURL(file);
|
1835
1852
|
|
1836
1853
|
if (file.name) {
|
1837
1854
|
url = {
|
@@ -1906,8 +1923,8 @@ function webViewerZoomOut() {
|
|
1906
1923
|
PDFViewerApplication.zoomOut();
|
1907
1924
|
}
|
1908
1925
|
|
1909
|
-
function webViewerZoomReset(
|
1910
|
-
PDFViewerApplication.zoomReset(
|
1926
|
+
function webViewerZoomReset() {
|
1927
|
+
PDFViewerApplication.zoomReset();
|
1911
1928
|
}
|
1912
1929
|
|
1913
1930
|
function webViewerPageNumberChanged(evt) {
|
@@ -2042,19 +2059,14 @@ function setZoomDisabledTimeout() {
|
|
2042
2059
|
}
|
2043
2060
|
|
2044
2061
|
function webViewerWheel(evt) {
|
2045
|
-
var pdfViewer = PDFViewerApplication.pdfViewer
|
2062
|
+
var pdfViewer = PDFViewerApplication.pdfViewer,
|
2063
|
+
supportedMouseWheelZoomModifierKeys = PDFViewerApplication.supportedMouseWheelZoomModifierKeys;
|
2046
2064
|
|
2047
2065
|
if (pdfViewer.isInPresentationMode) {
|
2048
2066
|
return;
|
2049
2067
|
}
|
2050
2068
|
|
2051
|
-
if (evt.ctrlKey || evt.metaKey) {
|
2052
|
-
var support = PDFViewerApplication.supportedMouseWheelZoomModifierKeys;
|
2053
|
-
|
2054
|
-
if (evt.ctrlKey && !support.ctrlKey || evt.metaKey && !support.metaKey) {
|
2055
|
-
return;
|
2056
|
-
}
|
2057
|
-
|
2069
|
+
if (evt.ctrlKey && supportedMouseWheelZoomModifierKeys.ctrlKey || evt.metaKey && supportedMouseWheelZoomModifierKeys.metaKey) {
|
2058
2070
|
evt.preventDefault();
|
2059
2071
|
|
2060
2072
|
if (zoomDisabledTimeout || document.visibilityState === 'hidden') {
|
package/lib/web/app_options.js
CHANGED
@@ -164,6 +164,10 @@ var defaultOptions = {
|
|
164
164
|
value: false,
|
165
165
|
kind: OptionKind.API + OptionKind.PREFERENCE
|
166
166
|
},
|
167
|
+
docBaseUrl: {
|
168
|
+
value: '',
|
169
|
+
kind: OptionKind.API
|
170
|
+
},
|
167
171
|
isEvalSupported: {
|
168
172
|
value: true,
|
169
173
|
kind: OptionKind.API
|
@@ -176,10 +180,6 @@ var defaultOptions = {
|
|
176
180
|
value: false,
|
177
181
|
kind: OptionKind.API
|
178
182
|
},
|
179
|
-
postMessageTransfers: {
|
180
|
-
value: true,
|
181
|
-
kind: OptionKind.API
|
182
|
-
},
|
183
183
|
verbosity: {
|
184
184
|
value: 1,
|
185
185
|
kind: OptionKind.API
|
package/lib/web/base_viewer.js
CHANGED
@@ -138,6 +138,7 @@ function () {
|
|
138
138
|
|
139
139
|
this.scroll = (0, _ui_utils.watchScroll)(this.container, this._scrollUpdate.bind(this));
|
140
140
|
this.presentationModeState = _ui_utils.PresentationModeState.UNKNOWN;
|
141
|
+
this._onBeforeDraw = this._onAfterDraw = null;
|
141
142
|
|
142
143
|
this._resetView();
|
143
144
|
|
@@ -221,21 +222,34 @@ function () {
|
|
221
222
|
});
|
222
223
|
var onePageRenderedCapability = (0, _pdf.createPromiseCapability)();
|
223
224
|
this.onePageRendered = onePageRenderedCapability.promise;
|
225
|
+
var firstPagePromise = pdfDocument.getPage(1);
|
226
|
+
this.firstPagePromise = firstPagePromise;
|
224
227
|
|
225
|
-
|
226
|
-
pageView
|
227
|
-
_this2._buffer.push(pageView);
|
228
|
-
};
|
228
|
+
this._onBeforeDraw = function (evt) {
|
229
|
+
var pageView = _this2._pages[evt.pageNumber - 1];
|
229
230
|
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
231
|
+
if (!pageView) {
|
232
|
+
return;
|
233
|
+
}
|
234
|
+
|
235
|
+
_this2._buffer.push(pageView);
|
235
236
|
};
|
236
237
|
|
237
|
-
|
238
|
-
|
238
|
+
this.eventBus.on('pagerender', this._onBeforeDraw);
|
239
|
+
|
240
|
+
this._onAfterDraw = function (evt) {
|
241
|
+
if (evt.cssTransform || onePageRenderedCapability.settled) {
|
242
|
+
return;
|
243
|
+
}
|
244
|
+
|
245
|
+
onePageRenderedCapability.resolve();
|
246
|
+
|
247
|
+
_this2.eventBus.off('pagerendered', _this2._onAfterDraw);
|
248
|
+
|
249
|
+
_this2._onAfterDraw = null;
|
250
|
+
};
|
251
|
+
|
252
|
+
this.eventBus.on('pagerendered', this._onAfterDraw);
|
239
253
|
firstPagePromise.then(function (pdfPage) {
|
240
254
|
var scale = _this2.currentScale;
|
241
255
|
var viewport = pdfPage.getViewport({
|
@@ -267,7 +281,6 @@ function () {
|
|
267
281
|
maxCanvasPixels: _this2.maxCanvasPixels,
|
268
282
|
l10n: _this2.l10n
|
269
283
|
});
|
270
|
-
bindOnAfterAndBeforeDraw(pageView);
|
271
284
|
|
272
285
|
_this2._pages.push(pageView);
|
273
286
|
}
|
@@ -363,6 +376,17 @@ function () {
|
|
363
376
|
this._pageViewsReady = false;
|
364
377
|
this._scrollMode = _ui_utils.ScrollMode.VERTICAL;
|
365
378
|
this._spreadMode = _ui_utils.SpreadMode.NONE;
|
379
|
+
|
380
|
+
if (this._onBeforeDraw) {
|
381
|
+
this.eventBus.off('pagerender', this._onBeforeDraw);
|
382
|
+
this._onBeforeDraw = null;
|
383
|
+
}
|
384
|
+
|
385
|
+
if (this._onAfterDraw) {
|
386
|
+
this.eventBus.off('pagerendered', this._onAfterDraw);
|
387
|
+
this._onAfterDraw = null;
|
388
|
+
}
|
389
|
+
|
366
390
|
this.viewer.textContent = '';
|
367
391
|
|
368
392
|
this._updateScrollMode();
|
package/lib/web/chromecom.js
CHANGED
@@ -38,8 +38,6 @@ var _download_manager = require("./download_manager");
|
|
38
38
|
|
39
39
|
var _genericl10n = require("./genericl10n");
|
40
40
|
|
41
|
-
var _pdf = require("../pdf");
|
42
|
-
|
43
41
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
44
42
|
|
45
43
|
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
@@ -265,7 +263,7 @@ function requestAccessToLocalFile(fileUrl, overlayManager, callback) {
|
|
265
263
|
originalUrl = 'file:///fakepath/to/' + encodeURIComponent(file.name);
|
266
264
|
}
|
267
265
|
|
268
|
-
callback(
|
266
|
+
callback(URL.createObjectURL(file), file.size, originalUrl);
|
269
267
|
overlayManager.close('chromeFileAccessOverlay');
|
270
268
|
}
|
271
269
|
};
|
@@ -85,17 +85,20 @@ function FirefoxPrintService(pdfDocument, pagesOverview, printContainer) {
|
|
85
85
|
|
86
86
|
FirefoxPrintService.prototype = {
|
87
87
|
layout: function layout() {
|
88
|
-
var pdfDocument = this.pdfDocument
|
89
|
-
|
88
|
+
var pdfDocument = this.pdfDocument,
|
89
|
+
pagesOverview = this.pagesOverview,
|
90
|
+
printContainer = this.printContainer;
|
90
91
|
var body = document.querySelector('body');
|
91
92
|
body.setAttribute('data-pdfjsprinting', true);
|
92
93
|
|
93
|
-
for (var i = 0, ii =
|
94
|
-
composePage(pdfDocument, i + 1,
|
94
|
+
for (var i = 0, ii = pagesOverview.length; i < ii; ++i) {
|
95
|
+
composePage(pdfDocument, i + 1, pagesOverview[i], printContainer);
|
95
96
|
}
|
96
97
|
},
|
97
98
|
destroy: function destroy() {
|
98
99
|
this.printContainer.textContent = '';
|
100
|
+
var body = document.querySelector('body');
|
101
|
+
body.removeAttribute('data-pdfjsprinting');
|
99
102
|
}
|
100
103
|
};
|
101
104
|
_app.PDFPrintServiceFactory.instance = {
|
package/lib/web/firefoxcom.js
CHANGED
@@ -34,6 +34,8 @@ var _pdf = require("../pdf");
|
|
34
34
|
|
35
35
|
var _preferences = require("./preferences");
|
36
36
|
|
37
|
+
var _ui_utils = require("./ui_utils");
|
38
|
+
|
37
39
|
var _app = require("./app");
|
38
40
|
|
39
41
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
@@ -141,14 +143,14 @@ function () {
|
|
141
143
|
value: function download(blob, url, filename) {
|
142
144
|
var _this = this;
|
143
145
|
|
144
|
-
var blobUrl =
|
146
|
+
var blobUrl = URL.createObjectURL(blob);
|
145
147
|
|
146
148
|
var onResponse = function onResponse(err) {
|
147
149
|
if (err && _this.onerror) {
|
148
150
|
_this.onerror(err);
|
149
151
|
}
|
150
152
|
|
151
|
-
|
153
|
+
URL.revokeObjectURL(blobUrl);
|
152
154
|
};
|
153
155
|
|
154
156
|
FirefoxCom.request('download', {
|
@@ -369,7 +371,7 @@ function () {
|
|
369
371
|
}
|
370
372
|
|
371
373
|
if (type === 'findbarclose') {
|
372
|
-
_app.PDFViewerApplication.eventBus.dispatch(
|
374
|
+
_app.PDFViewerApplication.eventBus.dispatch(type, {
|
373
375
|
source: window
|
374
376
|
});
|
375
377
|
|
@@ -405,9 +407,12 @@ function () {
|
|
405
407
|
return;
|
406
408
|
}
|
407
409
|
|
410
|
+
if (type === 'zoomreset' && _app.PDFViewerApplication.pdfViewer.currentScaleValue === _ui_utils.DEFAULT_SCALE_VALUE) {
|
411
|
+
return;
|
412
|
+
}
|
413
|
+
|
408
414
|
_app.PDFViewerApplication.eventBus.dispatch(type, {
|
409
|
-
source: window
|
410
|
-
ignoreDuplicate: type === 'zoomreset' ? true : undefined
|
415
|
+
source: window
|
411
416
|
});
|
412
417
|
};
|
413
418
|
|
package/lib/web/interfaces.js
CHANGED
@@ -42,7 +42,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
42
42
|
|
43
43
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
44
44
|
|
45
|
-
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
45
|
+
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
46
46
|
|
47
47
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
48
48
|
|
package/lib/web/pdf_history.js
CHANGED
@@ -36,7 +36,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
36
36
|
|
37
37
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
38
38
|
|
39
|
-
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
39
|
+
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
40
40
|
|
41
41
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
42
42
|
|
@@ -45,13 +45,16 @@ function () {
|
|
45
45
|
_ref$externalLinkTarg = _ref.externalLinkTarget,
|
46
46
|
externalLinkTarget = _ref$externalLinkTarg === void 0 ? null : _ref$externalLinkTarg,
|
47
47
|
_ref$externalLinkRel = _ref.externalLinkRel,
|
48
|
-
externalLinkRel = _ref$externalLinkRel === void 0 ? null : _ref$externalLinkRel
|
48
|
+
externalLinkRel = _ref$externalLinkRel === void 0 ? null : _ref$externalLinkRel,
|
49
|
+
_ref$externalLinkEnab = _ref.externalLinkEnabled,
|
50
|
+
externalLinkEnabled = _ref$externalLinkEnab === void 0 ? true : _ref$externalLinkEnab;
|
49
51
|
|
50
52
|
_classCallCheck(this, PDFLinkService);
|
51
53
|
|
52
54
|
this.eventBus = eventBus || (0, _ui_utils.getGlobalEventBus)();
|
53
55
|
this.externalLinkTarget = externalLinkTarget;
|
54
56
|
this.externalLinkRel = externalLinkRel;
|
57
|
+
this.externalLinkEnabled = externalLinkEnabled;
|
55
58
|
this.baseUrl = null;
|
56
59
|
this.pdfDocument = null;
|
57
60
|
this.pdfViewer = null;
|
@@ -325,13 +328,13 @@ function () {
|
|
325
328
|
return;
|
326
329
|
}
|
327
330
|
|
328
|
-
var refStr = pageRef.
|
331
|
+
var refStr = pageRef.gen === 0 ? "".concat(pageRef.num, "R") : "".concat(pageRef.num, "R").concat(pageRef.gen);
|
329
332
|
this._pagesRefCache[refStr] = pageNum;
|
330
333
|
}
|
331
334
|
}, {
|
332
335
|
key: "_cachedPageNumber",
|
333
336
|
value: function _cachedPageNumber(pageRef) {
|
334
|
-
var refStr = pageRef.
|
337
|
+
var refStr = pageRef.gen === 0 ? "".concat(pageRef.num, "R") : "".concat(pageRef.num, "R").concat(pageRef.gen);
|
335
338
|
return this._pagesRefCache && this._pagesRefCache[refStr] || null;
|
336
339
|
}
|
337
340
|
}, {
|
@@ -444,6 +447,7 @@ function () {
|
|
444
447
|
|
445
448
|
this.externalLinkTarget = null;
|
446
449
|
this.externalLinkRel = null;
|
450
|
+
this.externalLinkEnabled = true;
|
447
451
|
}
|
448
452
|
|
449
453
|
_createClass(SimpleLinkService, [{
|
@@ -81,7 +81,8 @@ function () {
|
|
81
81
|
(0, _pdf.addLinkAttributes)(element, {
|
82
82
|
url: url,
|
83
83
|
target: newWindow ? _pdf.LinkTarget.BLANK : linkService.externalLinkTarget,
|
84
|
-
rel: linkService.externalLinkRel
|
84
|
+
rel: linkService.externalLinkRel,
|
85
|
+
enabled: linkService.externalLinkEnabled
|
85
86
|
});
|
86
87
|
return;
|
87
88
|
}
|
package/lib/web/pdf_page_view.js
CHANGED
@@ -84,8 +84,6 @@ function () {
|
|
84
84
|
this.renderingState = _pdf_rendering_queue.RenderingStates.INITIAL;
|
85
85
|
this.resume = null;
|
86
86
|
this.error = null;
|
87
|
-
this.onBeforeDraw = null;
|
88
|
-
this.onAfterDraw = null;
|
89
87
|
this.annotationLayer = null;
|
90
88
|
this.textLayer = null;
|
91
89
|
this.zoomLayer = null;
|
@@ -213,7 +211,8 @@ function () {
|
|
213
211
|
this.eventBus.dispatch('pagerendered', {
|
214
212
|
source: this,
|
215
213
|
pageNumber: this.id,
|
216
|
-
cssTransform: true
|
214
|
+
cssTransform: true,
|
215
|
+
timestamp: performance.now()
|
217
216
|
});
|
218
217
|
return;
|
219
218
|
}
|
@@ -234,7 +233,8 @@ function () {
|
|
234
233
|
this.eventBus.dispatch('pagerendered', {
|
235
234
|
source: this,
|
236
235
|
pageNumber: this.id,
|
237
|
-
cssTransform: true
|
236
|
+
cssTransform: true,
|
237
|
+
timestamp: performance.now()
|
238
238
|
});
|
239
239
|
return;
|
240
240
|
}
|
@@ -447,24 +447,21 @@ function () {
|
|
447
447
|
_this.error = error;
|
448
448
|
_this.stats = pdfPage.stats;
|
449
449
|
|
450
|
-
if (_this.onAfterDraw) {
|
451
|
-
_this.onAfterDraw();
|
452
|
-
}
|
453
|
-
|
454
450
|
_this.eventBus.dispatch('pagerendered', {
|
455
451
|
source: _this,
|
456
452
|
pageNumber: _this.id,
|
457
|
-
cssTransform: false
|
453
|
+
cssTransform: false,
|
454
|
+
timestamp: performance.now()
|
458
455
|
});
|
459
456
|
|
460
457
|
if (!error) {
|
461
|
-
_context.next =
|
458
|
+
_context.next = 12;
|
462
459
|
break;
|
463
460
|
}
|
464
461
|
|
465
462
|
throw error;
|
466
463
|
|
467
|
-
case
|
464
|
+
case 12:
|
468
465
|
case "end":
|
469
466
|
return _context.stop();
|
470
467
|
}
|
@@ -503,11 +500,10 @@ function () {
|
|
503
500
|
}
|
504
501
|
|
505
502
|
div.setAttribute('data-loaded', true);
|
506
|
-
|
507
|
-
|
508
|
-
this.
|
509
|
-
}
|
510
|
-
|
503
|
+
this.eventBus.dispatch('pagerender', {
|
504
|
+
source: this,
|
505
|
+
pageNumber: this.id
|
506
|
+
});
|
511
507
|
return resultPromise;
|
512
508
|
}
|
513
509
|
}, {
|
@@ -32,8 +32,6 @@ var _app = require("./app");
|
|
32
32
|
|
33
33
|
var _app_options = require("./app_options");
|
34
34
|
|
35
|
-
var _pdf = require("../pdf");
|
36
|
-
|
37
35
|
var activeService = null;
|
38
36
|
var overlayManager = null;
|
39
37
|
|
@@ -103,6 +101,8 @@ PDFPrintService.prototype = {
|
|
103
101
|
}
|
104
102
|
|
105
103
|
this.printContainer.textContent = '';
|
104
|
+
var body = document.querySelector('body');
|
105
|
+
body.removeAttribute('data-pdfjsprinting');
|
106
106
|
|
107
107
|
if (this.pageStyleSheet) {
|
108
108
|
this.pageStyleSheet.remove();
|
@@ -152,7 +152,7 @@ PDFPrintService.prototype = {
|
|
152
152
|
|
153
153
|
if ('toBlob' in scratchCanvas && !this.disableCreateObjectURL) {
|
154
154
|
scratchCanvas.toBlob(function (blob) {
|
155
|
-
img.src =
|
155
|
+
img.src = URL.createObjectURL(blob);
|
156
156
|
});
|
157
157
|
} else {
|
158
158
|
img.src = scratchCanvas.toDataURL();
|
@@ -273,8 +273,6 @@ window.addEventListener('keydown', function (event) {
|
|
273
273
|
} else {
|
274
274
|
event.stopPropagation();
|
275
275
|
}
|
276
|
-
|
277
|
-
return;
|
278
276
|
}
|
279
277
|
}, true);
|
280
278
|
|
package/lib/web/pdf_sidebar.js
CHANGED
@@ -355,6 +355,9 @@ function () {
|
|
355
355
|
_this3.outerContainer.classList.remove('sidebarMoving');
|
356
356
|
}
|
357
357
|
});
|
358
|
+
this.toggleButton.addEventListener('click', function () {
|
359
|
+
_this3.toggle();
|
360
|
+
});
|
358
361
|
this.thumbnailButton.addEventListener('click', function () {
|
359
362
|
_this3.switchView(SidebarView.THUMBS);
|
360
363
|
});
|
@@ -143,6 +143,6 @@ var _pdf_single_page_viewer = require("./pdf_single_page_viewer");
|
|
143
143
|
|
144
144
|
var _pdf_viewer = require("./pdf_viewer.js");
|
145
145
|
|
146
|
-
var pdfjsVersion = '2.
|
147
|
-
var pdfjsBuild = '
|
146
|
+
var pdfjsVersion = '2.3.200';
|
147
|
+
var pdfjsBuild = '4ae3f9fc';
|
148
148
|
(0, _ui_utils.getGlobalEventBus)(true);
|
package/lib/web/toolbar.js
CHANGED
package/lib/web/ui_utils.js
CHANGED
@@ -62,7 +62,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
62
62
|
|
63
63
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
64
64
|
|
65
|
-
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
65
|
+
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
66
66
|
|
67
67
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
68
68
|
|