pdfjs-dist 2.4.456 → 2.5.207
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 +4447 -4379
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +1 -1
- package/build/pdf.worker.js +8549 -8507
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +1 -1
- package/es5/build/pdf.js +14755 -14540
- package/es5/build/pdf.js.map +1 -1
- package/es5/build/pdf.worker.js +9830 -9469
- package/es5/build/pdf.worker.js.map +1 -1
- package/es5/web/pdf_viewer.css +5 -9
- package/es5/web/pdf_viewer.js +157 -172
- package/es5/web/pdf_viewer.js.map +1 -1
- package/image_decoders/pdf.image_decoders.js +107 -93
- package/image_decoders/pdf.image_decoders.js.map +1 -1
- package/image_decoders/pdf.image_decoders.min.js +1 -1
- package/lib/README.md +2 -2
- package/lib/core/ccitt.js +7 -7
- package/lib/core/cff_parser.js +1 -1
- package/lib/core/chunked_stream.js +5 -5
- package/lib/core/cmap.js +13 -0
- package/lib/core/document.js +22 -18
- package/lib/core/evaluator.js +285 -247
- package/lib/core/font_renderer.js +7 -7
- package/lib/core/fonts.js +163 -147
- package/lib/core/function.js +4 -5
- package/lib/core/glyphlist.js +4523 -4523
- package/lib/core/image.js +19 -44
- package/lib/core/image_utils.js +123 -47
- package/lib/core/jpeg_stream.js +2 -116
- package/lib/core/jpg.js +47 -55
- package/lib/core/jpx.js +6 -6
- package/lib/core/metrics.js +2916 -2916
- package/lib/core/obj.js +18 -7
- package/lib/core/operator_list.js +5 -0
- package/lib/core/parser.js +1 -1
- package/lib/core/pdf_manager.js +2 -2
- package/lib/core/primitives.js +4 -0
- package/lib/core/standard_fonts.js +103 -103
- package/lib/core/type1_parser.js +6 -6
- package/lib/core/worker.js +31 -24
- package/lib/core/worker_stream.js +1 -1
- package/lib/display/annotation_layer.js +3 -0
- package/lib/display/api.js +29 -137
- package/lib/display/api_compatibility.js +11 -18
- package/lib/display/canvas.js +7 -34
- package/lib/display/content_disposition.js +4 -4
- package/lib/display/display_utils.js +6 -15
- package/lib/display/fetch_stream.js +3 -1
- package/lib/display/font_loader.js +2 -2
- package/lib/display/network.js +1 -1
- package/lib/display/node_stream.js +10 -8
- package/lib/display/pattern_helper.js +1 -1
- package/lib/display/svg.js +61 -31
- package/lib/display/text_layer.js +44 -32
- package/lib/display/transport_stream.js +3 -3
- package/lib/pdf.js +210 -48
- package/lib/pdf.worker.js +12 -4
- package/lib/shared/compatibility.js +2 -0
- package/lib/shared/is_node.js +1 -1
- package/lib/shared/message_handler.js +6 -6
- package/lib/shared/util.js +15 -9
- package/lib/test/unit/api_spec.js +165 -95
- package/lib/test/unit/cff_parser_spec.js +12 -12
- package/lib/test/unit/clitests_helper.js +1 -1
- package/lib/test/unit/display_svg_spec.js +1 -5
- package/lib/test/unit/jasmine-boot.js +2 -2
- package/lib/test/unit/node_stream_spec.js +5 -3
- package/lib/test/unit/parser_spec.js +3 -3
- package/lib/test/unit/test_utils.js +1 -1
- package/lib/test/unit/testreporter.js +4 -4
- package/lib/test/unit/ui_utils_spec.js +1 -55
- package/lib/test/unit/unicode_spec.js +1 -1
- package/lib/web/app.js +247 -159
- package/lib/web/app_options.js +16 -10
- package/lib/web/base_viewer.js +14 -6
- package/lib/web/download_manager.js +3 -1
- package/lib/web/firefox_print_service.js +1 -1
- package/lib/web/firefoxcom.js +16 -4
- package/lib/web/pdf_attachment_viewer.js +14 -7
- package/lib/web/pdf_document_properties.js +11 -16
- package/lib/web/pdf_find_bar.js +3 -3
- package/lib/web/pdf_find_controller.js +3 -3
- package/lib/web/pdf_history.js +7 -5
- package/lib/web/pdf_link_service.js +7 -8
- package/lib/web/pdf_page_view.js +1 -1
- package/lib/web/pdf_presentation_mode.js +6 -2
- package/lib/web/pdf_print_service.js +1 -1
- package/lib/web/pdf_single_page_viewer.js +2 -2
- package/lib/web/pdf_viewer.component.js +2 -2
- package/lib/web/pdf_viewer.js +2 -2
- package/lib/web/preferences.js +4 -1
- package/lib/web/text_layer_builder.js +1 -3
- package/lib/web/ui_utils.js +3 -55
- package/lib/web/view_history.js +8 -9
- package/lib/web/viewer_compatibility.js +14 -1
- package/package.json +1 -1
- package/web/pdf_viewer.css +5 -9
- package/web/pdf_viewer.js +97 -127
- package/web/pdf_viewer.js.map +1 -1
package/lib/web/app_options.js
CHANGED
@@ -26,8 +26,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
26
26
|
});
|
27
27
|
exports.OptionKind = exports.AppOptions = void 0;
|
28
28
|
|
29
|
-
var _pdf = require("../pdf");
|
30
|
-
|
31
29
|
var _viewer_compatibility = require("./viewer_compatibility.js");
|
32
30
|
|
33
31
|
const OptionKind = {
|
@@ -50,6 +48,11 @@ const defaultOptions = {
|
|
50
48
|
value: "",
|
51
49
|
kind: OptionKind.VIEWER + OptionKind.PREFERENCE
|
52
50
|
},
|
51
|
+
disableCreateObjectURL: {
|
52
|
+
value: false,
|
53
|
+
compatibility: _viewer_compatibility.viewerCompatibilityParams.disableCreateObjectURL,
|
54
|
+
kind: OptionKind.VIEWER
|
55
|
+
},
|
53
56
|
disableHistory: {
|
54
57
|
value: false,
|
55
58
|
kind: OptionKind.VIEWER
|
@@ -58,15 +61,15 @@ const defaultOptions = {
|
|
58
61
|
value: false,
|
59
62
|
kind: OptionKind.VIEWER + OptionKind.PREFERENCE
|
60
63
|
},
|
61
|
-
|
64
|
+
enablePermissions: {
|
62
65
|
value: false,
|
63
66
|
kind: OptionKind.VIEWER + OptionKind.PREFERENCE
|
64
67
|
},
|
65
|
-
|
68
|
+
enablePrintAutoRotate: {
|
66
69
|
value: false,
|
67
70
|
kind: OptionKind.VIEWER + OptionKind.PREFERENCE
|
68
71
|
},
|
69
|
-
|
72
|
+
enableWebGL: {
|
70
73
|
value: false,
|
71
74
|
kind: OptionKind.VIEWER + OptionKind.PREFERENCE
|
72
75
|
},
|
@@ -99,6 +102,10 @@ const defaultOptions = {
|
|
99
102
|
value: false,
|
100
103
|
kind: OptionKind.VIEWER + OptionKind.PREFERENCE
|
101
104
|
},
|
105
|
+
printResolution: {
|
106
|
+
value: 150,
|
107
|
+
kind: OptionKind.VIEWER
|
108
|
+
},
|
102
109
|
renderer: {
|
103
110
|
value: "canvas",
|
104
111
|
kind: OptionKind.VIEWER + OptionKind.PREFERENCE
|
@@ -143,11 +150,6 @@ const defaultOptions = {
|
|
143
150
|
value: false,
|
144
151
|
kind: OptionKind.API + OptionKind.PREFERENCE
|
145
152
|
},
|
146
|
-
disableCreateObjectURL: {
|
147
|
-
value: false,
|
148
|
-
compatibility: _pdf.apiCompatibilityParams.disableCreateObjectURL,
|
149
|
-
kind: OptionKind.API
|
150
|
-
},
|
151
153
|
disableFontFace: {
|
152
154
|
value: false,
|
153
155
|
kind: OptionKind.API + OptionKind.PREFERENCE
|
@@ -164,6 +166,10 @@ const defaultOptions = {
|
|
164
166
|
value: "",
|
165
167
|
kind: OptionKind.API
|
166
168
|
},
|
169
|
+
fontExtraProperties: {
|
170
|
+
value: false,
|
171
|
+
kind: OptionKind.API
|
172
|
+
},
|
167
173
|
isEvalSupported: {
|
168
174
|
value: true,
|
169
175
|
kind: OptionKind.API
|
package/lib/web/base_viewer.js
CHANGED
@@ -101,7 +101,7 @@ class BaseViewer {
|
|
101
101
|
this._name = this.constructor.name;
|
102
102
|
this.container = options.container;
|
103
103
|
this.viewer = options.viewer || options.container.firstElementChild;
|
104
|
-
this.eventBus = options.eventBus
|
104
|
+
this.eventBus = options.eventBus;
|
105
105
|
this.linkService = options.linkService || new _pdf_link_service.SimpleLinkService();
|
106
106
|
this.downloadManager = options.downloadManager || null;
|
107
107
|
this.findController = options.findController || null;
|
@@ -308,8 +308,16 @@ class BaseViewer {
|
|
308
308
|
return this.pdfDocument ? this._pagesCapability.promise : null;
|
309
309
|
}
|
310
310
|
|
311
|
-
get
|
312
|
-
throw new Error("Not implemented:
|
311
|
+
get _viewerElement() {
|
312
|
+
throw new Error("Not implemented: _viewerElement");
|
313
|
+
}
|
314
|
+
|
315
|
+
_onePageRenderedOrForceFetch() {
|
316
|
+
if (!this.container.offsetParent || this._getVisiblePages().views.length === 0) {
|
317
|
+
return Promise.resolve();
|
318
|
+
}
|
319
|
+
|
320
|
+
return this._onePageRenderedCapability.promise;
|
313
321
|
}
|
314
322
|
|
315
323
|
setDocument(pdfDocument) {
|
@@ -376,7 +384,7 @@ class BaseViewer {
|
|
376
384
|
|
377
385
|
for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {
|
378
386
|
const pageView = new _pdf_page_view.PDFPageView({
|
379
|
-
container: this.
|
387
|
+
container: this._viewerElement,
|
380
388
|
eventBus: this.eventBus,
|
381
389
|
id: pageNum,
|
382
390
|
scale,
|
@@ -408,12 +416,12 @@ class BaseViewer {
|
|
408
416
|
this._updateSpreadMode();
|
409
417
|
}
|
410
418
|
|
411
|
-
this.
|
419
|
+
this._onePageRenderedOrForceFetch().then(() => {
|
412
420
|
if (this.findController) {
|
413
421
|
this.findController.setDocument(pdfDocument);
|
414
422
|
}
|
415
423
|
|
416
|
-
if (pdfDocument.loadingParams
|
424
|
+
if (pdfDocument.loadingParams.disableAutoFetch || pagesCount > 7500) {
|
417
425
|
this._pagesCapability.resolve();
|
418
426
|
|
419
427
|
return;
|
@@ -28,8 +28,10 @@ exports.DownloadManager = void 0;
|
|
28
28
|
|
29
29
|
var _pdf = require("../pdf");
|
30
30
|
|
31
|
+
var _viewer_compatibility = require("./viewer_compatibility.js");
|
32
|
+
|
31
33
|
;
|
32
|
-
const DISABLE_CREATE_OBJECT_URL =
|
34
|
+
const DISABLE_CREATE_OBJECT_URL = _viewer_compatibility.viewerCompatibilityParams.disableCreateObjectURL || false;
|
33
35
|
|
34
36
|
function download(blobUrl, filename) {
|
35
37
|
const a = document.createElement("a");
|
@@ -108,7 +108,7 @@ FirefoxPrintService.prototype = {
|
|
108
108
|
_app.PDFPrintServiceFactory.instance = {
|
109
109
|
get supportsPrinting() {
|
110
110
|
const canvas = document.createElement("canvas");
|
111
|
-
const value = "mozPrintCallback" in canvas;
|
111
|
+
const value = ("mozPrintCallback" in canvas);
|
112
112
|
return (0, _pdf.shadow)(this, "supportsPrinting", value);
|
113
113
|
},
|
114
114
|
|
package/lib/web/firefoxcom.js
CHANGED
@@ -28,10 +28,10 @@ exports.FirefoxCom = exports.DownloadManager = void 0;
|
|
28
28
|
|
29
29
|
require("../extensions/firefox/tools/l10n.js");
|
30
30
|
|
31
|
-
var _pdf = require("../pdf");
|
32
|
-
|
33
31
|
var _app = require("./app.js");
|
34
32
|
|
33
|
+
var _pdf = require("../pdf");
|
34
|
+
|
35
35
|
var _preferences = require("./preferences.js");
|
36
36
|
|
37
37
|
var _ui_utils = require("./ui_utils.js");
|
@@ -99,13 +99,20 @@ class DownloadManager {
|
|
99
99
|
}
|
100
100
|
|
101
101
|
downloadData(data, filename, contentType) {
|
102
|
-
const blobUrl =
|
102
|
+
const blobUrl = URL.createObjectURL(new Blob([data], {
|
103
|
+
type: contentType
|
104
|
+
}));
|
105
|
+
|
106
|
+
const onResponse = err => {
|
107
|
+
URL.revokeObjectURL(blobUrl);
|
108
|
+
};
|
109
|
+
|
103
110
|
FirefoxCom.request("download", {
|
104
111
|
blobUrl,
|
105
112
|
originalUrl: blobUrl,
|
106
113
|
filename,
|
107
114
|
isAttachment: true
|
108
|
-
});
|
115
|
+
}, onResponse);
|
109
116
|
}
|
110
117
|
|
111
118
|
download(blob, url, filename) {
|
@@ -348,6 +355,11 @@ class FirefoxExternalServices extends _app.DefaultExternalServices {
|
|
348
355
|
return (0, _pdf.shadow)(this, "supportedMouseWheelZoomModifierKeys", support);
|
349
356
|
}
|
350
357
|
|
358
|
+
static get isInAutomation() {
|
359
|
+
const isInAutomation = FirefoxCom.requestSync("isInAutomation");
|
360
|
+
return (0, _pdf.shadow)(this, "isInAutomation", isInAutomation);
|
361
|
+
}
|
362
|
+
|
351
363
|
}
|
352
364
|
|
353
365
|
_app.PDFViewerApplication.externalServices = FirefoxExternalServices;
|
@@ -61,20 +61,27 @@ class PDFAttachmentViewer {
|
|
61
61
|
}
|
62
62
|
|
63
63
|
_bindPdfLink(button, content, filename) {
|
64
|
-
if (this.downloadManager.disableCreateObjectURL) {
|
65
|
-
throw new Error('bindPdfLink: Unsupported "disableCreateObjectURL" value.');
|
66
|
-
}
|
67
|
-
|
68
64
|
let blobUrl;
|
69
65
|
|
70
|
-
button.onclick =
|
66
|
+
button.onclick = () => {
|
71
67
|
if (!blobUrl) {
|
72
|
-
blobUrl =
|
68
|
+
blobUrl = URL.createObjectURL(new Blob([content], {
|
69
|
+
type: "application/pdf"
|
70
|
+
}));
|
73
71
|
}
|
74
72
|
|
75
73
|
let viewerUrl;
|
76
74
|
viewerUrl = "?file=" + encodeURIComponent(blobUrl + "#" + filename);
|
77
|
-
|
75
|
+
|
76
|
+
try {
|
77
|
+
window.open(viewerUrl);
|
78
|
+
} catch (ex) {
|
79
|
+
console.error(`_bindPdfLink: ${ex}`);
|
80
|
+
URL.revokeObjectURL(blobUrl);
|
81
|
+
blobUrl = null;
|
82
|
+
this.downloadManager.downloadData(content, filename, "application/pdf");
|
83
|
+
}
|
84
|
+
|
78
85
|
return false;
|
79
86
|
};
|
80
87
|
}
|
@@ -62,21 +62,16 @@ class PDFDocumentProperties {
|
|
62
62
|
|
63
63
|
this._reset();
|
64
64
|
|
65
|
-
|
66
|
-
closeButton.addEventListener("click", this.close.bind(this));
|
67
|
-
}
|
68
|
-
|
65
|
+
closeButton.addEventListener("click", this.close.bind(this));
|
69
66
|
this.overlayManager.register(this.overlayName, this.container, this.close.bind(this));
|
70
67
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
});
|
68
|
+
eventBus._on("pagechanging", evt => {
|
69
|
+
this._currentPageNumber = evt.pageNumber;
|
70
|
+
});
|
75
71
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
}
|
72
|
+
eventBus._on("rotationchanging", evt => {
|
73
|
+
this._pagesRotation = evt.pagesRotation;
|
74
|
+
});
|
80
75
|
|
81
76
|
this._isNonMetricLocale = true;
|
82
77
|
l10n.getLanguage().then(locale => {
|
@@ -98,7 +93,7 @@ class PDFDocumentProperties {
|
|
98
93
|
const currentPageNumber = this._currentPageNumber;
|
99
94
|
const pagesRotation = this._pagesRotation;
|
100
95
|
|
101
|
-
if (this.fieldData && currentPageNumber === this.fieldData
|
96
|
+
if (this.fieldData && currentPageNumber === this.fieldData._currentPageNumber && pagesRotation === this.fieldData._pagesRotation) {
|
102
97
|
this._updateUI();
|
103
98
|
|
104
99
|
return;
|
@@ -109,7 +104,7 @@ class PDFDocumentProperties {
|
|
109
104
|
metadata,
|
110
105
|
contentDispositionFilename
|
111
106
|
}) => {
|
112
|
-
return Promise.all([info, metadata, contentDispositionFilename || (0, _ui_utils.getPDFFileNameFromURL)(this.url
|
107
|
+
return Promise.all([info, metadata, contentDispositionFilename || (0, _ui_utils.getPDFFileNameFromURL)(this.url), this._parseFileSize(this.maybeFileSize), this._parseDate(info.CreationDate), this._parseDate(info.ModDate), this.pdfDocument.getPage(currentPageNumber).then(pdfPage => {
|
113
108
|
return this._parsePageSize((0, _ui_utils.getPageSizeInches)(pdfPage), pagesRotation);
|
114
109
|
}), this._parseLinearization(info.IsLinearized)]);
|
115
110
|
}).then(([info, metadata, fileName, fileSize, creationDate, modDate, pageSize, isLinearized]) => {
|
@@ -141,12 +136,12 @@ class PDFDocumentProperties {
|
|
141
136
|
this.maybeFileSize = length;
|
142
137
|
return this._parseFileSize(length);
|
143
138
|
}).then(fileSize => {
|
144
|
-
if (fileSize === this.fieldData
|
139
|
+
if (fileSize === this.fieldData.fileSize) {
|
145
140
|
return;
|
146
141
|
}
|
147
142
|
|
148
143
|
const data = Object.assign(Object.create(null), this.fieldData);
|
149
|
-
data
|
144
|
+
data.fileSize = fileSize;
|
150
145
|
freezeFieldData(data);
|
151
146
|
|
152
147
|
this._updateUI();
|
package/lib/web/pdf_find_bar.js
CHANGED
@@ -26,10 +26,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
26
26
|
});
|
27
27
|
exports.PDFFindBar = void 0;
|
28
28
|
|
29
|
-
var _ui_utils = require("./ui_utils.js");
|
30
|
-
|
31
29
|
var _pdf_find_controller = require("./pdf_find_controller.js");
|
32
30
|
|
31
|
+
var _ui_utils = require("./ui_utils.js");
|
32
|
+
|
33
33
|
const MATCHES_COUNT_LIMIT = 1000;
|
34
34
|
|
35
35
|
class PDFFindBar {
|
@@ -45,7 +45,7 @@ class PDFFindBar {
|
|
45
45
|
this.findResultsCount = options.findResultsCount || null;
|
46
46
|
this.findPreviousButton = options.findPreviousButton || null;
|
47
47
|
this.findNextButton = options.findNextButton || null;
|
48
|
-
this.eventBus = eventBus
|
48
|
+
this.eventBus = eventBus;
|
49
49
|
this.l10n = l10n;
|
50
50
|
this.toggleButton.addEventListener("click", () => {
|
51
51
|
this.toggle();
|
@@ -26,12 +26,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
26
26
|
});
|
27
27
|
exports.PDFFindController = exports.FindState = void 0;
|
28
28
|
|
29
|
-
var _ui_utils = require("./ui_utils.js");
|
30
|
-
|
31
29
|
var _pdf = require("../pdf");
|
32
30
|
|
33
31
|
var _pdf_find_utils = require("./pdf_find_utils.js");
|
34
32
|
|
33
|
+
var _ui_utils = require("./ui_utils.js");
|
34
|
+
|
35
35
|
const FindState = {
|
36
36
|
FOUND: 0,
|
37
37
|
NOT_FOUND: 1,
|
@@ -74,7 +74,7 @@ class PDFFindController {
|
|
74
74
|
eventBus
|
75
75
|
}) {
|
76
76
|
this._linkService = linkService;
|
77
|
-
this._eventBus = eventBus
|
77
|
+
this._eventBus = eventBus;
|
78
78
|
|
79
79
|
this._reset();
|
80
80
|
|
package/lib/web/pdf_history.js
CHANGED
@@ -44,7 +44,7 @@ class PDFHistory {
|
|
44
44
|
eventBus
|
45
45
|
}) {
|
46
46
|
this.linkService = linkService;
|
47
|
-
this.eventBus = eventBus
|
47
|
+
this.eventBus = eventBus;
|
48
48
|
this._initialized = false;
|
49
49
|
this._fingerprint = "";
|
50
50
|
this.reset();
|
@@ -103,7 +103,7 @@ class PDFHistory {
|
|
103
103
|
hash,
|
104
104
|
page,
|
105
105
|
rotation
|
106
|
-
} = this._parseCurrentHash();
|
106
|
+
} = this._parseCurrentHash(true);
|
107
107
|
|
108
108
|
if (!hash || reInitialized || resetHistory) {
|
109
109
|
this._pushOrReplaceState(null, true);
|
@@ -381,11 +381,13 @@ class PDFHistory {
|
|
381
381
|
this._numPositionUpdates = 0;
|
382
382
|
}
|
383
383
|
|
384
|
-
_parseCurrentHash() {
|
384
|
+
_parseCurrentHash(checkNameddest = false) {
|
385
385
|
const hash = unescape(getCurrentHash()).substring(1);
|
386
|
-
|
386
|
+
const params = (0, _ui_utils.parseQueryString)(hash);
|
387
|
+
const nameddest = params.nameddest || "";
|
388
|
+
let page = params.page | 0;
|
387
389
|
|
388
|
-
if (!(Number.isInteger(page) && page > 0 && page <= this.linkService.pagesCount)) {
|
390
|
+
if (!(Number.isInteger(page) && page > 0 && page <= this.linkService.pagesCount) || checkNameddest && nameddest.length > 0) {
|
389
391
|
page = null;
|
390
392
|
}
|
391
393
|
|
@@ -36,7 +36,7 @@ class PDFLinkService {
|
|
36
36
|
externalLinkEnabled = true,
|
37
37
|
ignoreDestinationZoom = false
|
38
38
|
} = {}) {
|
39
|
-
this.eventBus = eventBus
|
39
|
+
this.eventBus = eventBus;
|
40
40
|
this.externalLinkTarget = externalLinkTarget;
|
41
41
|
this.externalLinkRel = externalLinkRel;
|
42
42
|
this.externalLinkEnabled = externalLinkEnabled;
|
@@ -184,16 +184,11 @@ class PDFLinkService {
|
|
184
184
|
if ("search" in params) {
|
185
185
|
this.eventBus.dispatch("findfromurlhash", {
|
186
186
|
source: this,
|
187
|
-
query: params
|
188
|
-
phraseSearch: params
|
187
|
+
query: params.search.replace(/"/g, ""),
|
188
|
+
phraseSearch: params.phrase === "true"
|
189
189
|
});
|
190
190
|
}
|
191
191
|
|
192
|
-
if ("nameddest" in params) {
|
193
|
-
this.navigateTo(params.nameddest);
|
194
|
-
return;
|
195
|
-
}
|
196
|
-
|
197
192
|
if ("page" in params) {
|
198
193
|
pageNumber = params.page | 0 || 1;
|
199
194
|
}
|
@@ -246,6 +241,10 @@ class PDFLinkService {
|
|
246
241
|
mode: params.pagemode
|
247
242
|
});
|
248
243
|
}
|
244
|
+
|
245
|
+
if ("nameddest" in params) {
|
246
|
+
this.navigateTo(params.nameddest);
|
247
|
+
}
|
249
248
|
} else {
|
250
249
|
dest = unescape(hash);
|
251
250
|
|
package/lib/web/pdf_page_view.js
CHANGED
@@ -54,7 +54,7 @@ class PDFPageView {
|
|
54
54
|
this.renderInteractiveForms = options.renderInteractiveForms || false;
|
55
55
|
this.useOnlyCssZoom = options.useOnlyCssZoom || false;
|
56
56
|
this.maxCanvasPixels = options.maxCanvasPixels || MAX_CANVAS_PIXELS;
|
57
|
-
this.eventBus = options.eventBus
|
57
|
+
this.eventBus = options.eventBus;
|
58
58
|
this.renderingQueue = options.renderingQueue;
|
59
59
|
this.textLayerFactory = options.textLayerFactory;
|
60
60
|
this.annotationLayerFactory = options.annotationLayerFactory;
|
@@ -366,7 +366,9 @@ class PDFPresentationMode {
|
|
366
366
|
this.touchSwipeBind = this._touchSwipe.bind(this);
|
367
367
|
window.addEventListener("mousemove", this.showControlsBind);
|
368
368
|
window.addEventListener("mousedown", this.mouseDownBind);
|
369
|
-
window.addEventListener("wheel", this.mouseWheelBind
|
369
|
+
window.addEventListener("wheel", this.mouseWheelBind, {
|
370
|
+
passive: false
|
371
|
+
});
|
370
372
|
window.addEventListener("keydown", this.resetMouseScrollStateBind);
|
371
373
|
window.addEventListener("contextmenu", this.contextMenuBind);
|
372
374
|
window.addEventListener("touchstart", this.touchSwipeBind);
|
@@ -377,7 +379,9 @@ class PDFPresentationMode {
|
|
377
379
|
_removeWindowListeners() {
|
378
380
|
window.removeEventListener("mousemove", this.showControlsBind);
|
379
381
|
window.removeEventListener("mousedown", this.mouseDownBind);
|
380
|
-
window.removeEventListener("wheel", this.mouseWheelBind
|
382
|
+
window.removeEventListener("wheel", this.mouseWheelBind, {
|
383
|
+
passive: false
|
384
|
+
});
|
381
385
|
window.removeEventListener("keydown", this.resetMouseScrollStateBind);
|
382
386
|
window.removeEventListener("contextmenu", this.contextMenuBind);
|
383
387
|
window.removeEventListener("touchstart", this.touchSwipeBind);
|
@@ -72,7 +72,7 @@ function PDFPrintService(pdfDocument, pagesOverview, printContainer, l10n) {
|
|
72
72
|
this.pagesOverview = pagesOverview;
|
73
73
|
this.printContainer = printContainer;
|
74
74
|
this.l10n = l10n || _ui_utils.NullL10n;
|
75
|
-
this.disableCreateObjectURL =
|
75
|
+
this.disableCreateObjectURL = _app_options.AppOptions.get("disableCreateObjectURL");
|
76
76
|
this.currentPage = -1;
|
77
77
|
this.scratchCanvas = document.createElement("canvas");
|
78
78
|
}
|
@@ -39,8 +39,8 @@ class PDFSinglePageViewer extends _base_viewer.BaseViewer {
|
|
39
39
|
});
|
40
40
|
}
|
41
41
|
|
42
|
-
get
|
43
|
-
return (0, _pdf.shadow)(this, "
|
42
|
+
get _viewerElement() {
|
43
|
+
return (0, _pdf.shadow)(this, "_viewerElement", this._shadowViewer);
|
44
44
|
}
|
45
45
|
|
46
46
|
_resetView() {
|
@@ -143,5 +143,5 @@ var _pdf_single_page_viewer = require("./pdf_single_page_viewer.js");
|
|
143
143
|
|
144
144
|
var _pdf_viewer = require("./pdf_viewer.js");
|
145
145
|
|
146
|
-
const pdfjsVersion = '2.
|
147
|
-
const pdfjsBuild = '
|
146
|
+
const pdfjsVersion = '2.5.207';
|
147
|
+
const pdfjsBuild = '0974d605';
|
package/lib/web/pdf_viewer.js
CHANGED
@@ -31,8 +31,8 @@ var _base_viewer = require("./base_viewer.js");
|
|
31
31
|
var _pdf = require("../pdf");
|
32
32
|
|
33
33
|
class PDFViewer extends _base_viewer.BaseViewer {
|
34
|
-
get
|
35
|
-
return (0, _pdf.shadow)(this, "
|
34
|
+
get _viewerElement() {
|
35
|
+
return (0, _pdf.shadow)(this, "_viewerElement", this.viewer);
|
36
36
|
}
|
37
37
|
|
38
38
|
_scrollIntoView({
|
package/lib/web/preferences.js
CHANGED
@@ -25,6 +25,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
25
25
|
value: true
|
26
26
|
});
|
27
27
|
exports.BasePreferences = void 0;
|
28
|
+
|
29
|
+
var _app_options = require("./app_options.js");
|
30
|
+
|
28
31
|
let defaultPreferences = null;
|
29
32
|
|
30
33
|
function getDefaultPreferences() {
|
@@ -33,9 +36,9 @@ function getDefaultPreferences() {
|
|
33
36
|
"cursorToolOnLoad": 0,
|
34
37
|
"defaultZoomValue": "",
|
35
38
|
"disablePageLabels": false,
|
39
|
+
"enablePermissions": false,
|
36
40
|
"enablePrintAutoRotate": false,
|
37
41
|
"enableWebGL": false,
|
38
|
-
"eventBusDispatchToDOM": false,
|
39
42
|
"externalLinkTarget": 0,
|
40
43
|
"historyUpdateUrl": false,
|
41
44
|
"ignoreDestinationZoom": false,
|
@@ -26,8 +26,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
26
26
|
});
|
27
27
|
exports.DefaultTextLayerFactory = exports.TextLayerBuilder = void 0;
|
28
28
|
|
29
|
-
var _ui_utils = require("./ui_utils.js");
|
30
|
-
|
31
29
|
var _pdf = require("../pdf");
|
32
30
|
|
33
31
|
const EXPAND_DIVS_TIMEOUT = 300;
|
@@ -42,7 +40,7 @@ class TextLayerBuilder {
|
|
42
40
|
enhanceTextSelection = false
|
43
41
|
}) {
|
44
42
|
this.textLayerDiv = textLayerDiv;
|
45
|
-
this.eventBus = eventBus
|
43
|
+
this.eventBus = eventBus;
|
46
44
|
this.textContent = null;
|
47
45
|
this.textContentItemsStr = [];
|
48
46
|
this.textContentStream = null;
|
package/lib/web/ui_utils.js
CHANGED
@@ -28,7 +28,6 @@ exports.isValidRotation = isValidRotation;
|
|
28
28
|
exports.isValidScrollMode = isValidScrollMode;
|
29
29
|
exports.isValidSpreadMode = isValidSpreadMode;
|
30
30
|
exports.isPortraitOrientation = isPortraitOrientation;
|
31
|
-
exports.getGlobalEventBus = getGlobalEventBus;
|
32
31
|
exports.clamp = clamp;
|
33
32
|
exports.getPDFFileNameFromURL = getPDFFileNameFromURL;
|
34
33
|
exports.noContextMenuHandler = noContextMenuHandler;
|
@@ -236,7 +235,7 @@ function binarySearchFirstItem(items, condition) {
|
|
236
235
|
let minIndex = 0;
|
237
236
|
let maxIndex = items.length - 1;
|
238
237
|
|
239
|
-
if (
|
238
|
+
if (maxIndex < 0 || !condition(items[maxIndex])) {
|
240
239
|
return items.length;
|
241
240
|
}
|
242
241
|
|
@@ -566,41 +565,12 @@ const animationStarted = new Promise(function (resolve) {
|
|
566
565
|
exports.animationStarted = animationStarted;
|
567
566
|
|
568
567
|
function dispatchDOMEvent(eventName, args = null) {
|
569
|
-
|
570
|
-
|
571
|
-
if (args && args.length > 0) {
|
572
|
-
const obj = args[0];
|
573
|
-
|
574
|
-
for (const key in obj) {
|
575
|
-
const value = obj[key];
|
576
|
-
|
577
|
-
if (key === "source") {
|
578
|
-
if (value === window || value === document) {
|
579
|
-
return;
|
580
|
-
}
|
581
|
-
|
582
|
-
continue;
|
583
|
-
}
|
584
|
-
|
585
|
-
details[key] = value;
|
586
|
-
}
|
587
|
-
}
|
588
|
-
|
589
|
-
const event = document.createEvent("CustomEvent");
|
590
|
-
event.initCustomEvent(eventName, true, true, details);
|
591
|
-
document.dispatchEvent(event);
|
568
|
+
throw new Error("Not implemented: dispatchDOMEvent");
|
592
569
|
}
|
593
570
|
|
594
571
|
class EventBus {
|
595
|
-
constructor({
|
596
|
-
dispatchToDOM = false
|
597
|
-
} = {}) {
|
572
|
+
constructor(options) {
|
598
573
|
this._listeners = Object.create(null);
|
599
|
-
this._dispatchToDOM = dispatchToDOM === true;
|
600
|
-
|
601
|
-
if (dispatchToDOM) {
|
602
|
-
console.error("The `eventBusDispatchToDOM` option/preference is deprecated, " + "add event listeners to the EventBus instance rather than the DOM.");
|
603
|
-
}
|
604
574
|
}
|
605
575
|
|
606
576
|
on(eventName, listener) {
|
@@ -619,11 +589,6 @@ class EventBus {
|
|
619
589
|
const eventListeners = this._listeners[eventName];
|
620
590
|
|
621
591
|
if (!eventListeners || eventListeners.length === 0) {
|
622
|
-
if (this._dispatchToDOM) {
|
623
|
-
const args = Array.prototype.slice.call(arguments, 1);
|
624
|
-
dispatchDOMEvent(eventName, args);
|
625
|
-
}
|
626
|
-
|
627
592
|
return;
|
628
593
|
}
|
629
594
|
|
@@ -651,10 +616,6 @@ class EventBus {
|
|
651
616
|
});
|
652
617
|
externalListeners = null;
|
653
618
|
}
|
654
|
-
|
655
|
-
if (this._dispatchToDOM) {
|
656
|
-
dispatchDOMEvent(eventName, args);
|
657
|
-
}
|
658
619
|
}
|
659
620
|
|
660
621
|
_on(eventName, listener, options = null) {
|
@@ -688,19 +649,6 @@ class EventBus {
|
|
688
649
|
}
|
689
650
|
|
690
651
|
exports.EventBus = EventBus;
|
691
|
-
let globalEventBus = null;
|
692
|
-
|
693
|
-
function getGlobalEventBus(dispatchToDOM = false) {
|
694
|
-
console.error("getGlobalEventBus is deprecated, use a manually created EventBus instance instead.");
|
695
|
-
|
696
|
-
if (!globalEventBus) {
|
697
|
-
globalEventBus = new EventBus({
|
698
|
-
dispatchToDOM
|
699
|
-
});
|
700
|
-
}
|
701
|
-
|
702
|
-
return globalEventBus;
|
703
|
-
}
|
704
652
|
|
705
653
|
function clamp(v, min, max) {
|
706
654
|
return Math.min(Math.max(v, min), max);
|
package/lib/web/view_history.js
CHANGED
@@ -33,23 +33,22 @@ class ViewHistory {
|
|
33
33
|
this.cacheSize = cacheSize;
|
34
34
|
this._initializedPromise = this._readFromStorage().then(databaseStr => {
|
35
35
|
const database = JSON.parse(databaseStr || "{}");
|
36
|
+
let index = -1;
|
36
37
|
|
37
|
-
if (!(
|
38
|
+
if (!Array.isArray(database.files)) {
|
38
39
|
database.files = [];
|
39
40
|
} else {
|
40
41
|
while (database.files.length >= this.cacheSize) {
|
41
42
|
database.files.shift();
|
42
43
|
}
|
43
|
-
}
|
44
|
-
|
45
|
-
let index = -1;
|
46
44
|
|
47
|
-
|
48
|
-
|
45
|
+
for (let i = 0, ii = database.files.length; i < ii; i++) {
|
46
|
+
const branch = database.files[i];
|
49
47
|
|
50
|
-
|
51
|
-
|
52
|
-
|
48
|
+
if (branch.fingerprint === this.fingerprint) {
|
49
|
+
index = i;
|
50
|
+
break;
|
51
|
+
}
|
53
52
|
}
|
54
53
|
}
|
55
54
|
|