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.

Files changed (192) hide show
  1. package/CODE_OF_CONDUCT.md +15 -0
  2. package/README.md +4 -0
  3. package/bower.json +1 -1
  4. package/build/pdf.js +8286 -14230
  5. package/build/pdf.js.map +1 -1
  6. package/build/pdf.min.js +22 -1
  7. package/build/pdf.worker.entry.js +5 -3
  8. package/build/pdf.worker.js +25500 -26628
  9. package/build/pdf.worker.js.map +1 -1
  10. package/build/pdf.worker.min.js +22 -1
  11. package/es5/build/pdf.js +25473 -0
  12. package/es5/build/pdf.js.map +1 -0
  13. package/{lib/shared/global_scope.js → es5/build/pdf.worker.entry.js} +5 -10
  14. package/es5/build/pdf.worker.js +57878 -0
  15. package/es5/build/pdf.worker.js.map +1 -0
  16. package/es5/web/images/annotation-check.svg +11 -0
  17. package/es5/web/images/annotation-comment.svg +16 -0
  18. package/es5/web/images/annotation-help.svg +26 -0
  19. package/es5/web/images/annotation-insert.svg +10 -0
  20. package/es5/web/images/annotation-key.svg +11 -0
  21. package/es5/web/images/annotation-newparagraph.svg +11 -0
  22. package/es5/web/images/annotation-noicon.svg +7 -0
  23. package/es5/web/images/annotation-note.svg +42 -0
  24. package/es5/web/images/annotation-paragraph.svg +16 -0
  25. package/es5/web/images/loading-icon.gif +0 -0
  26. package/es5/web/images/shadow.png +0 -0
  27. package/es5/web/images/texture.png +0 -0
  28. package/es5/web/pdf_viewer.css +407 -0
  29. package/es5/web/pdf_viewer.js +7757 -0
  30. package/es5/web/pdf_viewer.js.map +1 -0
  31. package/image_decoders/pdf.image_decoders.js +2887 -4094
  32. package/image_decoders/pdf.image_decoders.js.map +1 -1
  33. package/image_decoders/pdf.image_decoders.min.js +22 -1
  34. package/lib/README.md +7 -0
  35. package/lib/core/annotation.js +855 -778
  36. package/lib/core/arithmetic_decoder.js +325 -311
  37. package/lib/core/bidi.js +117 -50
  38. package/lib/core/ccitt.js +251 -89
  39. package/lib/core/ccitt_stream.js +26 -16
  40. package/lib/core/cff_parser.js +525 -197
  41. package/lib/core/charsets.js +6 -5
  42. package/lib/core/chunked_stream.js +541 -406
  43. package/lib/core/cmap.js +368 -253
  44. package/lib/core/colorspace.js +781 -800
  45. package/lib/core/core_utils.js +152 -0
  46. package/lib/core/crypto.js +609 -422
  47. package/lib/core/document.js +649 -481
  48. package/lib/core/encodings.js +33 -24
  49. package/lib/core/evaluator.js +1471 -736
  50. package/lib/core/font_renderer.js +289 -149
  51. package/lib/core/fonts.js +1067 -413
  52. package/lib/core/function.js +517 -287
  53. package/lib/core/glyphlist.js +4529 -4527
  54. package/lib/core/image.js +232 -114
  55. package/lib/core/image_utils.js +94 -0
  56. package/lib/core/jbig2.js +711 -342
  57. package/lib/core/jbig2_stream.js +31 -19
  58. package/lib/core/jpeg_stream.js +151 -26
  59. package/lib/core/jpg.js +433 -181
  60. package/lib/core/jpx.js +551 -143
  61. package/lib/core/jpx_stream.js +40 -28
  62. package/lib/core/metrics.js +2931 -2931
  63. package/lib/core/murmurhash3.js +104 -97
  64. package/lib/core/obj.js +1561 -1053
  65. package/lib/core/operator_list.js +192 -64
  66. package/lib/core/parser.js +1162 -864
  67. package/lib/core/pattern.js +224 -75
  68. package/lib/core/pdf_manager.js +154 -285
  69. package/lib/core/primitives.js +145 -69
  70. package/lib/core/ps_parser.js +212 -162
  71. package/lib/core/standard_fonts.js +245 -244
  72. package/lib/core/stream.js +353 -81
  73. package/lib/core/type1_parser.js +218 -68
  74. package/lib/core/unicode.js +1682 -1655
  75. package/lib/core/worker.js +233 -302
  76. package/lib/core/worker_stream.js +168 -0
  77. package/lib/display/annotation_layer.js +808 -862
  78. package/lib/display/api.js +1778 -1462
  79. package/lib/display/api_compatibility.js +14 -9
  80. package/lib/display/canvas.js +463 -140
  81. package/lib/display/content_disposition.js +86 -58
  82. package/lib/display/display_utils.js +524 -0
  83. package/lib/display/fetch_stream.js +202 -274
  84. package/lib/display/font_loader.js +311 -333
  85. package/lib/display/metadata.js +98 -88
  86. package/lib/display/network.js +343 -347
  87. package/lib/display/network_utils.js +46 -26
  88. package/lib/display/node_stream.js +326 -404
  89. package/lib/display/pattern_helper.js +168 -69
  90. package/lib/display/svg.js +1296 -885
  91. package/lib/display/text_layer.js +229 -103
  92. package/lib/display/transport_stream.js +290 -250
  93. package/lib/display/webgl.js +116 -83
  94. package/lib/display/worker_options.js +6 -5
  95. package/lib/display/xml_parser.js +358 -337
  96. package/lib/examples/node/domstubs.js +95 -39
  97. package/lib/pdf.js +49 -31
  98. package/lib/pdf.worker.js +7 -5
  99. package/lib/shared/compatibility.js +3 -145
  100. package/lib/shared/is_node.js +8 -7
  101. package/lib/shared/message_handler.js +367 -314
  102. package/lib/shared/util.js +421 -415
  103. package/lib/test/unit/annotation_spec.js +1570 -690
  104. package/lib/test/unit/api_spec.js +855 -493
  105. package/lib/test/unit/bidi_spec.js +12 -12
  106. package/lib/test/unit/cff_parser_spec.js +88 -61
  107. package/lib/test/unit/clitests_helper.js +9 -12
  108. package/lib/test/unit/cmap_spec.js +140 -88
  109. package/lib/test/unit/colorspace_spec.js +204 -152
  110. package/lib/test/unit/core_utils_spec.js +211 -0
  111. package/lib/test/unit/crypto_spec.js +194 -182
  112. package/lib/test/unit/custom_spec.js +50 -64
  113. package/lib/test/unit/display_svg_spec.js +53 -38
  114. package/lib/test/unit/display_utils_spec.js +263 -0
  115. package/lib/test/unit/document_spec.js +17 -22
  116. package/lib/test/unit/encodings_spec.js +15 -57
  117. package/lib/test/unit/evaluator_spec.js +90 -83
  118. package/lib/test/unit/fetch_stream_spec.js +111 -0
  119. package/lib/test/unit/function_spec.js +219 -205
  120. package/lib/test/unit/jasmine-boot.js +68 -39
  121. package/lib/test/unit/message_handler_spec.js +187 -160
  122. package/lib/test/unit/metadata_spec.js +87 -34
  123. package/lib/test/unit/murmurhash3_spec.js +13 -13
  124. package/lib/test/unit/network_spec.js +26 -59
  125. package/lib/test/unit/network_utils_spec.js +187 -121
  126. package/lib/test/unit/node_stream_spec.js +98 -90
  127. package/lib/test/unit/parser_spec.js +173 -131
  128. package/lib/test/unit/pdf_find_controller_spec.js +148 -67
  129. package/lib/test/unit/pdf_find_utils_spec.js +35 -34
  130. package/lib/test/unit/pdf_history_spec.js +45 -33
  131. package/lib/test/unit/primitives_spec.js +161 -126
  132. package/lib/test/unit/stream_spec.js +22 -15
  133. package/lib/test/unit/test_utils.js +149 -98
  134. package/lib/test/unit/testreporter.js +36 -18
  135. package/lib/test/unit/type1_parser_spec.js +46 -44
  136. package/lib/test/unit/ui_utils_spec.js +388 -372
  137. package/lib/test/unit/unicode_spec.js +49 -46
  138. package/lib/test/unit/util_spec.js +144 -248
  139. package/lib/web/annotation_layer_builder.js +75 -95
  140. package/lib/web/app.js +1538 -1147
  141. package/lib/web/app_options.js +116 -104
  142. package/lib/web/base_viewer.js +950 -775
  143. package/lib/web/chromecom.js +217 -225
  144. package/lib/web/debugger.js +236 -148
  145. package/lib/web/download_manager.js +50 -50
  146. package/lib/web/firefox_print_service.js +51 -33
  147. package/lib/web/firefoxcom.js +225 -352
  148. package/lib/web/genericcom.js +30 -93
  149. package/lib/web/genericl10n.js +26 -143
  150. package/lib/web/grab_to_pan.js +57 -33
  151. package/lib/web/interfaces.js +105 -232
  152. package/lib/web/overlay_manager.js +73 -227
  153. package/lib/web/password_prompt.js +44 -62
  154. package/lib/web/pdf_attachment_viewer.js +118 -123
  155. package/lib/web/pdf_cursor_tools.js +89 -93
  156. package/lib/web/pdf_document_properties.js +242 -281
  157. package/lib/web/pdf_find_bar.js +157 -163
  158. package/lib/web/pdf_find_controller.js +598 -454
  159. package/lib/web/pdf_find_utils.js +32 -16
  160. package/lib/web/pdf_history.js +481 -355
  161. package/lib/web/pdf_link_service.js +355 -323
  162. package/lib/web/pdf_outline_viewer.js +167 -152
  163. package/lib/web/pdf_page_view.js +511 -457
  164. package/lib/web/pdf_presentation_mode.js +347 -335
  165. package/lib/web/pdf_print_service.js +133 -103
  166. package/lib/web/pdf_rendering_queue.js +98 -100
  167. package/lib/web/pdf_sidebar.js +323 -299
  168. package/lib/web/pdf_sidebar_resizer.js +107 -108
  169. package/lib/web/pdf_single_page_viewer.js +94 -146
  170. package/lib/web/pdf_thumbnail_view.js +319 -269
  171. package/lib/web/pdf_thumbnail_viewer.js +219 -199
  172. package/lib/web/pdf_viewer.component.js +111 -32
  173. package/lib/web/pdf_viewer.js +61 -101
  174. package/lib/web/preferences.js +87 -272
  175. package/lib/web/secondary_toolbar.js +207 -220
  176. package/lib/web/text_layer_builder.js +322 -322
  177. package/lib/web/toolbar.js +227 -180
  178. package/lib/web/ui_utils.js +476 -421
  179. package/lib/web/view_history.js +59 -208
  180. package/lib/web/viewer_compatibility.js +9 -6
  181. package/package.json +2 -9
  182. package/web/pdf_viewer.css +36 -22
  183. package/web/pdf_viewer.js +4407 -4516
  184. package/web/pdf_viewer.js.map +1 -1
  185. package/webpack.js +14 -5
  186. package/external/streams/streams-lib.js +0 -3962
  187. package/external/url/url-lib.js +0 -627
  188. package/lib/display/dom_utils.js +0 -441
  189. package/lib/shared/streams_polyfill.js +0 -39
  190. package/lib/shared/url_polyfill.js +0 -50
  191. package/lib/test/unit/dom_utils_spec.js +0 -89
  192. package/lib/web/dom_events.js +0 -140
@@ -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 2018 Mozilla Foundation
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
- 'use strict';
22
+ "use strict";
23
23
 
24
24
  Object.defineProperty(exports, "__esModule", {
25
25
  value: true
26
26
  });
27
- exports.NetworkPdfManager = exports.LocalPdfManager = undefined;
27
+ exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
28
28
 
29
- var _regenerator = require('babel-runtime/regenerator');
29
+ var _util = require("../shared/util.js");
30
30
 
31
- var _regenerator2 = _interopRequireDefault(_regenerator);
31
+ var _chunked_stream = require("./chunked_stream.js");
32
32
 
33
- var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
33
+ var _core_utils = require("./core_utils.js");
34
34
 
35
- var _util = require('../shared/util');
35
+ var _document = require("./document.js");
36
36
 
37
- var _chunked_stream = require('./chunked_stream');
37
+ var _stream = require("./stream.js");
38
38
 
39
- var _document = require('./document');
39
+ class BasePdfManager {
40
+ constructor() {
41
+ if (this.constructor === BasePdfManager) {
42
+ (0, _util.unreachable)("Cannot initialize BasePdfManager.");
43
+ }
44
+ }
40
45
 
41
- var _stream = require('./stream');
46
+ get docId() {
47
+ return this._docId;
48
+ }
42
49
 
43
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
50
+ get password() {
51
+ return this._password;
52
+ }
44
53
 
45
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
54
+ get docBaseUrl() {
55
+ let docBaseUrl = null;
46
56
 
47
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
57
+ if (this._docBaseUrl) {
58
+ const absoluteUrl = (0, _util.createValidAbsoluteUrl)(this._docBaseUrl);
48
59
 
49
- function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
60
+ if (absoluteUrl) {
61
+ docBaseUrl = absoluteUrl.href;
62
+ } else {
63
+ (0, _util.warn)(`Invalid absolute docBaseUrl: "${this._docBaseUrl}".`);
64
+ }
65
+ }
50
66
 
51
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
67
+ return (0, _util.shadow)(this, "docBaseUrl", docBaseUrl);
68
+ }
52
69
 
53
- var BasePdfManager = function () {
54
- function BasePdfManager() {
55
- _classCallCheck(this, BasePdfManager);
70
+ onLoadedStream() {
71
+ (0, _util.unreachable)("Abstract method `onLoadedStream` called");
72
+ }
56
73
 
57
- if (this.constructor === BasePdfManager) {
58
- (0, _util.unreachable)('Cannot initialize BasePdfManager.');
59
- }
74
+ ensureDoc(prop, args) {
75
+ return this.ensure(this.pdfDocument, prop, args);
60
76
  }
61
77
 
62
- _createClass(BasePdfManager, [{
63
- key: 'onLoadedStream',
64
- value: function onLoadedStream() {
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
- return ensure;
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
- return BasePdfManager;
168
- }();
86
+ getPage(pageIndex) {
87
+ return this.pdfDocument.getPage(pageIndex);
88
+ }
169
89
 
170
- var LocalPdfManager = function (_BasePdfManager) {
171
- _inherits(LocalPdfManager, _BasePdfManager);
90
+ fontFallback(id, handler) {
91
+ return this.pdfDocument.fontFallback(id, handler);
92
+ }
172
93
 
173
- function LocalPdfManager(docId, data, password, evaluatorOptions, docBaseUrl) {
174
- _classCallCheck(this, LocalPdfManager);
94
+ cleanup() {
95
+ return this.pdfDocument.cleanup();
96
+ }
175
97
 
176
- var _this = _possibleConstructorReturn(this, (LocalPdfManager.__proto__ || Object.getPrototypeOf(LocalPdfManager)).call(this));
98
+ async ensure(obj, prop, args) {
99
+ (0, _util.unreachable)("Abstract method `ensure` called");
100
+ }
177
101
 
178
- _this._docId = docId;
179
- _this._password = password;
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
- _createClass(LocalPdfManager, [{
189
- key: 'ensure',
190
- value: function () {
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
- return ensure;
222
- }()
223
- }, {
224
- key: 'requestRange',
225
- value: function requestRange(begin, end) {
226
- return Promise.resolve();
227
- }
228
- }, {
229
- key: 'requestLoadedStream',
230
- value: function requestLoadedStream() {}
231
- }, {
232
- key: 'onLoadedStream',
233
- value: function onLoadedStream() {
234
- return this._loadedStreamPromise;
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
- return LocalPdfManager;
242
- }(BasePdfManager);
143
+ return value;
144
+ }
145
+
146
+ requestRange(begin, end) {
147
+ return Promise.resolve();
148
+ }
243
149
 
244
- var NetworkPdfManager = function (_BasePdfManager2) {
245
- _inherits(NetworkPdfManager, _BasePdfManager2);
150
+ requestLoadedStream() {}
151
+
152
+ onLoadedStream() {
153
+ return this._loadedStreamPromise;
154
+ }
246
155
 
247
- function NetworkPdfManager(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) {
248
- _classCallCheck(this, NetworkPdfManager);
156
+ terminate(reason) {}
249
157
 
250
- var _this2 = _possibleConstructorReturn(this, (NetworkPdfManager.__proto__ || Object.getPrototypeOf(NetworkPdfManager)).call(this));
158
+ }
251
159
 
252
- _this2._docId = docId;
253
- _this2._password = args.password;
254
- _this2._docBaseUrl = docBaseUrl;
255
- _this2.msgHandler = args.msgHandler;
256
- _this2.evaluatorOptions = evaluatorOptions;
257
- _this2.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
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
- _this2.pdfDocument = new _document.PDFDocument(_this2, _this2.streamManager.getStream());
265
- return _this2;
176
+ this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
266
177
  }
267
178
 
268
- _createClass(NetworkPdfManager, [{
269
- key: 'ensure',
270
- value: function () {
271
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regenerator2.default.mark(function _callee3(obj, prop, args) {
272
- var value;
273
- return _regenerator2.default.wrap(function _callee3$(_context3) {
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 ensure;
321
- }()
322
- }, {
323
- key: 'requestRange',
324
- value: function requestRange(begin, end) {
325
- return this.streamManager.requestRange(begin, end);
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
- return NetworkPdfManager;
350
- }(BasePdfManager);
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;