pdfjs-dist 2.0.550 → 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/CODE_OF_CONDUCT.md +15 -0
- package/bower.json +1 -1
- package/build/pdf.js +21618 -14369
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +1 -1
- package/build/pdf.worker.js +22758 -11399
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +1 -1
- package/image_decoders/pdf.image_decoders.js +11500 -0
- package/image_decoders/pdf.image_decoders.js.map +1 -0
- package/image_decoders/pdf.image_decoders.min.js +1 -0
- package/lib/core/annotation.js +767 -258
- package/lib/core/arithmetic_decoder.js +275 -245
- package/lib/core/bidi.js +65 -6
- package/lib/core/ccitt.js +173 -18
- package/lib/core/ccitt_stream.js +15 -6
- package/lib/core/cff_parser.js +433 -61
- package/lib/core/charsets.js +5 -4
- package/lib/core/chunked_stream.js +428 -157
- package/lib/core/cmap.js +326 -87
- package/lib/core/colorspace.js +874 -594
- package/lib/core/core_utils.js +173 -0
- package/lib/core/crypto.js +290 -45
- package/lib/core/document.js +575 -272
- package/lib/core/encodings.js +19 -10
- package/lib/core/evaluator.js +1032 -351
- package/lib/core/font_renderer.js +331 -97
- package/lib/core/fonts.js +813 -196
- package/lib/core/function.js +253 -27
- package/lib/core/glyphlist.js +5 -3
- package/lib/core/image.js +169 -62
- package/lib/core/image_utils.js +111 -0
- package/lib/core/jbig2.js +502 -72
- package/lib/core/jbig2_stream.js +19 -8
- package/lib/core/jpeg_stream.js +38 -13
- package/lib/core/jpg.js +293 -52
- package/lib/core/jpx.js +419 -12
- package/lib/core/jpx_stream.js +18 -6
- package/lib/core/metrics.js +15 -15
- package/lib/core/murmurhash3.js +56 -34
- package/lib/core/obj.js +1368 -500
- package/lib/core/operator_list.js +159 -43
- package/lib/core/parser.js +544 -199
- package/lib/core/pattern.js +170 -21
- package/lib/core/pdf_manager.js +324 -134
- package/lib/core/primitives.js +169 -61
- package/lib/core/ps_parser.js +134 -45
- package/lib/core/standard_fonts.js +17 -17
- package/lib/core/stream.js +327 -34
- package/lib/core/type1_parser.js +148 -8
- package/lib/core/unicode.js +32 -5
- package/lib/core/worker.js +215 -229
- package/lib/core/worker_stream.js +277 -0
- package/lib/display/annotation_layer.js +618 -192
- package/lib/display/api.js +1798 -882
- package/lib/display/api_compatibility.js +5 -10
- package/lib/display/canvas.js +366 -45
- package/lib/display/content_disposition.js +71 -24
- package/lib/display/display_utils.js +777 -0
- package/lib/display/fetch_stream.js +205 -87
- package/lib/display/font_loader.js +468 -236
- package/lib/display/metadata.js +38 -16
- package/lib/display/network.js +635 -428
- package/lib/display/network_utils.js +38 -19
- package/lib/display/node_stream.js +367 -175
- package/lib/display/pattern_helper.js +103 -36
- package/lib/display/svg.js +1232 -519
- package/lib/display/text_layer.js +208 -75
- package/lib/display/transport_stream.js +345 -94
- package/lib/display/webgl.js +64 -18
- package/lib/display/worker_options.js +5 -4
- package/lib/display/xml_parser.js +166 -53
- package/lib/examples/node/domstubs.js +60 -4
- package/lib/pdf.js +35 -14
- package/lib/pdf.worker.js +5 -3
- package/lib/shared/compatibility.js +170 -572
- package/lib/shared/global_scope.js +2 -2
- package/lib/shared/is_node.js +4 -4
- package/lib/shared/message_handler.js +216 -163
- package/lib/shared/streams_polyfill.js +21 -17
- package/lib/shared/util.js +495 -385
- package/lib/test/unit/annotation_spec.js +1464 -401
- package/lib/test/unit/api_spec.js +718 -361
- package/lib/test/unit/bidi_spec.js +7 -7
- package/lib/test/unit/cff_parser_spec.js +54 -11
- package/lib/test/unit/clitests_helper.js +9 -10
- package/lib/test/unit/cmap_spec.js +95 -41
- package/lib/test/unit/colorspace_spec.js +115 -63
- package/lib/test/unit/core_utils_spec.js +191 -0
- package/lib/test/unit/crypto_spec.js +17 -5
- package/lib/test/unit/custom_spec.js +43 -55
- package/lib/test/unit/display_svg_spec.js +34 -18
- package/lib/test/unit/display_utils_spec.js +273 -0
- package/lib/test/unit/document_spec.js +8 -13
- package/lib/test/unit/encodings_spec.js +25 -45
- package/lib/test/unit/evaluator_spec.js +59 -20
- package/lib/test/unit/fetch_stream_spec.js +111 -0
- package/lib/test/unit/function_spec.js +17 -5
- package/lib/test/unit/jasmine-boot.js +33 -20
- package/lib/test/unit/message_handler_spec.js +30 -13
- package/lib/test/unit/metadata_spec.js +71 -11
- package/lib/test/unit/murmurhash3_spec.js +3 -3
- package/lib/test/unit/network_spec.js +22 -55
- package/lib/test/unit/network_utils_spec.js +105 -14
- package/lib/test/unit/node_stream_spec.js +58 -34
- package/lib/test/unit/parser_spec.js +162 -71
- package/lib/test/unit/pdf_find_controller_spec.js +230 -0
- package/lib/test/unit/pdf_find_utils_spec.js +63 -0
- package/lib/test/unit/pdf_history_spec.js +21 -9
- package/lib/test/unit/primitives_spec.js +55 -22
- package/lib/test/unit/stream_spec.js +12 -4
- package/lib/test/unit/test_utils.js +273 -56
- package/lib/test/unit/testreporter.js +21 -3
- package/lib/test/unit/type1_parser_spec.js +9 -7
- package/lib/test/unit/ui_utils_spec.js +236 -36
- package/lib/test/unit/unicode_spec.js +18 -15
- package/lib/test/unit/util_spec.js +87 -128
- package/lib/web/annotation_layer_builder.js +39 -22
- package/lib/web/app.js +1252 -609
- package/lib/web/app_options.js +103 -65
- package/lib/web/base_viewer.js +522 -242
- package/lib/web/chromecom.js +259 -117
- package/lib/web/debugger.js +166 -22
- package/lib/web/download_manager.js +31 -12
- package/lib/web/firefox_print_service.js +27 -14
- package/lib/web/firefoxcom.js +318 -78
- package/lib/web/genericcom.js +89 -30
- package/lib/web/genericl10n.js +142 -30
- package/lib/web/grab_to_pan.js +28 -4
- package/lib/web/interfaces.js +174 -47
- package/lib/web/overlay_manager.js +235 -85
- package/lib/web/password_prompt.js +22 -14
- package/lib/web/pdf_attachment_viewer.js +38 -18
- package/lib/web/pdf_cursor_tools.js +39 -16
- package/lib/web/pdf_document_properties.js +255 -136
- package/lib/web/pdf_find_bar.js +84 -40
- package/lib/web/pdf_find_controller.js +495 -184
- package/lib/web/pdf_find_utils.js +111 -0
- package/lib/web/pdf_history.js +190 -53
- package/lib/web/pdf_link_service.js +144 -79
- package/lib/web/pdf_outline_viewer.js +124 -47
- package/lib/web/pdf_page_view.js +194 -74
- package/lib/web/pdf_presentation_mode.js +99 -34
- package/lib/web/pdf_print_service.js +59 -13
- package/lib/web/pdf_rendering_queue.js +28 -9
- package/lib/web/pdf_sidebar.js +144 -81
- package/lib/web/pdf_sidebar_resizer.js +42 -16
- package/lib/web/pdf_single_page_viewer.js +74 -66
- package/lib/web/pdf_thumbnail_view.js +104 -33
- package/lib/web/pdf_thumbnail_viewer.js +66 -26
- package/lib/web/pdf_viewer.component.js +112 -32
- package/lib/web/pdf_viewer.js +82 -87
- package/lib/web/preferences.js +284 -91
- package/lib/web/secondary_toolbar.js +132 -59
- package/lib/web/text_layer_builder.js +134 -59
- package/lib/web/toolbar.js +80 -43
- package/lib/web/ui_utils.js +400 -134
- package/lib/web/view_history.js +215 -67
- package/lib/web/viewer_compatibility.js +3 -8
- package/package.json +3 -2
- package/web/pdf_viewer.css +23 -15
- package/web/pdf_viewer.js +3429 -1245
- package/web/pdf_viewer.js.map +1 -1
- package/external/streams/streams-lib.js +0 -3962
- package/lib/display/dom_utils.js +0 -429
- package/lib/test/unit/dom_utils_spec.js +0 -89
- package/lib/test/unit/fonts_spec.js +0 -81
- package/lib/web/dom_events.js +0 -137
@@ -2,7 +2,7 @@
|
|
2
2
|
* @licstart The following is the entire license notice for the
|
3
3
|
* Javascript code in this page
|
4
4
|
*
|
5
|
-
* Copyright
|
5
|
+
* Copyright 2019 Mozilla Foundation
|
6
6
|
*
|
7
7
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
8
|
* you may not use this file except in compliance with the License.
|
@@ -19,37 +19,42 @@
|
|
19
19
|
* @licend The above is the entire license notice for the
|
20
20
|
* Javascript code in this page
|
21
21
|
*/
|
22
|
-
|
22
|
+
"use strict";
|
23
23
|
|
24
24
|
Object.defineProperty(exports, "__esModule", {
|
25
25
|
value: true
|
26
26
|
});
|
27
|
-
exports.SimpleLinkService = exports.PDFLinkService =
|
27
|
+
exports.SimpleLinkService = exports.PDFLinkService = void 0;
|
28
28
|
|
29
|
-
var
|
29
|
+
var _ui_utils = require("./ui_utils");
|
30
30
|
|
31
|
-
|
31
|
+
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); }
|
32
32
|
|
33
|
-
|
33
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
34
34
|
|
35
|
-
var
|
35
|
+
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); } }
|
36
36
|
|
37
|
-
function
|
37
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
38
38
|
|
39
|
-
var PDFLinkService =
|
39
|
+
var PDFLinkService =
|
40
|
+
/*#__PURE__*/
|
41
|
+
function () {
|
40
42
|
function PDFLinkService() {
|
41
43
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
42
44
|
eventBus = _ref.eventBus,
|
43
45
|
_ref$externalLinkTarg = _ref.externalLinkTarget,
|
44
|
-
externalLinkTarget = _ref$externalLinkTarg ===
|
46
|
+
externalLinkTarget = _ref$externalLinkTarg === void 0 ? null : _ref$externalLinkTarg,
|
45
47
|
_ref$externalLinkRel = _ref.externalLinkRel,
|
46
|
-
externalLinkRel = _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;
|
47
51
|
|
48
52
|
_classCallCheck(this, PDFLinkService);
|
49
53
|
|
50
|
-
this.eventBus = eventBus || (0,
|
54
|
+
this.eventBus = eventBus || (0, _ui_utils.getGlobalEventBus)();
|
51
55
|
this.externalLinkTarget = externalLinkTarget;
|
52
56
|
this.externalLinkRel = externalLinkRel;
|
57
|
+
this.externalLinkEnabled = externalLinkEnabled;
|
53
58
|
this.baseUrl = null;
|
54
59
|
this.pdfDocument = null;
|
55
60
|
this.pdfViewer = null;
|
@@ -58,70 +63,79 @@ var PDFLinkService = function () {
|
|
58
63
|
}
|
59
64
|
|
60
65
|
_createClass(PDFLinkService, [{
|
61
|
-
key:
|
62
|
-
value: function setDocument(pdfDocument
|
66
|
+
key: "setDocument",
|
67
|
+
value: function setDocument(pdfDocument) {
|
68
|
+
var baseUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
63
69
|
this.baseUrl = baseUrl;
|
64
70
|
this.pdfDocument = pdfDocument;
|
65
71
|
this._pagesRefCache = Object.create(null);
|
66
72
|
}
|
67
73
|
}, {
|
68
|
-
key:
|
74
|
+
key: "setViewer",
|
69
75
|
value: function setViewer(pdfViewer) {
|
70
76
|
this.pdfViewer = pdfViewer;
|
71
77
|
}
|
72
78
|
}, {
|
73
|
-
key:
|
79
|
+
key: "setHistory",
|
74
80
|
value: function setHistory(pdfHistory) {
|
75
81
|
this.pdfHistory = pdfHistory;
|
76
82
|
}
|
77
83
|
}, {
|
78
|
-
key:
|
84
|
+
key: "navigateTo",
|
79
85
|
value: function navigateTo(dest) {
|
80
86
|
var _this = this;
|
81
87
|
|
82
88
|
var goToDestination = function goToDestination(_ref2) {
|
83
89
|
var namedDest = _ref2.namedDest,
|
84
90
|
explicitDest = _ref2.explicitDest;
|
85
|
-
|
86
91
|
var destRef = explicitDest[0],
|
87
|
-
pageNumber
|
92
|
+
pageNumber;
|
93
|
+
|
88
94
|
if (destRef instanceof Object) {
|
89
95
|
pageNumber = _this._cachedPageNumber(destRef);
|
96
|
+
|
90
97
|
if (pageNumber === null) {
|
91
98
|
_this.pdfDocument.getPageIndex(destRef).then(function (pageIndex) {
|
92
99
|
_this.cachePageRef(pageIndex + 1, destRef);
|
100
|
+
|
93
101
|
goToDestination({
|
94
102
|
namedDest: namedDest,
|
95
103
|
explicitDest: explicitDest
|
96
104
|
});
|
97
|
-
})
|
98
|
-
console.error(
|
105
|
+
})["catch"](function () {
|
106
|
+
console.error("PDFLinkService.navigateTo: \"".concat(destRef, "\" is not ") + "a valid page reference, for dest=\"".concat(dest, "\"."));
|
99
107
|
});
|
108
|
+
|
100
109
|
return;
|
101
110
|
}
|
102
111
|
} else if (Number.isInteger(destRef)) {
|
103
112
|
pageNumber = destRef + 1;
|
104
113
|
} else {
|
105
|
-
console.error(
|
114
|
+
console.error("PDFLinkService.navigateTo: \"".concat(destRef, "\" is not ") + "a valid destination reference, for dest=\"".concat(dest, "\"."));
|
106
115
|
return;
|
107
116
|
}
|
117
|
+
|
108
118
|
if (!pageNumber || pageNumber < 1 || pageNumber > _this.pagesCount) {
|
109
|
-
console.error(
|
119
|
+
console.error("PDFLinkService.navigateTo: \"".concat(pageNumber, "\" is not ") + "a valid page number, for dest=\"".concat(dest, "\"."));
|
110
120
|
return;
|
111
121
|
}
|
122
|
+
|
112
123
|
if (_this.pdfHistory) {
|
113
124
|
_this.pdfHistory.pushCurrentPosition();
|
125
|
+
|
114
126
|
_this.pdfHistory.push({
|
115
127
|
namedDest: namedDest,
|
116
128
|
explicitDest: explicitDest,
|
117
129
|
pageNumber: pageNumber
|
118
130
|
});
|
119
131
|
}
|
132
|
+
|
120
133
|
_this.pdfViewer.scrollPageIntoView({
|
121
134
|
pageNumber: pageNumber,
|
122
135
|
destArray: explicitDest
|
123
136
|
});
|
124
137
|
};
|
138
|
+
|
125
139
|
new Promise(function (resolve, reject) {
|
126
140
|
if (typeof dest === 'string') {
|
127
141
|
_this.pdfDocument.getDestination(dest).then(function (destArray) {
|
@@ -130,44 +144,50 @@ var PDFLinkService = function () {
|
|
130
144
|
explicitDest: destArray
|
131
145
|
});
|
132
146
|
});
|
147
|
+
|
133
148
|
return;
|
134
149
|
}
|
150
|
+
|
135
151
|
resolve({
|
136
152
|
namedDest: '',
|
137
153
|
explicitDest: dest
|
138
154
|
});
|
139
155
|
}).then(function (data) {
|
140
|
-
if (!(data.explicitDest
|
141
|
-
console.error(
|
156
|
+
if (!Array.isArray(data.explicitDest)) {
|
157
|
+
console.error("PDFLinkService.navigateTo: \"".concat(data.explicitDest, "\" is") + " not a valid destination array, for dest=\"".concat(dest, "\"."));
|
142
158
|
return;
|
143
159
|
}
|
160
|
+
|
144
161
|
goToDestination(data);
|
145
162
|
});
|
146
163
|
}
|
147
164
|
}, {
|
148
|
-
key:
|
165
|
+
key: "getDestinationHash",
|
149
166
|
value: function getDestinationHash(dest) {
|
150
167
|
if (typeof dest === 'string') {
|
151
168
|
return this.getAnchorUrl('#' + escape(dest));
|
152
169
|
}
|
153
|
-
|
170
|
+
|
171
|
+
if (Array.isArray(dest)) {
|
154
172
|
var str = JSON.stringify(dest);
|
155
173
|
return this.getAnchorUrl('#' + escape(str));
|
156
174
|
}
|
175
|
+
|
157
176
|
return this.getAnchorUrl('');
|
158
177
|
}
|
159
178
|
}, {
|
160
|
-
key:
|
179
|
+
key: "getAnchorUrl",
|
161
180
|
value: function getAnchorUrl(anchor) {
|
162
181
|
return (this.baseUrl || '') + anchor;
|
163
182
|
}
|
164
183
|
}, {
|
165
|
-
key:
|
184
|
+
key: "setHash",
|
166
185
|
value: function setHash(hash) {
|
167
|
-
var pageNumber
|
168
|
-
|
186
|
+
var pageNumber, dest;
|
187
|
+
|
169
188
|
if (hash.includes('=')) {
|
170
189
|
var params = (0, _ui_utils.parseQueryString)(hash);
|
190
|
+
|
171
191
|
if ('search' in params) {
|
172
192
|
this.eventBus.dispatch('findfromurlhash', {
|
173
193
|
source: this,
|
@@ -175,35 +195,48 @@ var PDFLinkService = function () {
|
|
175
195
|
phraseSearch: params['phrase'] === 'true'
|
176
196
|
});
|
177
197
|
}
|
198
|
+
|
178
199
|
if ('nameddest' in params) {
|
179
200
|
this.navigateTo(params.nameddest);
|
180
201
|
return;
|
181
202
|
}
|
203
|
+
|
182
204
|
if ('page' in params) {
|
183
205
|
pageNumber = params.page | 0 || 1;
|
184
206
|
}
|
207
|
+
|
185
208
|
if ('zoom' in params) {
|
186
209
|
var zoomArgs = params.zoom.split(',');
|
187
210
|
var zoomArg = zoomArgs[0];
|
188
211
|
var zoomArgNumber = parseFloat(zoomArg);
|
212
|
+
|
189
213
|
if (!zoomArg.includes('Fit')) {
|
190
|
-
dest = [null, {
|
214
|
+
dest = [null, {
|
215
|
+
name: 'XYZ'
|
216
|
+
}, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null, zoomArgs.length > 2 ? zoomArgs[2] | 0 : null, zoomArgNumber ? zoomArgNumber / 100 : zoomArg];
|
191
217
|
} else {
|
192
218
|
if (zoomArg === 'Fit' || zoomArg === 'FitB') {
|
193
|
-
dest = [null, {
|
219
|
+
dest = [null, {
|
220
|
+
name: zoomArg
|
221
|
+
}];
|
194
222
|
} else if (zoomArg === 'FitH' || zoomArg === 'FitBH' || zoomArg === 'FitV' || zoomArg === 'FitBV') {
|
195
|
-
dest = [null, {
|
223
|
+
dest = [null, {
|
224
|
+
name: zoomArg
|
225
|
+
}, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null];
|
196
226
|
} else if (zoomArg === 'FitR') {
|
197
227
|
if (zoomArgs.length !== 5) {
|
198
228
|
console.error('PDFLinkService.setHash: Not enough parameters for "FitR".');
|
199
229
|
} else {
|
200
|
-
dest = [null, {
|
230
|
+
dest = [null, {
|
231
|
+
name: zoomArg
|
232
|
+
}, zoomArgs[1] | 0, zoomArgs[2] | 0, zoomArgs[3] | 0, zoomArgs[4] | 0];
|
201
233
|
}
|
202
234
|
} else {
|
203
|
-
console.error(
|
235
|
+
console.error("PDFLinkService.setHash: \"".concat(zoomArg, "\" is not ") + 'a valid zoom value.');
|
204
236
|
}
|
205
237
|
}
|
206
238
|
}
|
239
|
+
|
207
240
|
if (dest) {
|
208
241
|
this.pdfViewer.scrollPageIntoView({
|
209
242
|
pageNumber: pageNumber || this.page,
|
@@ -213,6 +246,7 @@ var PDFLinkService = function () {
|
|
213
246
|
} else if (pageNumber) {
|
214
247
|
this.page = pageNumber;
|
215
248
|
}
|
249
|
+
|
216
250
|
if ('pagemode' in params) {
|
217
251
|
this.eventBus.dispatch('pagemode', {
|
218
252
|
source: this,
|
@@ -221,93 +255,100 @@ var PDFLinkService = function () {
|
|
221
255
|
}
|
222
256
|
} else {
|
223
257
|
dest = unescape(hash);
|
258
|
+
|
224
259
|
try {
|
225
260
|
dest = JSON.parse(dest);
|
226
|
-
|
261
|
+
|
262
|
+
if (!Array.isArray(dest)) {
|
227
263
|
dest = dest.toString();
|
228
264
|
}
|
229
265
|
} catch (ex) {}
|
266
|
+
|
230
267
|
if (typeof dest === 'string' || isValidExplicitDestination(dest)) {
|
231
268
|
this.navigateTo(dest);
|
232
269
|
return;
|
233
270
|
}
|
234
|
-
|
271
|
+
|
272
|
+
console.error("PDFLinkService.setHash: \"".concat(unescape(hash), "\" is not ") + 'a valid destination.');
|
235
273
|
}
|
236
274
|
}
|
237
275
|
}, {
|
238
|
-
key:
|
276
|
+
key: "executeNamedAction",
|
239
277
|
value: function executeNamedAction(action) {
|
240
278
|
switch (action) {
|
241
279
|
case 'GoBack':
|
242
280
|
if (this.pdfHistory) {
|
243
281
|
this.pdfHistory.back();
|
244
282
|
}
|
283
|
+
|
245
284
|
break;
|
285
|
+
|
246
286
|
case 'GoForward':
|
247
287
|
if (this.pdfHistory) {
|
248
288
|
this.pdfHistory.forward();
|
249
289
|
}
|
290
|
+
|
250
291
|
break;
|
292
|
+
|
251
293
|
case 'NextPage':
|
252
294
|
if (this.page < this.pagesCount) {
|
253
295
|
this.page++;
|
254
296
|
}
|
297
|
+
|
255
298
|
break;
|
299
|
+
|
256
300
|
case 'PrevPage':
|
257
301
|
if (this.page > 1) {
|
258
302
|
this.page--;
|
259
303
|
}
|
304
|
+
|
260
305
|
break;
|
306
|
+
|
261
307
|
case 'LastPage':
|
262
308
|
this.page = this.pagesCount;
|
263
309
|
break;
|
310
|
+
|
264
311
|
case 'FirstPage':
|
265
312
|
this.page = 1;
|
266
313
|
break;
|
314
|
+
|
267
315
|
default:
|
268
316
|
break;
|
269
317
|
}
|
318
|
+
|
270
319
|
this.eventBus.dispatch('namedaction', {
|
271
320
|
source: this,
|
272
321
|
action: action
|
273
322
|
});
|
274
323
|
}
|
275
324
|
}, {
|
276
|
-
key:
|
277
|
-
value: function onFileAttachmentAnnotation(_ref3) {
|
278
|
-
var id = _ref3.id,
|
279
|
-
filename = _ref3.filename,
|
280
|
-
content = _ref3.content;
|
281
|
-
|
282
|
-
this.eventBus.dispatch('fileattachmentannotation', {
|
283
|
-
source: this,
|
284
|
-
id: id,
|
285
|
-
filename: filename,
|
286
|
-
content: content
|
287
|
-
});
|
288
|
-
}
|
289
|
-
}, {
|
290
|
-
key: 'cachePageRef',
|
325
|
+
key: "cachePageRef",
|
291
326
|
value: function cachePageRef(pageNum, pageRef) {
|
292
327
|
if (!pageRef) {
|
293
328
|
return;
|
294
329
|
}
|
295
|
-
|
330
|
+
|
331
|
+
var refStr = pageRef.gen === 0 ? "".concat(pageRef.num, "R") : "".concat(pageRef.num, "R").concat(pageRef.gen);
|
296
332
|
this._pagesRefCache[refStr] = pageNum;
|
297
333
|
}
|
298
334
|
}, {
|
299
|
-
key:
|
335
|
+
key: "_cachedPageNumber",
|
300
336
|
value: function _cachedPageNumber(pageRef) {
|
301
|
-
var refStr = pageRef.
|
337
|
+
var refStr = pageRef.gen === 0 ? "".concat(pageRef.num, "R") : "".concat(pageRef.num, "R").concat(pageRef.gen);
|
302
338
|
return this._pagesRefCache && this._pagesRefCache[refStr] || null;
|
303
339
|
}
|
304
340
|
}, {
|
305
|
-
key:
|
341
|
+
key: "isPageVisible",
|
342
|
+
value: function isPageVisible(pageNumber) {
|
343
|
+
return this.pdfViewer.isPageVisible(pageNumber);
|
344
|
+
}
|
345
|
+
}, {
|
346
|
+
key: "pagesCount",
|
306
347
|
get: function get() {
|
307
348
|
return this.pdfDocument ? this.pdfDocument.numPages : 0;
|
308
349
|
}
|
309
350
|
}, {
|
310
|
-
key:
|
351
|
+
key: "page",
|
311
352
|
get: function get() {
|
312
353
|
return this.pdfViewer.currentPageNumber;
|
313
354
|
},
|
@@ -315,7 +356,7 @@ var PDFLinkService = function () {
|
|
315
356
|
this.pdfViewer.currentPageNumber = value;
|
316
357
|
}
|
317
358
|
}, {
|
318
|
-
key:
|
359
|
+
key: "rotation",
|
319
360
|
get: function get() {
|
320
361
|
return this.pdfViewer.pagesRotation;
|
321
362
|
},
|
@@ -327,32 +368,44 @@ var PDFLinkService = function () {
|
|
327
368
|
return PDFLinkService;
|
328
369
|
}();
|
329
370
|
|
371
|
+
exports.PDFLinkService = PDFLinkService;
|
372
|
+
|
330
373
|
function isValidExplicitDestination(dest) {
|
331
|
-
if (!(dest
|
374
|
+
if (!Array.isArray(dest)) {
|
332
375
|
return false;
|
333
376
|
}
|
377
|
+
|
334
378
|
var destLength = dest.length,
|
335
379
|
allowNull = true;
|
380
|
+
|
336
381
|
if (destLength < 2) {
|
337
382
|
return false;
|
338
383
|
}
|
384
|
+
|
339
385
|
var page = dest[0];
|
340
|
-
|
386
|
+
|
387
|
+
if (!(_typeof(page) === 'object' && Number.isInteger(page.num) && Number.isInteger(page.gen)) && !(Number.isInteger(page) && page >= 0)) {
|
341
388
|
return false;
|
342
389
|
}
|
390
|
+
|
343
391
|
var zoom = dest[1];
|
344
|
-
|
392
|
+
|
393
|
+
if (!(_typeof(zoom) === 'object' && typeof zoom.name === 'string')) {
|
345
394
|
return false;
|
346
395
|
}
|
396
|
+
|
347
397
|
switch (zoom.name) {
|
348
398
|
case 'XYZ':
|
349
399
|
if (destLength !== 5) {
|
350
400
|
return false;
|
351
401
|
}
|
402
|
+
|
352
403
|
break;
|
404
|
+
|
353
405
|
case 'Fit':
|
354
406
|
case 'FitB':
|
355
407
|
return destLength === 2;
|
408
|
+
|
356
409
|
case 'FitH':
|
357
410
|
case 'FitBH':
|
358
411
|
case 'FitV':
|
@@ -360,70 +413,83 @@ function isValidExplicitDestination(dest) {
|
|
360
413
|
if (destLength !== 3) {
|
361
414
|
return false;
|
362
415
|
}
|
416
|
+
|
363
417
|
break;
|
418
|
+
|
364
419
|
case 'FitR':
|
365
420
|
if (destLength !== 6) {
|
366
421
|
return false;
|
367
422
|
}
|
423
|
+
|
368
424
|
allowNull = false;
|
369
425
|
break;
|
426
|
+
|
370
427
|
default:
|
371
428
|
return false;
|
372
429
|
}
|
430
|
+
|
373
431
|
for (var i = 2; i < destLength; i++) {
|
374
432
|
var param = dest[i];
|
433
|
+
|
375
434
|
if (!(typeof param === 'number' || allowNull && param === null)) {
|
376
435
|
return false;
|
377
436
|
}
|
378
437
|
}
|
438
|
+
|
379
439
|
return true;
|
380
440
|
}
|
381
441
|
|
382
|
-
var SimpleLinkService =
|
442
|
+
var SimpleLinkService =
|
443
|
+
/*#__PURE__*/
|
444
|
+
function () {
|
383
445
|
function SimpleLinkService() {
|
384
446
|
_classCallCheck(this, SimpleLinkService);
|
385
447
|
|
386
448
|
this.externalLinkTarget = null;
|
387
449
|
this.externalLinkRel = null;
|
450
|
+
this.externalLinkEnabled = true;
|
388
451
|
}
|
389
452
|
|
390
453
|
_createClass(SimpleLinkService, [{
|
391
|
-
key:
|
454
|
+
key: "navigateTo",
|
392
455
|
value: function navigateTo(dest) {}
|
393
456
|
}, {
|
394
|
-
key:
|
457
|
+
key: "getDestinationHash",
|
395
458
|
value: function getDestinationHash(dest) {
|
396
459
|
return '#';
|
397
460
|
}
|
398
461
|
}, {
|
399
|
-
key:
|
462
|
+
key: "getAnchorUrl",
|
400
463
|
value: function getAnchorUrl(hash) {
|
401
464
|
return '#';
|
402
465
|
}
|
403
466
|
}, {
|
404
|
-
key:
|
467
|
+
key: "setHash",
|
405
468
|
value: function setHash(hash) {}
|
406
469
|
}, {
|
407
|
-
key:
|
470
|
+
key: "executeNamedAction",
|
408
471
|
value: function executeNamedAction(action) {}
|
409
472
|
}, {
|
410
|
-
key:
|
411
|
-
value: function
|
412
|
-
|
413
|
-
|
414
|
-
|
473
|
+
key: "cachePageRef",
|
474
|
+
value: function cachePageRef(pageNum, pageRef) {}
|
475
|
+
}, {
|
476
|
+
key: "isPageVisible",
|
477
|
+
value: function isPageVisible(pageNumber) {
|
478
|
+
return true;
|
415
479
|
}
|
416
480
|
}, {
|
417
|
-
key:
|
418
|
-
|
481
|
+
key: "pagesCount",
|
482
|
+
get: function get() {
|
483
|
+
return 0;
|
484
|
+
}
|
419
485
|
}, {
|
420
|
-
key:
|
486
|
+
key: "page",
|
421
487
|
get: function get() {
|
422
488
|
return 0;
|
423
489
|
},
|
424
490
|
set: function set(value) {}
|
425
491
|
}, {
|
426
|
-
key:
|
492
|
+
key: "rotation",
|
427
493
|
get: function get() {
|
428
494
|
return 0;
|
429
495
|
},
|
@@ -433,5 +499,4 @@ var SimpleLinkService = function () {
|
|
433
499
|
return SimpleLinkService;
|
434
500
|
}();
|
435
501
|
|
436
|
-
exports.PDFLinkService = PDFLinkService;
|
437
502
|
exports.SimpleLinkService = SimpleLinkService;
|