pdfjs-dist 2.0.943 → 2.4.456
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/README.md +4 -0
- package/bower.json +1 -1
- package/build/pdf.js +8286 -14230
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +22 -1
- package/build/pdf.worker.entry.js +5 -3
- package/build/pdf.worker.js +25500 -26628
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +22 -1
- package/es5/build/pdf.js +25473 -0
- package/es5/build/pdf.js.map +1 -0
- package/{lib/shared/global_scope.js → es5/build/pdf.worker.entry.js} +5 -10
- package/es5/build/pdf.worker.js +57878 -0
- package/es5/build/pdf.worker.js.map +1 -0
- package/es5/web/images/annotation-check.svg +11 -0
- package/es5/web/images/annotation-comment.svg +16 -0
- package/es5/web/images/annotation-help.svg +26 -0
- package/es5/web/images/annotation-insert.svg +10 -0
- package/es5/web/images/annotation-key.svg +11 -0
- package/es5/web/images/annotation-newparagraph.svg +11 -0
- package/es5/web/images/annotation-noicon.svg +7 -0
- package/es5/web/images/annotation-note.svg +42 -0
- package/es5/web/images/annotation-paragraph.svg +16 -0
- package/es5/web/images/loading-icon.gif +0 -0
- package/es5/web/images/shadow.png +0 -0
- package/es5/web/images/texture.png +0 -0
- package/es5/web/pdf_viewer.css +407 -0
- package/es5/web/pdf_viewer.js +7757 -0
- package/es5/web/pdf_viewer.js.map +1 -0
- package/image_decoders/pdf.image_decoders.js +2887 -4094
- package/image_decoders/pdf.image_decoders.js.map +1 -1
- package/image_decoders/pdf.image_decoders.min.js +22 -1
- package/lib/README.md +7 -0
- package/lib/core/annotation.js +855 -778
- package/lib/core/arithmetic_decoder.js +325 -311
- package/lib/core/bidi.js +117 -50
- package/lib/core/ccitt.js +251 -89
- package/lib/core/ccitt_stream.js +26 -16
- package/lib/core/cff_parser.js +525 -197
- package/lib/core/charsets.js +6 -5
- package/lib/core/chunked_stream.js +541 -406
- package/lib/core/cmap.js +368 -253
- package/lib/core/colorspace.js +781 -800
- package/lib/core/core_utils.js +152 -0
- package/lib/core/crypto.js +609 -422
- package/lib/core/document.js +649 -481
- package/lib/core/encodings.js +33 -24
- package/lib/core/evaluator.js +1471 -736
- package/lib/core/font_renderer.js +289 -149
- package/lib/core/fonts.js +1067 -413
- package/lib/core/function.js +517 -287
- package/lib/core/glyphlist.js +4529 -4527
- package/lib/core/image.js +232 -114
- package/lib/core/image_utils.js +94 -0
- package/lib/core/jbig2.js +711 -342
- package/lib/core/jbig2_stream.js +31 -19
- package/lib/core/jpeg_stream.js +151 -26
- package/lib/core/jpg.js +433 -181
- package/lib/core/jpx.js +551 -143
- package/lib/core/jpx_stream.js +40 -28
- package/lib/core/metrics.js +2931 -2931
- package/lib/core/murmurhash3.js +104 -97
- package/lib/core/obj.js +1561 -1053
- package/lib/core/operator_list.js +192 -64
- package/lib/core/parser.js +1162 -864
- package/lib/core/pattern.js +224 -75
- package/lib/core/pdf_manager.js +154 -285
- package/lib/core/primitives.js +145 -69
- package/lib/core/ps_parser.js +212 -162
- package/lib/core/standard_fonts.js +245 -244
- package/lib/core/stream.js +353 -81
- package/lib/core/type1_parser.js +218 -68
- package/lib/core/unicode.js +1682 -1655
- package/lib/core/worker.js +233 -302
- package/lib/core/worker_stream.js +168 -0
- package/lib/display/annotation_layer.js +808 -862
- package/lib/display/api.js +1778 -1462
- package/lib/display/api_compatibility.js +14 -9
- package/lib/display/canvas.js +463 -140
- package/lib/display/content_disposition.js +86 -58
- package/lib/display/display_utils.js +524 -0
- package/lib/display/fetch_stream.js +202 -274
- package/lib/display/font_loader.js +311 -333
- package/lib/display/metadata.js +98 -88
- package/lib/display/network.js +343 -347
- package/lib/display/network_utils.js +46 -26
- package/lib/display/node_stream.js +326 -404
- package/lib/display/pattern_helper.js +168 -69
- package/lib/display/svg.js +1296 -885
- package/lib/display/text_layer.js +229 -103
- package/lib/display/transport_stream.js +290 -250
- package/lib/display/webgl.js +116 -83
- package/lib/display/worker_options.js +6 -5
- package/lib/display/xml_parser.js +358 -337
- package/lib/examples/node/domstubs.js +95 -39
- package/lib/pdf.js +49 -31
- package/lib/pdf.worker.js +7 -5
- package/lib/shared/compatibility.js +3 -145
- package/lib/shared/is_node.js +8 -7
- package/lib/shared/message_handler.js +367 -314
- package/lib/shared/util.js +421 -415
- package/lib/test/unit/annotation_spec.js +1570 -690
- package/lib/test/unit/api_spec.js +855 -493
- package/lib/test/unit/bidi_spec.js +12 -12
- package/lib/test/unit/cff_parser_spec.js +88 -61
- package/lib/test/unit/clitests_helper.js +9 -12
- package/lib/test/unit/cmap_spec.js +140 -88
- package/lib/test/unit/colorspace_spec.js +204 -152
- package/lib/test/unit/core_utils_spec.js +211 -0
- package/lib/test/unit/crypto_spec.js +194 -182
- package/lib/test/unit/custom_spec.js +50 -64
- package/lib/test/unit/display_svg_spec.js +53 -38
- package/lib/test/unit/display_utils_spec.js +263 -0
- package/lib/test/unit/document_spec.js +17 -22
- package/lib/test/unit/encodings_spec.js +15 -57
- package/lib/test/unit/evaluator_spec.js +90 -83
- package/lib/test/unit/fetch_stream_spec.js +111 -0
- package/lib/test/unit/function_spec.js +219 -205
- package/lib/test/unit/jasmine-boot.js +68 -39
- package/lib/test/unit/message_handler_spec.js +187 -160
- package/lib/test/unit/metadata_spec.js +87 -34
- package/lib/test/unit/murmurhash3_spec.js +13 -13
- package/lib/test/unit/network_spec.js +26 -59
- package/lib/test/unit/network_utils_spec.js +187 -121
- package/lib/test/unit/node_stream_spec.js +98 -90
- package/lib/test/unit/parser_spec.js +173 -131
- package/lib/test/unit/pdf_find_controller_spec.js +148 -67
- package/lib/test/unit/pdf_find_utils_spec.js +35 -34
- package/lib/test/unit/pdf_history_spec.js +45 -33
- package/lib/test/unit/primitives_spec.js +161 -126
- package/lib/test/unit/stream_spec.js +22 -15
- package/lib/test/unit/test_utils.js +149 -98
- package/lib/test/unit/testreporter.js +36 -18
- package/lib/test/unit/type1_parser_spec.js +46 -44
- package/lib/test/unit/ui_utils_spec.js +388 -372
- package/lib/test/unit/unicode_spec.js +49 -46
- package/lib/test/unit/util_spec.js +144 -248
- package/lib/web/annotation_layer_builder.js +75 -95
- package/lib/web/app.js +1538 -1147
- package/lib/web/app_options.js +116 -104
- package/lib/web/base_viewer.js +950 -775
- package/lib/web/chromecom.js +217 -225
- package/lib/web/debugger.js +236 -148
- package/lib/web/download_manager.js +50 -50
- package/lib/web/firefox_print_service.js +51 -33
- package/lib/web/firefoxcom.js +225 -352
- package/lib/web/genericcom.js +30 -93
- package/lib/web/genericl10n.js +26 -143
- package/lib/web/grab_to_pan.js +57 -33
- package/lib/web/interfaces.js +105 -232
- package/lib/web/overlay_manager.js +73 -227
- package/lib/web/password_prompt.js +44 -62
- package/lib/web/pdf_attachment_viewer.js +118 -123
- package/lib/web/pdf_cursor_tools.js +89 -93
- package/lib/web/pdf_document_properties.js +242 -281
- package/lib/web/pdf_find_bar.js +157 -163
- package/lib/web/pdf_find_controller.js +598 -454
- package/lib/web/pdf_find_utils.js +32 -16
- package/lib/web/pdf_history.js +481 -355
- package/lib/web/pdf_link_service.js +355 -323
- package/lib/web/pdf_outline_viewer.js +167 -152
- package/lib/web/pdf_page_view.js +511 -457
- package/lib/web/pdf_presentation_mode.js +347 -335
- package/lib/web/pdf_print_service.js +133 -103
- package/lib/web/pdf_rendering_queue.js +98 -100
- package/lib/web/pdf_sidebar.js +323 -299
- package/lib/web/pdf_sidebar_resizer.js +107 -108
- package/lib/web/pdf_single_page_viewer.js +94 -146
- package/lib/web/pdf_thumbnail_view.js +319 -269
- package/lib/web/pdf_thumbnail_viewer.js +219 -199
- package/lib/web/pdf_viewer.component.js +111 -32
- package/lib/web/pdf_viewer.js +61 -101
- package/lib/web/preferences.js +87 -272
- package/lib/web/secondary_toolbar.js +207 -220
- package/lib/web/text_layer_builder.js +322 -322
- package/lib/web/toolbar.js +227 -180
- package/lib/web/ui_utils.js +476 -421
- package/lib/web/view_history.js +59 -208
- package/lib/web/viewer_compatibility.js +9 -6
- package/package.json +2 -9
- package/web/pdf_viewer.css +36 -22
- package/web/pdf_viewer.js +4407 -4516
- package/web/pdf_viewer.js.map +1 -1
- package/webpack.js +14 -5
- package/external/streams/streams-lib.js +0 -3962
- package/external/url/url-lib.js +0 -627
- package/lib/display/dom_utils.js +0 -441
- package/lib/shared/streams_polyfill.js +0 -39
- package/lib/shared/url_polyfill.js +0 -50
- package/lib/test/unit/dom_utils_spec.js +0 -89
- package/lib/web/dom_events.js +0 -140
package/lib/core/pdf_manager.js
CHANGED
@@ -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 2020 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,335 +19,204 @@
|
|
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.NetworkPdfManager = exports.LocalPdfManager =
|
27
|
+
exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
|
28
28
|
|
29
|
-
var
|
29
|
+
var _util = require("../shared/util.js");
|
30
30
|
|
31
|
-
var
|
31
|
+
var _chunked_stream = require("./chunked_stream.js");
|
32
32
|
|
33
|
-
var
|
33
|
+
var _core_utils = require("./core_utils.js");
|
34
34
|
|
35
|
-
var
|
35
|
+
var _document = require("./document.js");
|
36
36
|
|
37
|
-
var
|
37
|
+
var _stream = require("./stream.js");
|
38
38
|
|
39
|
-
|
39
|
+
class BasePdfManager {
|
40
|
+
constructor() {
|
41
|
+
if (this.constructor === BasePdfManager) {
|
42
|
+
(0, _util.unreachable)("Cannot initialize BasePdfManager.");
|
43
|
+
}
|
44
|
+
}
|
40
45
|
|
41
|
-
|
46
|
+
get docId() {
|
47
|
+
return this._docId;
|
48
|
+
}
|
42
49
|
|
43
|
-
|
50
|
+
get password() {
|
51
|
+
return this._password;
|
52
|
+
}
|
44
53
|
|
45
|
-
|
54
|
+
get docBaseUrl() {
|
55
|
+
let docBaseUrl = null;
|
46
56
|
|
47
|
-
|
57
|
+
if (this._docBaseUrl) {
|
58
|
+
const absoluteUrl = (0, _util.createValidAbsoluteUrl)(this._docBaseUrl);
|
48
59
|
|
49
|
-
|
60
|
+
if (absoluteUrl) {
|
61
|
+
docBaseUrl = absoluteUrl.href;
|
62
|
+
} else {
|
63
|
+
(0, _util.warn)(`Invalid absolute docBaseUrl: "${this._docBaseUrl}".`);
|
64
|
+
}
|
65
|
+
}
|
50
66
|
|
51
|
-
|
67
|
+
return (0, _util.shadow)(this, "docBaseUrl", docBaseUrl);
|
68
|
+
}
|
52
69
|
|
53
|
-
|
54
|
-
|
55
|
-
|
70
|
+
onLoadedStream() {
|
71
|
+
(0, _util.unreachable)("Abstract method `onLoadedStream` called");
|
72
|
+
}
|
56
73
|
|
57
|
-
|
58
|
-
|
59
|
-
}
|
74
|
+
ensureDoc(prop, args) {
|
75
|
+
return this.ensure(this.pdfDocument, prop, args);
|
60
76
|
}
|
61
77
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
(0, _util.unreachable)('Abstract method `onLoadedStream` called');
|
66
|
-
}
|
67
|
-
}, {
|
68
|
-
key: 'ensureDoc',
|
69
|
-
value: function ensureDoc(prop, args) {
|
70
|
-
return this.ensure(this.pdfDocument, prop, args);
|
71
|
-
}
|
72
|
-
}, {
|
73
|
-
key: 'ensureXRef',
|
74
|
-
value: function ensureXRef(prop, args) {
|
75
|
-
return this.ensure(this.pdfDocument.xref, prop, args);
|
76
|
-
}
|
77
|
-
}, {
|
78
|
-
key: 'ensureCatalog',
|
79
|
-
value: function ensureCatalog(prop, args) {
|
80
|
-
return this.ensure(this.pdfDocument.catalog, prop, args);
|
81
|
-
}
|
82
|
-
}, {
|
83
|
-
key: 'getPage',
|
84
|
-
value: function getPage(pageIndex) {
|
85
|
-
return this.pdfDocument.getPage(pageIndex);
|
86
|
-
}
|
87
|
-
}, {
|
88
|
-
key: 'cleanup',
|
89
|
-
value: function cleanup() {
|
90
|
-
return this.pdfDocument.cleanup();
|
91
|
-
}
|
92
|
-
}, {
|
93
|
-
key: 'ensure',
|
94
|
-
value: function () {
|
95
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee(obj, prop, args) {
|
96
|
-
return _regenerator2.default.wrap(function _callee$(_context) {
|
97
|
-
while (1) {
|
98
|
-
switch (_context.prev = _context.next) {
|
99
|
-
case 0:
|
100
|
-
(0, _util.unreachable)('Abstract method `ensure` called');
|
101
|
-
|
102
|
-
case 1:
|
103
|
-
case 'end':
|
104
|
-
return _context.stop();
|
105
|
-
}
|
106
|
-
}
|
107
|
-
}, _callee, this);
|
108
|
-
}));
|
109
|
-
|
110
|
-
function ensure(_x, _x2, _x3) {
|
111
|
-
return _ref.apply(this, arguments);
|
112
|
-
}
|
78
|
+
ensureXRef(prop, args) {
|
79
|
+
return this.ensure(this.pdfDocument.xref, prop, args);
|
80
|
+
}
|
113
81
|
|
114
|
-
|
115
|
-
|
116
|
-
}
|
117
|
-
key: 'requestRange',
|
118
|
-
value: function requestRange(begin, end) {
|
119
|
-
(0, _util.unreachable)('Abstract method `requestRange` called');
|
120
|
-
}
|
121
|
-
}, {
|
122
|
-
key: 'requestLoadedStream',
|
123
|
-
value: function requestLoadedStream() {
|
124
|
-
(0, _util.unreachable)('Abstract method `requestLoadedStream` called');
|
125
|
-
}
|
126
|
-
}, {
|
127
|
-
key: 'sendProgressiveData',
|
128
|
-
value: function sendProgressiveData(chunk) {
|
129
|
-
(0, _util.unreachable)('Abstract method `sendProgressiveData` called');
|
130
|
-
}
|
131
|
-
}, {
|
132
|
-
key: 'updatePassword',
|
133
|
-
value: function updatePassword(password) {
|
134
|
-
this._password = password;
|
135
|
-
}
|
136
|
-
}, {
|
137
|
-
key: 'terminate',
|
138
|
-
value: function terminate() {
|
139
|
-
(0, _util.unreachable)('Abstract method `terminate` called');
|
140
|
-
}
|
141
|
-
}, {
|
142
|
-
key: 'docId',
|
143
|
-
get: function get() {
|
144
|
-
return this._docId;
|
145
|
-
}
|
146
|
-
}, {
|
147
|
-
key: 'password',
|
148
|
-
get: function get() {
|
149
|
-
return this._password;
|
150
|
-
}
|
151
|
-
}, {
|
152
|
-
key: 'docBaseUrl',
|
153
|
-
get: function get() {
|
154
|
-
var docBaseUrl = null;
|
155
|
-
if (this._docBaseUrl) {
|
156
|
-
var absoluteUrl = (0, _util.createValidAbsoluteUrl)(this._docBaseUrl);
|
157
|
-
if (absoluteUrl) {
|
158
|
-
docBaseUrl = absoluteUrl.href;
|
159
|
-
} else {
|
160
|
-
(0, _util.warn)('Invalid absolute docBaseUrl: "' + this._docBaseUrl + '".');
|
161
|
-
}
|
162
|
-
}
|
163
|
-
return (0, _util.shadow)(this, 'docBaseUrl', docBaseUrl);
|
164
|
-
}
|
165
|
-
}]);
|
82
|
+
ensureCatalog(prop, args) {
|
83
|
+
return this.ensure(this.pdfDocument.catalog, prop, args);
|
84
|
+
}
|
166
85
|
|
167
|
-
|
168
|
-
|
86
|
+
getPage(pageIndex) {
|
87
|
+
return this.pdfDocument.getPage(pageIndex);
|
88
|
+
}
|
169
89
|
|
170
|
-
|
171
|
-
|
90
|
+
fontFallback(id, handler) {
|
91
|
+
return this.pdfDocument.fontFallback(id, handler);
|
92
|
+
}
|
172
93
|
|
173
|
-
|
174
|
-
|
94
|
+
cleanup() {
|
95
|
+
return this.pdfDocument.cleanup();
|
96
|
+
}
|
175
97
|
|
176
|
-
|
98
|
+
async ensure(obj, prop, args) {
|
99
|
+
(0, _util.unreachable)("Abstract method `ensure` called");
|
100
|
+
}
|
177
101
|
|
178
|
-
|
179
|
-
|
180
|
-
_this._docBaseUrl = docBaseUrl;
|
181
|
-
_this.evaluatorOptions = evaluatorOptions;
|
182
|
-
var stream = new _stream.Stream(data);
|
183
|
-
_this.pdfDocument = new _document.PDFDocument(_this, stream);
|
184
|
-
_this._loadedStreamPromise = Promise.resolve(stream);
|
185
|
-
return _this;
|
102
|
+
requestRange(begin, end) {
|
103
|
+
(0, _util.unreachable)("Abstract method `requestRange` called");
|
186
104
|
}
|
187
105
|
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee2(obj, prop, args) {
|
192
|
-
var value;
|
193
|
-
return _regenerator2.default.wrap(function _callee2$(_context2) {
|
194
|
-
while (1) {
|
195
|
-
switch (_context2.prev = _context2.next) {
|
196
|
-
case 0:
|
197
|
-
value = obj[prop];
|
198
|
-
|
199
|
-
if (!(typeof value === 'function')) {
|
200
|
-
_context2.next = 3;
|
201
|
-
break;
|
202
|
-
}
|
203
|
-
|
204
|
-
return _context2.abrupt('return', value.apply(obj, args));
|
205
|
-
|
206
|
-
case 3:
|
207
|
-
return _context2.abrupt('return', value);
|
208
|
-
|
209
|
-
case 4:
|
210
|
-
case 'end':
|
211
|
-
return _context2.stop();
|
212
|
-
}
|
213
|
-
}
|
214
|
-
}, _callee2, this);
|
215
|
-
}));
|
216
|
-
|
217
|
-
function ensure(_x4, _x5, _x6) {
|
218
|
-
return _ref2.apply(this, arguments);
|
219
|
-
}
|
106
|
+
requestLoadedStream() {
|
107
|
+
(0, _util.unreachable)("Abstract method `requestLoadedStream` called");
|
108
|
+
}
|
220
109
|
|
221
|
-
|
222
|
-
|
223
|
-
}
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
}
|
232
|
-
|
233
|
-
|
234
|
-
|
110
|
+
sendProgressiveData(chunk) {
|
111
|
+
(0, _util.unreachable)("Abstract method `sendProgressiveData` called");
|
112
|
+
}
|
113
|
+
|
114
|
+
updatePassword(password) {
|
115
|
+
this._password = password;
|
116
|
+
}
|
117
|
+
|
118
|
+
terminate(reason) {
|
119
|
+
(0, _util.unreachable)("Abstract method `terminate` called");
|
120
|
+
}
|
121
|
+
|
122
|
+
}
|
123
|
+
|
124
|
+
class LocalPdfManager extends BasePdfManager {
|
125
|
+
constructor(docId, data, password, evaluatorOptions, docBaseUrl) {
|
126
|
+
super();
|
127
|
+
this._docId = docId;
|
128
|
+
this._password = password;
|
129
|
+
this._docBaseUrl = docBaseUrl;
|
130
|
+
this.evaluatorOptions = evaluatorOptions;
|
131
|
+
const stream = new _stream.Stream(data);
|
132
|
+
this.pdfDocument = new _document.PDFDocument(this, stream);
|
133
|
+
this._loadedStreamPromise = Promise.resolve(stream);
|
134
|
+
}
|
135
|
+
|
136
|
+
async ensure(obj, prop, args) {
|
137
|
+
const value = obj[prop];
|
138
|
+
|
139
|
+
if (typeof value === "function") {
|
140
|
+
return value.apply(obj, args);
|
235
141
|
}
|
236
|
-
}, {
|
237
|
-
key: 'terminate',
|
238
|
-
value: function terminate() {}
|
239
|
-
}]);
|
240
142
|
|
241
|
-
|
242
|
-
}
|
143
|
+
return value;
|
144
|
+
}
|
145
|
+
|
146
|
+
requestRange(begin, end) {
|
147
|
+
return Promise.resolve();
|
148
|
+
}
|
243
149
|
|
244
|
-
|
245
|
-
|
150
|
+
requestLoadedStream() {}
|
151
|
+
|
152
|
+
onLoadedStream() {
|
153
|
+
return this._loadedStreamPromise;
|
154
|
+
}
|
246
155
|
|
247
|
-
|
248
|
-
_classCallCheck(this, NetworkPdfManager);
|
156
|
+
terminate(reason) {}
|
249
157
|
|
250
|
-
|
158
|
+
}
|
251
159
|
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
160
|
+
exports.LocalPdfManager = LocalPdfManager;
|
161
|
+
|
162
|
+
class NetworkPdfManager extends BasePdfManager {
|
163
|
+
constructor(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) {
|
164
|
+
super();
|
165
|
+
this._docId = docId;
|
166
|
+
this._password = args.password;
|
167
|
+
this._docBaseUrl = docBaseUrl;
|
168
|
+
this.msgHandler = args.msgHandler;
|
169
|
+
this.evaluatorOptions = evaluatorOptions;
|
170
|
+
this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
|
258
171
|
msgHandler: args.msgHandler,
|
259
|
-
url: args.url,
|
260
172
|
length: args.length,
|
261
173
|
disableAutoFetch: args.disableAutoFetch,
|
262
174
|
rangeChunkSize: args.rangeChunkSize
|
263
175
|
});
|
264
|
-
|
265
|
-
return _this2;
|
176
|
+
this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
|
266
177
|
}
|
267
178
|
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
return
|
274
|
-
while (1) {
|
275
|
-
switch (_context3.prev = _context3.next) {
|
276
|
-
case 0:
|
277
|
-
_context3.prev = 0;
|
278
|
-
value = obj[prop];
|
279
|
-
|
280
|
-
if (!(typeof value === 'function')) {
|
281
|
-
_context3.next = 4;
|
282
|
-
break;
|
283
|
-
}
|
284
|
-
|
285
|
-
return _context3.abrupt('return', value.apply(obj, args));
|
286
|
-
|
287
|
-
case 4:
|
288
|
-
return _context3.abrupt('return', value);
|
289
|
-
|
290
|
-
case 7:
|
291
|
-
_context3.prev = 7;
|
292
|
-
_context3.t0 = _context3['catch'](0);
|
293
|
-
|
294
|
-
if (_context3.t0 instanceof _util.MissingDataException) {
|
295
|
-
_context3.next = 11;
|
296
|
-
break;
|
297
|
-
}
|
298
|
-
|
299
|
-
throw _context3.t0;
|
300
|
-
|
301
|
-
case 11:
|
302
|
-
_context3.next = 13;
|
303
|
-
return this.requestRange(_context3.t0.begin, _context3.t0.end);
|
304
|
-
|
305
|
-
case 13:
|
306
|
-
return _context3.abrupt('return', this.ensure(obj, prop, args));
|
307
|
-
|
308
|
-
case 14:
|
309
|
-
case 'end':
|
310
|
-
return _context3.stop();
|
311
|
-
}
|
312
|
-
}
|
313
|
-
}, _callee3, this, [[0, 7]]);
|
314
|
-
}));
|
315
|
-
|
316
|
-
function ensure(_x7, _x8, _x9) {
|
317
|
-
return _ref3.apply(this, arguments);
|
179
|
+
async ensure(obj, prop, args) {
|
180
|
+
try {
|
181
|
+
const value = obj[prop];
|
182
|
+
|
183
|
+
if (typeof value === "function") {
|
184
|
+
return value.apply(obj, args);
|
318
185
|
}
|
319
186
|
|
320
|
-
return
|
321
|
-
}()
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
key: 'requestLoadedStream',
|
329
|
-
value: function requestLoadedStream() {
|
330
|
-
this.streamManager.requestAllChunks();
|
331
|
-
}
|
332
|
-
}, {
|
333
|
-
key: 'sendProgressiveData',
|
334
|
-
value: function sendProgressiveData(chunk) {
|
335
|
-
this.streamManager.onReceiveData({ chunk: chunk });
|
336
|
-
}
|
337
|
-
}, {
|
338
|
-
key: 'onLoadedStream',
|
339
|
-
value: function onLoadedStream() {
|
340
|
-
return this.streamManager.onLoadedStream();
|
341
|
-
}
|
342
|
-
}, {
|
343
|
-
key: 'terminate',
|
344
|
-
value: function terminate() {
|
345
|
-
this.streamManager.abort();
|
187
|
+
return value;
|
188
|
+
} catch (ex) {
|
189
|
+
if (!(ex instanceof _core_utils.MissingDataException)) {
|
190
|
+
throw ex;
|
191
|
+
}
|
192
|
+
|
193
|
+
await this.requestRange(ex.begin, ex.end);
|
194
|
+
return this.ensure(obj, prop, args);
|
346
195
|
}
|
347
|
-
}
|
196
|
+
}
|
348
197
|
|
349
|
-
|
350
|
-
|
198
|
+
requestRange(begin, end) {
|
199
|
+
return this.streamManager.requestRange(begin, end);
|
200
|
+
}
|
201
|
+
|
202
|
+
requestLoadedStream() {
|
203
|
+
this.streamManager.requestAllChunks();
|
204
|
+
}
|
205
|
+
|
206
|
+
sendProgressiveData(chunk) {
|
207
|
+
this.streamManager.onReceiveData({
|
208
|
+
chunk
|
209
|
+
});
|
210
|
+
}
|
211
|
+
|
212
|
+
onLoadedStream() {
|
213
|
+
return this.streamManager.onLoadedStream();
|
214
|
+
}
|
215
|
+
|
216
|
+
terminate(reason) {
|
217
|
+
this.streamManager.abort(reason);
|
218
|
+
}
|
219
|
+
|
220
|
+
}
|
351
221
|
|
352
|
-
exports.LocalPdfManager = LocalPdfManager;
|
353
222
|
exports.NetworkPdfManager = NetworkPdfManager;
|