pdfjs-dist 2.0.489 → 2.2.228
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 +18515 -11402
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +1 -1
- package/build/pdf.worker.js +48266 -37137
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +1 -1
- package/external/url/url-lib.js +627 -0
- package/image_decoders/pdf.image_decoders.js +11350 -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 +587 -242
- 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 +400 -152
- package/lib/core/cmap.js +326 -87
- package/lib/core/colorspace.js +874 -594
- package/lib/core/core_utils.js +147 -0
- package/lib/core/crypto.js +290 -45
- package/lib/core/document.js +560 -268
- package/lib/core/encodings.js +19 -10
- package/lib/core/evaluator.js +1005 -360
- package/lib/core/font_renderer.js +331 -97
- package/lib/core/fonts.js +812 -195
- package/lib/core/function.js +284 -71
- package/lib/core/glyphlist.js +4 -3
- package/lib/core/image.js +169 -62
- package/lib/core/image_utils.js +111 -0
- package/lib/core/jbig2.js +479 -66
- package/lib/core/jbig2_stream.js +19 -8
- package/lib/core/jpeg_stream.js +38 -13
- package/lib/core/jpg.js +253 -29
- package/lib/core/jpx.js +396 -6
- 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 +1354 -488
- package/lib/core/operator_list.js +144 -31
- package/lib/core/parser.js +539 -191
- package/lib/core/pattern.js +148 -14
- package/lib/core/pdf_manager.js +323 -133
- package/lib/core/primitives.js +111 -24
- package/lib/core/ps_parser.js +134 -45
- package/lib/core/standard_fonts.js +17 -17
- package/lib/core/stream.js +313 -34
- package/lib/core/type1_parser.js +143 -13
- package/lib/core/unicode.js +32 -5
- package/lib/core/worker.js +217 -190
- package/lib/core/worker_stream.js +277 -0
- package/lib/display/annotation_layer.js +450 -133
- package/lib/display/api.js +1597 -784
- package/lib/display/api_compatibility.js +11 -13
- package/lib/display/canvas.js +360 -44
- package/lib/display/content_disposition.js +83 -32
- package/lib/display/display_utils.js +747 -0
- package/lib/display/fetch_stream.js +221 -90
- 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 +32 -19
- package/lib/display/node_stream.js +367 -175
- package/lib/display/pattern_helper.js +81 -31
- package/lib/display/svg.js +1235 -519
- package/lib/display/text_layer.js +153 -29
- 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 +36 -14
- package/lib/pdf.worker.js +5 -3
- package/lib/shared/compatibility.js +158 -564
- package/lib/shared/global_scope.js +2 -2
- package/lib/shared/is_node.js +4 -4
- package/lib/shared/message_handler.js +521 -0
- package/lib/shared/streams_polyfill.js +21 -17
- package/lib/shared/url_polyfill.js +56 -0
- package/lib/shared/util.js +243 -710
- package/lib/test/unit/annotation_spec.js +870 -401
- package/lib/test/unit/api_spec.js +657 -345
- 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 +10 -8
- 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 +38 -15
- package/lib/test/unit/fetch_stream_spec.js +109 -0
- package/lib/test/unit/function_spec.js +17 -5
- package/lib/test/unit/jasmine-boot.js +33 -20
- package/lib/test/unit/{util_stream_spec.js → message_handler_spec.js} +41 -69
- 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 +19 -54
- package/lib/test/unit/network_utils_spec.js +91 -14
- package/lib/test/unit/node_stream_spec.js +56 -32
- 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 +53 -20
- 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 +8 -6
- package/lib/test/unit/ui_utils_spec.js +454 -16
- 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 +1290 -588
- package/lib/web/app_options.js +100 -62
- package/lib/web/base_viewer.js +511 -182
- package/lib/web/chromecom.js +261 -117
- package/lib/web/debugger.js +166 -22
- package/lib/web/download_manager.js +32 -13
- package/lib/web/firefox_print_service.js +20 -10
- package/lib/web/firefoxcom.js +315 -80
- 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 +170 -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 +138 -77
- package/lib/web/pdf_outline_viewer.js +122 -46
- package/lib/web/pdf_page_view.js +191 -67
- package/lib/web/pdf_presentation_mode.js +99 -34
- package/lib/web/pdf_print_service.js +61 -13
- package/lib/web/pdf_rendering_queue.js +28 -9
- package/lib/web/pdf_sidebar.js +141 -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 +91 -52
- package/lib/web/preferences.js +284 -89
- package/lib/web/secondary_toolbar.js +165 -40
- package/lib/web/text_layer_builder.js +134 -59
- package/lib/web/toolbar.js +78 -43
- package/lib/web/ui_utils.js +462 -136
- package/lib/web/view_history.js +215 -67
- package/lib/web/viewer_compatibility.js +4 -13
- package/package.json +5 -4
- package/web/pdf_viewer.css +79 -11
- package/web/pdf_viewer.js +6107 -3748
- package/web/pdf_viewer.js.map +1 -1
- package/lib/display/dom_utils.js +0 -309
- 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,35 +19,37 @@
|
|
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;
|
47
49
|
|
48
50
|
_classCallCheck(this, PDFLinkService);
|
49
51
|
|
50
|
-
this.eventBus = eventBus || (0,
|
52
|
+
this.eventBus = eventBus || (0, _ui_utils.getGlobalEventBus)();
|
51
53
|
this.externalLinkTarget = externalLinkTarget;
|
52
54
|
this.externalLinkRel = externalLinkRel;
|
53
55
|
this.baseUrl = null;
|
@@ -58,70 +60,79 @@ var PDFLinkService = function () {
|
|
58
60
|
}
|
59
61
|
|
60
62
|
_createClass(PDFLinkService, [{
|
61
|
-
key:
|
62
|
-
value: function setDocument(pdfDocument
|
63
|
+
key: "setDocument",
|
64
|
+
value: function setDocument(pdfDocument) {
|
65
|
+
var baseUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
63
66
|
this.baseUrl = baseUrl;
|
64
67
|
this.pdfDocument = pdfDocument;
|
65
68
|
this._pagesRefCache = Object.create(null);
|
66
69
|
}
|
67
70
|
}, {
|
68
|
-
key:
|
71
|
+
key: "setViewer",
|
69
72
|
value: function setViewer(pdfViewer) {
|
70
73
|
this.pdfViewer = pdfViewer;
|
71
74
|
}
|
72
75
|
}, {
|
73
|
-
key:
|
76
|
+
key: "setHistory",
|
74
77
|
value: function setHistory(pdfHistory) {
|
75
78
|
this.pdfHistory = pdfHistory;
|
76
79
|
}
|
77
80
|
}, {
|
78
|
-
key:
|
81
|
+
key: "navigateTo",
|
79
82
|
value: function navigateTo(dest) {
|
80
83
|
var _this = this;
|
81
84
|
|
82
85
|
var goToDestination = function goToDestination(_ref2) {
|
83
86
|
var namedDest = _ref2.namedDest,
|
84
87
|
explicitDest = _ref2.explicitDest;
|
85
|
-
|
86
88
|
var destRef = explicitDest[0],
|
87
|
-
pageNumber
|
89
|
+
pageNumber;
|
90
|
+
|
88
91
|
if (destRef instanceof Object) {
|
89
92
|
pageNumber = _this._cachedPageNumber(destRef);
|
93
|
+
|
90
94
|
if (pageNumber === null) {
|
91
95
|
_this.pdfDocument.getPageIndex(destRef).then(function (pageIndex) {
|
92
96
|
_this.cachePageRef(pageIndex + 1, destRef);
|
97
|
+
|
93
98
|
goToDestination({
|
94
99
|
namedDest: namedDest,
|
95
100
|
explicitDest: explicitDest
|
96
101
|
});
|
97
|
-
})
|
98
|
-
console.error(
|
102
|
+
})["catch"](function () {
|
103
|
+
console.error("PDFLinkService.navigateTo: \"".concat(destRef, "\" is not ") + "a valid page reference, for dest=\"".concat(dest, "\"."));
|
99
104
|
});
|
105
|
+
|
100
106
|
return;
|
101
107
|
}
|
102
108
|
} else if (Number.isInteger(destRef)) {
|
103
109
|
pageNumber = destRef + 1;
|
104
110
|
} else {
|
105
|
-
console.error(
|
111
|
+
console.error("PDFLinkService.navigateTo: \"".concat(destRef, "\" is not ") + "a valid destination reference, for dest=\"".concat(dest, "\"."));
|
106
112
|
return;
|
107
113
|
}
|
114
|
+
|
108
115
|
if (!pageNumber || pageNumber < 1 || pageNumber > _this.pagesCount) {
|
109
|
-
console.error(
|
116
|
+
console.error("PDFLinkService.navigateTo: \"".concat(pageNumber, "\" is not ") + "a valid page number, for dest=\"".concat(dest, "\"."));
|
110
117
|
return;
|
111
118
|
}
|
119
|
+
|
112
120
|
if (_this.pdfHistory) {
|
113
121
|
_this.pdfHistory.pushCurrentPosition();
|
122
|
+
|
114
123
|
_this.pdfHistory.push({
|
115
124
|
namedDest: namedDest,
|
116
125
|
explicitDest: explicitDest,
|
117
126
|
pageNumber: pageNumber
|
118
127
|
});
|
119
128
|
}
|
129
|
+
|
120
130
|
_this.pdfViewer.scrollPageIntoView({
|
121
131
|
pageNumber: pageNumber,
|
122
132
|
destArray: explicitDest
|
123
133
|
});
|
124
134
|
};
|
135
|
+
|
125
136
|
new Promise(function (resolve, reject) {
|
126
137
|
if (typeof dest === 'string') {
|
127
138
|
_this.pdfDocument.getDestination(dest).then(function (destArray) {
|
@@ -130,44 +141,50 @@ var PDFLinkService = function () {
|
|
130
141
|
explicitDest: destArray
|
131
142
|
});
|
132
143
|
});
|
144
|
+
|
133
145
|
return;
|
134
146
|
}
|
147
|
+
|
135
148
|
resolve({
|
136
149
|
namedDest: '',
|
137
150
|
explicitDest: dest
|
138
151
|
});
|
139
152
|
}).then(function (data) {
|
140
|
-
if (!(data.explicitDest
|
141
|
-
console.error(
|
153
|
+
if (!Array.isArray(data.explicitDest)) {
|
154
|
+
console.error("PDFLinkService.navigateTo: \"".concat(data.explicitDest, "\" is") + " not a valid destination array, for dest=\"".concat(dest, "\"."));
|
142
155
|
return;
|
143
156
|
}
|
157
|
+
|
144
158
|
goToDestination(data);
|
145
159
|
});
|
146
160
|
}
|
147
161
|
}, {
|
148
|
-
key:
|
162
|
+
key: "getDestinationHash",
|
149
163
|
value: function getDestinationHash(dest) {
|
150
164
|
if (typeof dest === 'string') {
|
151
165
|
return this.getAnchorUrl('#' + escape(dest));
|
152
166
|
}
|
153
|
-
|
167
|
+
|
168
|
+
if (Array.isArray(dest)) {
|
154
169
|
var str = JSON.stringify(dest);
|
155
170
|
return this.getAnchorUrl('#' + escape(str));
|
156
171
|
}
|
172
|
+
|
157
173
|
return this.getAnchorUrl('');
|
158
174
|
}
|
159
175
|
}, {
|
160
|
-
key:
|
176
|
+
key: "getAnchorUrl",
|
161
177
|
value: function getAnchorUrl(anchor) {
|
162
178
|
return (this.baseUrl || '') + anchor;
|
163
179
|
}
|
164
180
|
}, {
|
165
|
-
key:
|
181
|
+
key: "setHash",
|
166
182
|
value: function setHash(hash) {
|
167
|
-
var pageNumber
|
168
|
-
|
183
|
+
var pageNumber, dest;
|
184
|
+
|
169
185
|
if (hash.includes('=')) {
|
170
186
|
var params = (0, _ui_utils.parseQueryString)(hash);
|
187
|
+
|
171
188
|
if ('search' in params) {
|
172
189
|
this.eventBus.dispatch('findfromurlhash', {
|
173
190
|
source: this,
|
@@ -175,35 +192,48 @@ var PDFLinkService = function () {
|
|
175
192
|
phraseSearch: params['phrase'] === 'true'
|
176
193
|
});
|
177
194
|
}
|
195
|
+
|
178
196
|
if ('nameddest' in params) {
|
179
197
|
this.navigateTo(params.nameddest);
|
180
198
|
return;
|
181
199
|
}
|
200
|
+
|
182
201
|
if ('page' in params) {
|
183
202
|
pageNumber = params.page | 0 || 1;
|
184
203
|
}
|
204
|
+
|
185
205
|
if ('zoom' in params) {
|
186
206
|
var zoomArgs = params.zoom.split(',');
|
187
207
|
var zoomArg = zoomArgs[0];
|
188
208
|
var zoomArgNumber = parseFloat(zoomArg);
|
209
|
+
|
189
210
|
if (!zoomArg.includes('Fit')) {
|
190
|
-
dest = [null, {
|
211
|
+
dest = [null, {
|
212
|
+
name: 'XYZ'
|
213
|
+
}, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null, zoomArgs.length > 2 ? zoomArgs[2] | 0 : null, zoomArgNumber ? zoomArgNumber / 100 : zoomArg];
|
191
214
|
} else {
|
192
215
|
if (zoomArg === 'Fit' || zoomArg === 'FitB') {
|
193
|
-
dest = [null, {
|
216
|
+
dest = [null, {
|
217
|
+
name: zoomArg
|
218
|
+
}];
|
194
219
|
} else if (zoomArg === 'FitH' || zoomArg === 'FitBH' || zoomArg === 'FitV' || zoomArg === 'FitBV') {
|
195
|
-
dest = [null, {
|
220
|
+
dest = [null, {
|
221
|
+
name: zoomArg
|
222
|
+
}, zoomArgs.length > 1 ? zoomArgs[1] | 0 : null];
|
196
223
|
} else if (zoomArg === 'FitR') {
|
197
224
|
if (zoomArgs.length !== 5) {
|
198
225
|
console.error('PDFLinkService.setHash: Not enough parameters for "FitR".');
|
199
226
|
} else {
|
200
|
-
dest = [null, {
|
227
|
+
dest = [null, {
|
228
|
+
name: zoomArg
|
229
|
+
}, zoomArgs[1] | 0, zoomArgs[2] | 0, zoomArgs[3] | 0, zoomArgs[4] | 0];
|
201
230
|
}
|
202
231
|
} else {
|
203
|
-
console.error(
|
232
|
+
console.error("PDFLinkService.setHash: \"".concat(zoomArg, "\" is not ") + 'a valid zoom value.');
|
204
233
|
}
|
205
234
|
}
|
206
235
|
}
|
236
|
+
|
207
237
|
if (dest) {
|
208
238
|
this.pdfViewer.scrollPageIntoView({
|
209
239
|
pageNumber: pageNumber || this.page,
|
@@ -213,6 +243,7 @@ var PDFLinkService = function () {
|
|
213
243
|
} else if (pageNumber) {
|
214
244
|
this.page = pageNumber;
|
215
245
|
}
|
246
|
+
|
216
247
|
if ('pagemode' in params) {
|
217
248
|
this.eventBus.dispatch('pagemode', {
|
218
249
|
source: this,
|
@@ -221,93 +252,100 @@ var PDFLinkService = function () {
|
|
221
252
|
}
|
222
253
|
} else {
|
223
254
|
dest = unescape(hash);
|
255
|
+
|
224
256
|
try {
|
225
257
|
dest = JSON.parse(dest);
|
226
|
-
|
258
|
+
|
259
|
+
if (!Array.isArray(dest)) {
|
227
260
|
dest = dest.toString();
|
228
261
|
}
|
229
262
|
} catch (ex) {}
|
263
|
+
|
230
264
|
if (typeof dest === 'string' || isValidExplicitDestination(dest)) {
|
231
265
|
this.navigateTo(dest);
|
232
266
|
return;
|
233
267
|
}
|
234
|
-
|
268
|
+
|
269
|
+
console.error("PDFLinkService.setHash: \"".concat(unescape(hash), "\" is not ") + 'a valid destination.');
|
235
270
|
}
|
236
271
|
}
|
237
272
|
}, {
|
238
|
-
key:
|
273
|
+
key: "executeNamedAction",
|
239
274
|
value: function executeNamedAction(action) {
|
240
275
|
switch (action) {
|
241
276
|
case 'GoBack':
|
242
277
|
if (this.pdfHistory) {
|
243
278
|
this.pdfHistory.back();
|
244
279
|
}
|
280
|
+
|
245
281
|
break;
|
282
|
+
|
246
283
|
case 'GoForward':
|
247
284
|
if (this.pdfHistory) {
|
248
285
|
this.pdfHistory.forward();
|
249
286
|
}
|
287
|
+
|
250
288
|
break;
|
289
|
+
|
251
290
|
case 'NextPage':
|
252
291
|
if (this.page < this.pagesCount) {
|
253
292
|
this.page++;
|
254
293
|
}
|
294
|
+
|
255
295
|
break;
|
296
|
+
|
256
297
|
case 'PrevPage':
|
257
298
|
if (this.page > 1) {
|
258
299
|
this.page--;
|
259
300
|
}
|
301
|
+
|
260
302
|
break;
|
303
|
+
|
261
304
|
case 'LastPage':
|
262
305
|
this.page = this.pagesCount;
|
263
306
|
break;
|
307
|
+
|
264
308
|
case 'FirstPage':
|
265
309
|
this.page = 1;
|
266
310
|
break;
|
311
|
+
|
267
312
|
default:
|
268
313
|
break;
|
269
314
|
}
|
315
|
+
|
270
316
|
this.eventBus.dispatch('namedaction', {
|
271
317
|
source: this,
|
272
318
|
action: action
|
273
319
|
});
|
274
320
|
}
|
275
321
|
}, {
|
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',
|
322
|
+
key: "cachePageRef",
|
291
323
|
value: function cachePageRef(pageNum, pageRef) {
|
292
324
|
if (!pageRef) {
|
293
325
|
return;
|
294
326
|
}
|
327
|
+
|
295
328
|
var refStr = pageRef.num + ' ' + pageRef.gen + ' R';
|
296
329
|
this._pagesRefCache[refStr] = pageNum;
|
297
330
|
}
|
298
331
|
}, {
|
299
|
-
key:
|
332
|
+
key: "_cachedPageNumber",
|
300
333
|
value: function _cachedPageNumber(pageRef) {
|
301
334
|
var refStr = pageRef.num + ' ' + pageRef.gen + ' R';
|
302
335
|
return this._pagesRefCache && this._pagesRefCache[refStr] || null;
|
303
336
|
}
|
304
337
|
}, {
|
305
|
-
key:
|
338
|
+
key: "isPageVisible",
|
339
|
+
value: function isPageVisible(pageNumber) {
|
340
|
+
return this.pdfViewer.isPageVisible(pageNumber);
|
341
|
+
}
|
342
|
+
}, {
|
343
|
+
key: "pagesCount",
|
306
344
|
get: function get() {
|
307
345
|
return this.pdfDocument ? this.pdfDocument.numPages : 0;
|
308
346
|
}
|
309
347
|
}, {
|
310
|
-
key:
|
348
|
+
key: "page",
|
311
349
|
get: function get() {
|
312
350
|
return this.pdfViewer.currentPageNumber;
|
313
351
|
},
|
@@ -315,7 +353,7 @@ var PDFLinkService = function () {
|
|
315
353
|
this.pdfViewer.currentPageNumber = value;
|
316
354
|
}
|
317
355
|
}, {
|
318
|
-
key:
|
356
|
+
key: "rotation",
|
319
357
|
get: function get() {
|
320
358
|
return this.pdfViewer.pagesRotation;
|
321
359
|
},
|
@@ -327,32 +365,44 @@ var PDFLinkService = function () {
|
|
327
365
|
return PDFLinkService;
|
328
366
|
}();
|
329
367
|
|
368
|
+
exports.PDFLinkService = PDFLinkService;
|
369
|
+
|
330
370
|
function isValidExplicitDestination(dest) {
|
331
|
-
if (!(dest
|
371
|
+
if (!Array.isArray(dest)) {
|
332
372
|
return false;
|
333
373
|
}
|
374
|
+
|
334
375
|
var destLength = dest.length,
|
335
376
|
allowNull = true;
|
377
|
+
|
336
378
|
if (destLength < 2) {
|
337
379
|
return false;
|
338
380
|
}
|
381
|
+
|
339
382
|
var page = dest[0];
|
340
|
-
|
383
|
+
|
384
|
+
if (!(_typeof(page) === 'object' && Number.isInteger(page.num) && Number.isInteger(page.gen)) && !(Number.isInteger(page) && page >= 0)) {
|
341
385
|
return false;
|
342
386
|
}
|
387
|
+
|
343
388
|
var zoom = dest[1];
|
344
|
-
|
389
|
+
|
390
|
+
if (!(_typeof(zoom) === 'object' && typeof zoom.name === 'string')) {
|
345
391
|
return false;
|
346
392
|
}
|
393
|
+
|
347
394
|
switch (zoom.name) {
|
348
395
|
case 'XYZ':
|
349
396
|
if (destLength !== 5) {
|
350
397
|
return false;
|
351
398
|
}
|
399
|
+
|
352
400
|
break;
|
401
|
+
|
353
402
|
case 'Fit':
|
354
403
|
case 'FitB':
|
355
404
|
return destLength === 2;
|
405
|
+
|
356
406
|
case 'FitH':
|
357
407
|
case 'FitBH':
|
358
408
|
case 'FitV':
|
@@ -360,26 +410,35 @@ function isValidExplicitDestination(dest) {
|
|
360
410
|
if (destLength !== 3) {
|
361
411
|
return false;
|
362
412
|
}
|
413
|
+
|
363
414
|
break;
|
415
|
+
|
364
416
|
case 'FitR':
|
365
417
|
if (destLength !== 6) {
|
366
418
|
return false;
|
367
419
|
}
|
420
|
+
|
368
421
|
allowNull = false;
|
369
422
|
break;
|
423
|
+
|
370
424
|
default:
|
371
425
|
return false;
|
372
426
|
}
|
427
|
+
|
373
428
|
for (var i = 2; i < destLength; i++) {
|
374
429
|
var param = dest[i];
|
430
|
+
|
375
431
|
if (!(typeof param === 'number' || allowNull && param === null)) {
|
376
432
|
return false;
|
377
433
|
}
|
378
434
|
}
|
435
|
+
|
379
436
|
return true;
|
380
437
|
}
|
381
438
|
|
382
|
-
var SimpleLinkService =
|
439
|
+
var SimpleLinkService =
|
440
|
+
/*#__PURE__*/
|
441
|
+
function () {
|
383
442
|
function SimpleLinkService() {
|
384
443
|
_classCallCheck(this, SimpleLinkService);
|
385
444
|
|
@@ -388,42 +447,45 @@ var SimpleLinkService = function () {
|
|
388
447
|
}
|
389
448
|
|
390
449
|
_createClass(SimpleLinkService, [{
|
391
|
-
key:
|
450
|
+
key: "navigateTo",
|
392
451
|
value: function navigateTo(dest) {}
|
393
452
|
}, {
|
394
|
-
key:
|
453
|
+
key: "getDestinationHash",
|
395
454
|
value: function getDestinationHash(dest) {
|
396
455
|
return '#';
|
397
456
|
}
|
398
457
|
}, {
|
399
|
-
key:
|
458
|
+
key: "getAnchorUrl",
|
400
459
|
value: function getAnchorUrl(hash) {
|
401
460
|
return '#';
|
402
461
|
}
|
403
462
|
}, {
|
404
|
-
key:
|
463
|
+
key: "setHash",
|
405
464
|
value: function setHash(hash) {}
|
406
465
|
}, {
|
407
|
-
key:
|
466
|
+
key: "executeNamedAction",
|
408
467
|
value: function executeNamedAction(action) {}
|
409
468
|
}, {
|
410
|
-
key:
|
411
|
-
value: function
|
412
|
-
|
413
|
-
|
414
|
-
|
469
|
+
key: "cachePageRef",
|
470
|
+
value: function cachePageRef(pageNum, pageRef) {}
|
471
|
+
}, {
|
472
|
+
key: "isPageVisible",
|
473
|
+
value: function isPageVisible(pageNumber) {
|
474
|
+
return true;
|
415
475
|
}
|
416
476
|
}, {
|
417
|
-
key:
|
418
|
-
|
477
|
+
key: "pagesCount",
|
478
|
+
get: function get() {
|
479
|
+
return 0;
|
480
|
+
}
|
419
481
|
}, {
|
420
|
-
key:
|
482
|
+
key: "page",
|
421
483
|
get: function get() {
|
422
484
|
return 0;
|
423
485
|
},
|
424
486
|
set: function set(value) {}
|
425
487
|
}, {
|
426
|
-
key:
|
488
|
+
key: "rotation",
|
427
489
|
get: function get() {
|
428
490
|
return 0;
|
429
491
|
},
|
@@ -433,5 +495,4 @@ var SimpleLinkService = function () {
|
|
433
495
|
return SimpleLinkService;
|
434
496
|
}();
|
435
497
|
|
436
|
-
exports.PDFLinkService = PDFLinkService;
|
437
498
|
exports.SimpleLinkService = SimpleLinkService;
|