pdfjs-dist 2.0.943 → 2.1.266
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 +15329 -11095
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +1 -1
- package/build/pdf.worker.js +12497 -4184
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +1 -1
- package/image_decoders/pdf.image_decoders.js +3438 -1209
- package/image_decoders/pdf.image_decoders.js.map +1 -1
- package/image_decoders/pdf.image_decoders.min.js +1 -1
- package/lib/core/annotation.js +335 -109
- package/lib/core/arithmetic_decoder.js +274 -244
- package/lib/core/bidi.js +64 -5
- package/lib/core/ccitt.js +172 -17
- package/lib/core/ccitt_stream.js +14 -5
- package/lib/core/cff_parser.js +304 -28
- package/lib/core/charsets.js +4 -3
- package/lib/core/chunked_stream.js +379 -149
- package/lib/core/cmap.js +210 -40
- package/lib/core/colorspace.js +332 -187
- package/lib/core/crypto.js +289 -44
- package/lib/core/document.js +508 -249
- package/lib/core/encodings.js +18 -9
- package/lib/core/evaluator.js +657 -119
- package/lib/core/font_renderer.js +217 -34
- package/lib/core/fonts.js +632 -41
- package/lib/core/function.js +252 -26
- package/lib/core/glyphlist.js +2 -1
- package/lib/core/image.js +124 -27
- package/lib/core/jbig2.js +425 -65
- package/lib/core/jbig2_stream.js +18 -7
- package/lib/core/jpeg_stream.js +24 -8
- package/lib/core/jpg.js +208 -16
- package/lib/core/jpx.js +395 -5
- package/lib/core/jpx_stream.js +17 -5
- package/lib/core/metrics.js +3 -3
- package/lib/core/murmurhash3.js +23 -5
- package/lib/core/obj.js +625 -132
- package/lib/core/operator_list.js +104 -3
- package/lib/core/parser.js +262 -25
- package/lib/core/pattern.js +144 -12
- package/lib/core/pdf_manager.js +104 -70
- package/lib/core/primitives.js +74 -21
- package/lib/core/ps_parser.js +133 -44
- package/lib/core/standard_fonts.js +9 -9
- package/lib/core/stream.js +283 -31
- package/lib/core/type1_parser.js +138 -6
- package/lib/core/unicode.js +28 -1
- package/lib/core/worker.js +192 -57
- package/lib/display/annotation_layer.js +303 -123
- package/lib/display/api.js +1073 -574
- package/lib/display/api_compatibility.js +4 -1
- package/lib/display/canvas.js +314 -18
- package/lib/display/content_disposition.js +70 -23
- package/lib/display/dom_utils.js +112 -59
- package/lib/display/fetch_stream.js +95 -50
- package/lib/display/font_loader.js +250 -132
- package/lib/display/metadata.js +37 -15
- package/lib/display/network.js +123 -34
- package/lib/display/network_utils.js +23 -10
- package/lib/display/node_stream.js +162 -65
- package/lib/display/pattern_helper.js +57 -6
- package/lib/display/svg.js +194 -18
- package/lib/display/text_layer.js +128 -14
- package/lib/display/transport_stream.js +83 -27
- package/lib/display/webgl.js +63 -17
- package/lib/display/worker_options.js +4 -3
- package/lib/display/xml_parser.js +162 -52
- package/lib/examples/node/domstubs.js +56 -3
- package/lib/pdf.js +15 -2
- package/lib/pdf.worker.js +4 -2
- package/lib/shared/compatibility.js +129 -26
- package/lib/shared/global_scope.js +1 -1
- package/lib/shared/is_node.js +3 -3
- package/lib/shared/message_handler.js +103 -45
- package/lib/shared/streams_polyfill.js +20 -16
- package/lib/shared/url_polyfill.js +8 -2
- package/lib/shared/util.js +246 -84
- package/lib/test/unit/annotation_spec.js +99 -73
- package/lib/test/unit/api_spec.js +347 -113
- package/lib/test/unit/bidi_spec.js +6 -6
- package/lib/test/unit/cff_parser_spec.js +17 -5
- package/lib/test/unit/clitests_helper.js +7 -8
- package/lib/test/unit/cmap_spec.js +79 -25
- package/lib/test/unit/colorspace_spec.js +65 -18
- package/lib/test/unit/crypto_spec.js +16 -4
- package/lib/test/unit/custom_spec.js +40 -52
- package/lib/test/unit/display_svg_spec.js +32 -16
- package/lib/test/unit/document_spec.js +2 -2
- package/lib/test/unit/dom_utils_spec.js +8 -8
- package/lib/test/unit/encodings_spec.js +24 -44
- package/lib/test/unit/evaluator_spec.js +15 -8
- package/lib/test/unit/function_spec.js +16 -4
- package/lib/test/unit/jasmine-boot.js +29 -16
- package/lib/test/unit/message_handler_spec.js +19 -6
- package/lib/test/unit/metadata_spec.js +64 -11
- package/lib/test/unit/murmurhash3_spec.js +2 -2
- package/lib/test/unit/network_spec.js +19 -4
- package/lib/test/unit/network_utils_spec.js +6 -4
- package/lib/test/unit/node_stream_spec.js +50 -26
- package/lib/test/unit/parser_spec.js +13 -29
- package/lib/test/unit/pdf_find_controller_spec.js +144 -32
- package/lib/test/unit/pdf_find_utils_spec.js +10 -9
- package/lib/test/unit/pdf_history_spec.js +20 -8
- package/lib/test/unit/primitives_spec.js +23 -3
- package/lib/test/unit/stream_spec.js +8 -3
- package/lib/test/unit/test_utils.js +89 -26
- package/lib/test/unit/testreporter.js +19 -1
- package/lib/test/unit/type1_parser_spec.js +7 -5
- package/lib/test/unit/ui_utils_spec.js +162 -38
- package/lib/test/unit/unicode_spec.js +13 -10
- package/lib/test/unit/util_spec.js +89 -9
- package/lib/web/annotation_layer_builder.js +38 -21
- package/lib/web/app.js +610 -245
- package/lib/web/app_options.js +54 -34
- package/lib/web/base_viewer.js +359 -162
- package/lib/web/chromecom.js +159 -80
- package/lib/web/debugger.js +161 -17
- package/lib/web/download_manager.js +29 -11
- package/lib/web/firefox_print_service.js +16 -8
- package/lib/web/firefoxcom.js +127 -91
- package/lib/web/genericcom.js +50 -31
- package/lib/web/genericl10n.js +46 -34
- package/lib/web/grab_to_pan.js +25 -3
- package/lib/web/interfaces.js +108 -61
- package/lib/web/overlay_manager.js +67 -45
- package/lib/web/password_prompt.js +20 -12
- package/lib/web/pdf_attachment_viewer.js +37 -17
- package/lib/web/pdf_cursor_tools.js +38 -15
- package/lib/web/pdf_document_properties.js +65 -24
- package/lib/web/pdf_find_bar.js +48 -20
- package/lib/web/pdf_find_controller.js +290 -89
- package/lib/web/pdf_find_utils.js +19 -3
- package/lib/web/pdf_history.js +186 -49
- package/lib/web/pdf_link_service.js +127 -52
- package/lib/web/pdf_outline_viewer.js +71 -21
- package/lib/web/pdf_page_view.js +188 -63
- package/lib/web/pdf_presentation_mode.js +98 -33
- package/lib/web/pdf_print_service.js +54 -10
- package/lib/web/pdf_rendering_queue.js +26 -4
- package/lib/web/pdf_sidebar.js +116 -62
- package/lib/web/pdf_sidebar_resizer.js +41 -15
- package/lib/web/pdf_single_page_viewer.js +65 -68
- package/lib/web/pdf_thumbnail_view.js +102 -31
- package/lib/web/pdf_thumbnail_viewer.js +62 -22
- package/lib/web/pdf_viewer.component.js +111 -31
- package/lib/web/pdf_viewer.js +80 -60
- package/lib/web/preferences.js +61 -39
- package/lib/web/secondary_toolbar.js +101 -82
- package/lib/web/text_layer_builder.js +124 -69
- package/lib/web/toolbar.js +67 -27
- package/lib/web/ui_utils.js +284 -128
- package/lib/web/view_history.js +75 -51
- package/lib/web/viewer_compatibility.js +2 -1
- package/package.json +1 -1
- package/web/pdf_viewer.css +1 -1
- package/web/pdf_viewer.js +2200 -973
- package/web/pdf_viewer.js.map +1 -1
- package/lib/web/dom_events.js +0 -140
package/lib/core/pdf_manager.js
CHANGED
@@ -19,38 +19,50 @@
|
|
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 _regenerator = require(
|
29
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
30
30
|
|
31
|
-
var
|
31
|
+
var _util = require("../shared/util");
|
32
32
|
|
33
|
-
var
|
33
|
+
var _chunked_stream = require("./chunked_stream");
|
34
34
|
|
35
|
-
var
|
35
|
+
var _document = require("./document");
|
36
36
|
|
37
|
-
var
|
37
|
+
var _stream = require("./stream");
|
38
38
|
|
39
|
-
|
39
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
40
40
|
|
41
|
-
|
41
|
+
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); }
|
42
42
|
|
43
|
-
function
|
43
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
44
|
+
|
45
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
46
|
+
|
47
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
48
|
+
|
49
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
44
50
|
|
45
|
-
function
|
51
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
46
52
|
|
47
|
-
function
|
53
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
48
54
|
|
49
|
-
function _asyncToGenerator(fn) { return function () { var
|
55
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
50
56
|
|
51
57
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
52
58
|
|
53
|
-
var
|
59
|
+
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); } }
|
60
|
+
|
61
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
62
|
+
|
63
|
+
var BasePdfManager =
|
64
|
+
/*#__PURE__*/
|
65
|
+
function () {
|
54
66
|
function BasePdfManager() {
|
55
67
|
_classCallCheck(this, BasePdfManager);
|
56
68
|
|
@@ -60,47 +72,54 @@ var BasePdfManager = function () {
|
|
60
72
|
}
|
61
73
|
|
62
74
|
_createClass(BasePdfManager, [{
|
63
|
-
key:
|
75
|
+
key: "onLoadedStream",
|
64
76
|
value: function onLoadedStream() {
|
65
77
|
(0, _util.unreachable)('Abstract method `onLoadedStream` called');
|
66
78
|
}
|
67
79
|
}, {
|
68
|
-
key:
|
80
|
+
key: "ensureDoc",
|
69
81
|
value: function ensureDoc(prop, args) {
|
70
82
|
return this.ensure(this.pdfDocument, prop, args);
|
71
83
|
}
|
72
84
|
}, {
|
73
|
-
key:
|
85
|
+
key: "ensureXRef",
|
74
86
|
value: function ensureXRef(prop, args) {
|
75
87
|
return this.ensure(this.pdfDocument.xref, prop, args);
|
76
88
|
}
|
77
89
|
}, {
|
78
|
-
key:
|
90
|
+
key: "ensureCatalog",
|
79
91
|
value: function ensureCatalog(prop, args) {
|
80
92
|
return this.ensure(this.pdfDocument.catalog, prop, args);
|
81
93
|
}
|
82
94
|
}, {
|
83
|
-
key:
|
95
|
+
key: "getPage",
|
84
96
|
value: function getPage(pageIndex) {
|
85
97
|
return this.pdfDocument.getPage(pageIndex);
|
86
98
|
}
|
87
99
|
}, {
|
88
|
-
key:
|
100
|
+
key: "fontFallback",
|
101
|
+
value: function fontFallback(id, handler) {
|
102
|
+
return this.pdfDocument.fontFallback(id, handler);
|
103
|
+
}
|
104
|
+
}, {
|
105
|
+
key: "cleanup",
|
89
106
|
value: function cleanup() {
|
90
107
|
return this.pdfDocument.cleanup();
|
91
108
|
}
|
92
109
|
}, {
|
93
|
-
key:
|
110
|
+
key: "ensure",
|
94
111
|
value: function () {
|
95
|
-
var
|
96
|
-
|
112
|
+
var _ensure = _asyncToGenerator(
|
113
|
+
/*#__PURE__*/
|
114
|
+
_regenerator.default.mark(function _callee(obj, prop, args) {
|
115
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
97
116
|
while (1) {
|
98
117
|
switch (_context.prev = _context.next) {
|
99
118
|
case 0:
|
100
119
|
(0, _util.unreachable)('Abstract method `ensure` called');
|
101
120
|
|
102
121
|
case 1:
|
103
|
-
case
|
122
|
+
case "end":
|
104
123
|
return _context.stop();
|
105
124
|
}
|
106
125
|
}
|
@@ -108,58 +127,61 @@ var BasePdfManager = function () {
|
|
108
127
|
}));
|
109
128
|
|
110
129
|
function ensure(_x, _x2, _x3) {
|
111
|
-
return
|
130
|
+
return _ensure.apply(this, arguments);
|
112
131
|
}
|
113
132
|
|
114
133
|
return ensure;
|
115
134
|
}()
|
116
135
|
}, {
|
117
|
-
key:
|
136
|
+
key: "requestRange",
|
118
137
|
value: function requestRange(begin, end) {
|
119
138
|
(0, _util.unreachable)('Abstract method `requestRange` called');
|
120
139
|
}
|
121
140
|
}, {
|
122
|
-
key:
|
141
|
+
key: "requestLoadedStream",
|
123
142
|
value: function requestLoadedStream() {
|
124
143
|
(0, _util.unreachable)('Abstract method `requestLoadedStream` called');
|
125
144
|
}
|
126
145
|
}, {
|
127
|
-
key:
|
146
|
+
key: "sendProgressiveData",
|
128
147
|
value: function sendProgressiveData(chunk) {
|
129
148
|
(0, _util.unreachable)('Abstract method `sendProgressiveData` called');
|
130
149
|
}
|
131
150
|
}, {
|
132
|
-
key:
|
151
|
+
key: "updatePassword",
|
133
152
|
value: function updatePassword(password) {
|
134
153
|
this._password = password;
|
135
154
|
}
|
136
155
|
}, {
|
137
|
-
key:
|
156
|
+
key: "terminate",
|
138
157
|
value: function terminate() {
|
139
158
|
(0, _util.unreachable)('Abstract method `terminate` called');
|
140
159
|
}
|
141
160
|
}, {
|
142
|
-
key:
|
161
|
+
key: "docId",
|
143
162
|
get: function get() {
|
144
163
|
return this._docId;
|
145
164
|
}
|
146
165
|
}, {
|
147
|
-
key:
|
166
|
+
key: "password",
|
148
167
|
get: function get() {
|
149
168
|
return this._password;
|
150
169
|
}
|
151
170
|
}, {
|
152
|
-
key:
|
171
|
+
key: "docBaseUrl",
|
153
172
|
get: function get() {
|
154
173
|
var docBaseUrl = null;
|
174
|
+
|
155
175
|
if (this._docBaseUrl) {
|
156
176
|
var absoluteUrl = (0, _util.createValidAbsoluteUrl)(this._docBaseUrl);
|
177
|
+
|
157
178
|
if (absoluteUrl) {
|
158
179
|
docBaseUrl = absoluteUrl.href;
|
159
180
|
} else {
|
160
|
-
(0, _util.warn)(
|
181
|
+
(0, _util.warn)("Invalid absolute docBaseUrl: \"".concat(this._docBaseUrl, "\"."));
|
161
182
|
}
|
162
183
|
}
|
184
|
+
|
163
185
|
return (0, _util.shadow)(this, 'docBaseUrl', docBaseUrl);
|
164
186
|
}
|
165
187
|
}]);
|
@@ -167,30 +189,35 @@ var BasePdfManager = function () {
|
|
167
189
|
return BasePdfManager;
|
168
190
|
}();
|
169
191
|
|
170
|
-
var LocalPdfManager =
|
192
|
+
var LocalPdfManager =
|
193
|
+
/*#__PURE__*/
|
194
|
+
function (_BasePdfManager) {
|
171
195
|
_inherits(LocalPdfManager, _BasePdfManager);
|
172
196
|
|
173
197
|
function LocalPdfManager(docId, data, password, evaluatorOptions, docBaseUrl) {
|
174
|
-
|
198
|
+
var _this;
|
175
199
|
|
176
|
-
|
200
|
+
_classCallCheck(this, LocalPdfManager);
|
177
201
|
|
202
|
+
_this = _possibleConstructorReturn(this, _getPrototypeOf(LocalPdfManager).call(this));
|
178
203
|
_this._docId = docId;
|
179
204
|
_this._password = password;
|
180
205
|
_this._docBaseUrl = docBaseUrl;
|
181
206
|
_this.evaluatorOptions = evaluatorOptions;
|
182
207
|
var stream = new _stream.Stream(data);
|
183
|
-
_this.pdfDocument = new _document.PDFDocument(_this, stream);
|
208
|
+
_this.pdfDocument = new _document.PDFDocument(_assertThisInitialized(_assertThisInitialized(_this)), stream);
|
184
209
|
_this._loadedStreamPromise = Promise.resolve(stream);
|
185
210
|
return _this;
|
186
211
|
}
|
187
212
|
|
188
213
|
_createClass(LocalPdfManager, [{
|
189
|
-
key:
|
214
|
+
key: "ensure",
|
190
215
|
value: function () {
|
191
|
-
var
|
216
|
+
var _ensure2 = _asyncToGenerator(
|
217
|
+
/*#__PURE__*/
|
218
|
+
_regenerator.default.mark(function _callee2(obj, prop, args) {
|
192
219
|
var value;
|
193
|
-
return
|
220
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
194
221
|
while (1) {
|
195
222
|
switch (_context2.prev = _context2.next) {
|
196
223
|
case 0:
|
@@ -201,13 +228,13 @@ var LocalPdfManager = function (_BasePdfManager) {
|
|
201
228
|
break;
|
202
229
|
}
|
203
230
|
|
204
|
-
return _context2.abrupt(
|
231
|
+
return _context2.abrupt("return", value.apply(obj, args));
|
205
232
|
|
206
233
|
case 3:
|
207
|
-
return _context2.abrupt(
|
234
|
+
return _context2.abrupt("return", value);
|
208
235
|
|
209
236
|
case 4:
|
210
|
-
case
|
237
|
+
case "end":
|
211
238
|
return _context2.stop();
|
212
239
|
}
|
213
240
|
}
|
@@ -215,40 +242,45 @@ var LocalPdfManager = function (_BasePdfManager) {
|
|
215
242
|
}));
|
216
243
|
|
217
244
|
function ensure(_x4, _x5, _x6) {
|
218
|
-
return
|
245
|
+
return _ensure2.apply(this, arguments);
|
219
246
|
}
|
220
247
|
|
221
248
|
return ensure;
|
222
249
|
}()
|
223
250
|
}, {
|
224
|
-
key:
|
251
|
+
key: "requestRange",
|
225
252
|
value: function requestRange(begin, end) {
|
226
253
|
return Promise.resolve();
|
227
254
|
}
|
228
255
|
}, {
|
229
|
-
key:
|
256
|
+
key: "requestLoadedStream",
|
230
257
|
value: function requestLoadedStream() {}
|
231
258
|
}, {
|
232
|
-
key:
|
259
|
+
key: "onLoadedStream",
|
233
260
|
value: function onLoadedStream() {
|
234
261
|
return this._loadedStreamPromise;
|
235
262
|
}
|
236
263
|
}, {
|
237
|
-
key:
|
264
|
+
key: "terminate",
|
238
265
|
value: function terminate() {}
|
239
266
|
}]);
|
240
267
|
|
241
268
|
return LocalPdfManager;
|
242
269
|
}(BasePdfManager);
|
243
270
|
|
244
|
-
|
271
|
+
exports.LocalPdfManager = LocalPdfManager;
|
272
|
+
|
273
|
+
var NetworkPdfManager =
|
274
|
+
/*#__PURE__*/
|
275
|
+
function (_BasePdfManager2) {
|
245
276
|
_inherits(NetworkPdfManager, _BasePdfManager2);
|
246
277
|
|
247
278
|
function NetworkPdfManager(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) {
|
248
|
-
|
279
|
+
var _this2;
|
249
280
|
|
250
|
-
|
281
|
+
_classCallCheck(this, NetworkPdfManager);
|
251
282
|
|
283
|
+
_this2 = _possibleConstructorReturn(this, _getPrototypeOf(NetworkPdfManager).call(this));
|
252
284
|
_this2._docId = docId;
|
253
285
|
_this2._password = args.password;
|
254
286
|
_this2._docBaseUrl = docBaseUrl;
|
@@ -256,21 +288,22 @@ var NetworkPdfManager = function (_BasePdfManager2) {
|
|
256
288
|
_this2.evaluatorOptions = evaluatorOptions;
|
257
289
|
_this2.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
|
258
290
|
msgHandler: args.msgHandler,
|
259
|
-
url: args.url,
|
260
291
|
length: args.length,
|
261
292
|
disableAutoFetch: args.disableAutoFetch,
|
262
293
|
rangeChunkSize: args.rangeChunkSize
|
263
294
|
});
|
264
|
-
_this2.pdfDocument = new _document.PDFDocument(_this2, _this2.streamManager.getStream());
|
295
|
+
_this2.pdfDocument = new _document.PDFDocument(_assertThisInitialized(_assertThisInitialized(_this2)), _this2.streamManager.getStream());
|
265
296
|
return _this2;
|
266
297
|
}
|
267
298
|
|
268
299
|
_createClass(NetworkPdfManager, [{
|
269
|
-
key:
|
300
|
+
key: "ensure",
|
270
301
|
value: function () {
|
271
|
-
var
|
302
|
+
var _ensure3 = _asyncToGenerator(
|
303
|
+
/*#__PURE__*/
|
304
|
+
_regenerator.default.mark(function _callee3(obj, prop, args) {
|
272
305
|
var value;
|
273
|
-
return
|
306
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
274
307
|
while (1) {
|
275
308
|
switch (_context3.prev = _context3.next) {
|
276
309
|
case 0:
|
@@ -282,14 +315,14 @@ var NetworkPdfManager = function (_BasePdfManager2) {
|
|
282
315
|
break;
|
283
316
|
}
|
284
317
|
|
285
|
-
return _context3.abrupt(
|
318
|
+
return _context3.abrupt("return", value.apply(obj, args));
|
286
319
|
|
287
320
|
case 4:
|
288
|
-
return _context3.abrupt(
|
321
|
+
return _context3.abrupt("return", value);
|
289
322
|
|
290
323
|
case 7:
|
291
324
|
_context3.prev = 7;
|
292
|
-
_context3.t0 = _context3[
|
325
|
+
_context3.t0 = _context3["catch"](0);
|
293
326
|
|
294
327
|
if (_context3.t0 instanceof _util.MissingDataException) {
|
295
328
|
_context3.next = 11;
|
@@ -303,10 +336,10 @@ var NetworkPdfManager = function (_BasePdfManager2) {
|
|
303
336
|
return this.requestRange(_context3.t0.begin, _context3.t0.end);
|
304
337
|
|
305
338
|
case 13:
|
306
|
-
return _context3.abrupt(
|
339
|
+
return _context3.abrupt("return", this.ensure(obj, prop, args));
|
307
340
|
|
308
341
|
case 14:
|
309
|
-
case
|
342
|
+
case "end":
|
310
343
|
return _context3.stop();
|
311
344
|
}
|
312
345
|
}
|
@@ -314,33 +347,35 @@ var NetworkPdfManager = function (_BasePdfManager2) {
|
|
314
347
|
}));
|
315
348
|
|
316
349
|
function ensure(_x7, _x8, _x9) {
|
317
|
-
return
|
350
|
+
return _ensure3.apply(this, arguments);
|
318
351
|
}
|
319
352
|
|
320
353
|
return ensure;
|
321
354
|
}()
|
322
355
|
}, {
|
323
|
-
key:
|
356
|
+
key: "requestRange",
|
324
357
|
value: function requestRange(begin, end) {
|
325
358
|
return this.streamManager.requestRange(begin, end);
|
326
359
|
}
|
327
360
|
}, {
|
328
|
-
key:
|
361
|
+
key: "requestLoadedStream",
|
329
362
|
value: function requestLoadedStream() {
|
330
363
|
this.streamManager.requestAllChunks();
|
331
364
|
}
|
332
365
|
}, {
|
333
|
-
key:
|
366
|
+
key: "sendProgressiveData",
|
334
367
|
value: function sendProgressiveData(chunk) {
|
335
|
-
this.streamManager.onReceiveData({
|
368
|
+
this.streamManager.onReceiveData({
|
369
|
+
chunk: chunk
|
370
|
+
});
|
336
371
|
}
|
337
372
|
}, {
|
338
|
-
key:
|
373
|
+
key: "onLoadedStream",
|
339
374
|
value: function onLoadedStream() {
|
340
375
|
return this.streamManager.onLoadedStream();
|
341
376
|
}
|
342
377
|
}, {
|
343
|
-
key:
|
378
|
+
key: "terminate",
|
344
379
|
value: function terminate() {
|
345
380
|
this.streamManager.abort();
|
346
381
|
}
|
@@ -349,5 +384,4 @@ var NetworkPdfManager = function (_BasePdfManager2) {
|
|
349
384
|
return NetworkPdfManager;
|
350
385
|
}(BasePdfManager);
|
351
386
|
|
352
|
-
exports.LocalPdfManager = LocalPdfManager;
|
353
387
|
exports.NetworkPdfManager = NetworkPdfManager;
|