pdfjs-dist 2.1.266 → 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 +3349 -2324
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +1 -1
- package/build/pdf.worker.js +2804 -1975
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +1 -1
- package/image_decoders/pdf.image_decoders.js +431 -511
- 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 +294 -224
- package/lib/core/arithmetic_decoder.js +1 -1
- package/lib/core/bidi.js +1 -1
- package/lib/core/ccitt.js +1 -1
- package/lib/core/ccitt_stream.js +1 -1
- package/lib/core/cff_parser.js +61 -12
- package/lib/core/charsets.js +1 -1
- package/lib/core/chunked_stream.js +24 -14
- package/lib/core/cmap.js +17 -13
- package/lib/core/colorspace.js +1 -1
- package/lib/core/core_utils.js +147 -0
- package/lib/core/crypto.js +1 -1
- package/lib/core/document.js +47 -40
- package/lib/core/encodings.js +1 -1
- package/lib/core/evaluator.js +346 -279
- package/lib/core/font_renderer.js +1 -1
- package/lib/core/fonts.js +23 -11
- package/lib/core/function.js +1 -1
- package/lib/core/glyphlist.js +2 -2
- package/lib/core/image.js +2 -2
- package/lib/core/image_utils.js +111 -0
- package/lib/core/jbig2.js +1 -1
- package/lib/core/jbig2_stream.js +1 -1
- package/lib/core/jpeg_stream.js +1 -1
- package/lib/core/jpg.js +2 -1
- package/lib/core/jpx.js +1 -1
- package/lib/core/jpx_stream.js +1 -1
- package/lib/core/metrics.js +13 -13
- package/lib/core/murmurhash3.js +37 -33
- package/lib/core/obj.js +245 -41
- package/lib/core/operator_list.js +43 -32
- package/lib/core/parser.js +228 -133
- package/lib/core/pattern.js +4 -2
- package/lib/core/pdf_manager.js +17 -15
- package/lib/core/primitives.js +40 -6
- package/lib/core/ps_parser.js +1 -1
- package/lib/core/standard_fonts.js +9 -9
- package/lib/core/stream.js +1 -1
- package/lib/core/type1_parser.js +1 -1
- package/lib/core/unicode.js +2 -2
- package/lib/core/worker.js +54 -171
- package/lib/core/worker_stream.js +277 -0
- package/lib/display/annotation_layer.js +112 -33
- package/lib/display/api.js +211 -123
- package/lib/display/api_compatibility.js +1 -1
- package/lib/display/canvas.js +40 -19
- package/lib/display/content_disposition.js +1 -1
- package/lib/display/display_utils.js +747 -0
- package/lib/display/fetch_stream.js +19 -12
- package/lib/display/font_loader.js +11 -8
- package/lib/display/metadata.js +1 -1
- package/lib/display/network.js +563 -521
- package/lib/display/network_utils.js +1 -1
- package/lib/display/node_stream.js +21 -12
- package/lib/display/pattern_helper.js +24 -25
- package/lib/display/svg.js +1068 -565
- package/lib/display/text_layer.js +24 -14
- package/lib/display/transport_stream.js +192 -70
- package/lib/display/webgl.js +1 -1
- package/lib/display/worker_options.js +1 -1
- package/lib/display/xml_parser.js +1 -1
- package/lib/examples/node/domstubs.js +4 -1
- package/lib/pdf.js +20 -15
- package/lib/pdf.worker.js +3 -3
- package/lib/shared/compatibility.js +6 -6
- package/lib/shared/global_scope.js +1 -1
- package/lib/shared/is_node.js +2 -2
- package/lib/shared/message_handler.js +7 -7
- package/lib/shared/streams_polyfill.js +1 -1
- package/lib/shared/url_polyfill.js +1 -1
- package/lib/shared/util.js +13 -125
- package/lib/test/unit/annotation_spec.js +278 -93
- package/lib/test/unit/api_spec.js +198 -188
- package/lib/test/unit/bidi_spec.js +1 -1
- package/lib/test/unit/cff_parser_spec.js +15 -1
- package/lib/test/unit/clitests_helper.js +3 -3
- package/lib/test/unit/cmap_spec.js +20 -20
- package/lib/test/unit/colorspace_spec.js +17 -12
- package/lib/test/unit/core_utils_spec.js +191 -0
- package/lib/test/unit/crypto_spec.js +1 -1
- package/lib/test/unit/custom_spec.js +8 -8
- package/lib/test/unit/display_svg_spec.js +8 -8
- package/lib/test/unit/display_utils_spec.js +273 -0
- package/lib/test/unit/document_spec.js +7 -12
- package/lib/test/unit/encodings_spec.js +5 -5
- package/lib/test/unit/evaluator_spec.js +8 -10
- package/lib/test/unit/fetch_stream_spec.js +109 -0
- package/lib/test/unit/function_spec.js +1 -1
- package/lib/test/unit/jasmine-boot.js +4 -4
- package/lib/test/unit/message_handler_spec.js +1 -1
- package/lib/test/unit/metadata_spec.js +1 -1
- package/lib/test/unit/murmurhash3_spec.js +1 -1
- package/lib/test/unit/network_spec.js +5 -55
- package/lib/test/unit/network_utils_spec.js +51 -1
- package/lib/test/unit/node_stream_spec.js +8 -8
- package/lib/test/unit/parser_spec.js +150 -86
- package/lib/test/unit/pdf_find_controller_spec.js +1 -1
- package/lib/test/unit/pdf_find_utils_spec.js +1 -1
- package/lib/test/unit/pdf_history_spec.js +1 -1
- package/lib/test/unit/primitives_spec.js +30 -17
- package/lib/test/unit/stream_spec.js +1 -1
- package/lib/test/unit/test_utils.js +197 -43
- package/lib/test/unit/testreporter.js +1 -1
- package/lib/test/unit/type1_parser_spec.js +1 -1
- package/lib/test/unit/ui_utils_spec.js +20 -20
- package/lib/test/unit/unicode_spec.js +5 -5
- package/lib/test/unit/util_spec.js +1 -164
- package/lib/web/annotation_layer_builder.js +1 -1
- package/lib/web/app.js +104 -60
- package/lib/web/app_options.js +45 -37
- package/lib/web/base_viewer.js +7 -7
- package/lib/web/chromecom.js +8 -8
- package/lib/web/debugger.js +7 -7
- package/lib/web/download_manager.js +3 -2
- package/lib/web/firefox_print_service.js +4 -2
- package/lib/web/firefoxcom.js +50 -19
- package/lib/web/genericcom.js +8 -8
- package/lib/web/genericl10n.js +10 -10
- package/lib/web/grab_to_pan.js +3 -1
- package/lib/web/interfaces.js +13 -13
- package/lib/web/overlay_manager.js +10 -10
- package/lib/web/password_prompt.js +2 -2
- package/lib/web/pdf_attachment_viewer.js +1 -1
- package/lib/web/pdf_cursor_tools.js +1 -1
- package/lib/web/pdf_document_properties.js +188 -119
- package/lib/web/pdf_find_bar.js +1 -1
- package/lib/web/pdf_find_controller.js +3 -3
- package/lib/web/pdf_find_utils.js +1 -1
- package/lib/web/pdf_history.js +1 -1
- package/lib/web/pdf_link_service.js +2 -2
- package/lib/web/pdf_outline_viewer.js +53 -28
- package/lib/web/pdf_page_view.js +9 -18
- package/lib/web/pdf_presentation_mode.js +1 -1
- package/lib/web/pdf_print_service.js +5 -3
- package/lib/web/pdf_rendering_queue.js +4 -7
- package/lib/web/pdf_sidebar.js +24 -17
- package/lib/web/pdf_sidebar_resizer.js +1 -1
- package/lib/web/pdf_single_page_viewer.js +1 -1
- package/lib/web/pdf_thumbnail_view.js +2 -2
- package/lib/web/pdf_thumbnail_viewer.js +3 -3
- package/lib/web/pdf_viewer.component.js +3 -3
- package/lib/web/pdf_viewer.js +3 -3
- package/lib/web/preferences.js +30 -30
- package/lib/web/secondary_toolbar.js +1 -1
- package/lib/web/text_layer_builder.js +23 -45
- package/lib/web/toolbar.js +1 -1
- package/lib/web/ui_utils.js +14 -14
- package/lib/web/view_history.js +15 -15
- package/lib/web/viewer_compatibility.js +1 -1
- package/package.json +1 -1
- package/web/pdf_viewer.css +21 -10
- package/web/pdf_viewer.js +126 -194
- package/web/pdf_viewer.js.map +1 -1
- package/lib/display/dom_utils.js +0 -494
- package/lib/test/unit/dom_utils_spec.js +0 -89
@@ -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.
|
@@ -30,7 +30,7 @@ var _util = require("../shared/util");
|
|
30
30
|
|
31
31
|
var _global_scope = _interopRequireDefault(require("../shared/global_scope"));
|
32
32
|
|
33
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
33
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
34
34
|
|
35
35
|
var renderTextLayer = function renderTextLayerClosure() {
|
36
36
|
var MAX_TEXT_DIVS_TO_RENDER = 100000;
|
@@ -449,6 +449,8 @@ var renderTextLayer = function renderTextLayerClosure() {
|
|
449
449
|
}
|
450
450
|
|
451
451
|
function TextLayerRenderTask(_ref) {
|
452
|
+
var _this = this;
|
453
|
+
|
452
454
|
var textContent = _ref.textContent,
|
453
455
|
textContentStream = _ref.textContentStream,
|
454
456
|
container = _ref.container,
|
@@ -463,7 +465,7 @@ var renderTextLayer = function renderTextLayerClosure() {
|
|
463
465
|
this._textDivs = textDivs || [];
|
464
466
|
this._textContentItemsStr = textContentItemsStr || [];
|
465
467
|
this._enhanceTextSelection = !!enhanceTextSelection;
|
466
|
-
this._fontInspectorEnabled = !!(_global_scope
|
468
|
+
this._fontInspectorEnabled = !!(_global_scope["default"].FontInspector && _global_scope["default"].FontInspector.enabled);
|
467
469
|
this._reader = null;
|
468
470
|
this._layoutTextLastFontSize = null;
|
469
471
|
this._layoutTextLastFontFamily = null;
|
@@ -474,6 +476,14 @@ var renderTextLayer = function renderTextLayerClosure() {
|
|
474
476
|
this._capability = (0, _util.createPromiseCapability)();
|
475
477
|
this._renderTimer = null;
|
476
478
|
this._bounds = [];
|
479
|
+
|
480
|
+
this._capability.promise["finally"](function () {
|
481
|
+
if (_this._layoutTextCtx) {
|
482
|
+
_this._layoutTextCtx.canvas.width = 0;
|
483
|
+
_this._layoutTextCtx.canvas.height = 0;
|
484
|
+
_this._layoutTextCtx = null;
|
485
|
+
}
|
486
|
+
});
|
477
487
|
}
|
478
488
|
|
479
489
|
TextLayerRenderTask.prototype = {
|
@@ -482,20 +492,20 @@ var renderTextLayer = function renderTextLayerClosure() {
|
|
482
492
|
},
|
483
493
|
|
484
494
|
cancel: function TextLayer_cancel() {
|
495
|
+
this._canceled = true;
|
496
|
+
|
485
497
|
if (this._reader) {
|
486
|
-
this._reader.cancel(new _util.AbortException('
|
498
|
+
this._reader.cancel(new _util.AbortException('TextLayer task cancelled.'));
|
487
499
|
|
488
500
|
this._reader = null;
|
489
501
|
}
|
490
502
|
|
491
|
-
this._canceled = true;
|
492
|
-
|
493
503
|
if (this._renderTimer !== null) {
|
494
504
|
clearTimeout(this._renderTimer);
|
495
505
|
this._renderTimer = null;
|
496
506
|
}
|
497
507
|
|
498
|
-
this._capability.reject('
|
508
|
+
this._capability.reject(new Error('TextLayer task cancelled.'));
|
499
509
|
},
|
500
510
|
_processItems: function _processItems(items, styleCache) {
|
501
511
|
for (var i = 0, len = items.length; i < len; i++) {
|
@@ -545,7 +555,7 @@ var renderTextLayer = function renderTextLayerClosure() {
|
|
545
555
|
textLayerFrag.appendChild(textDiv);
|
546
556
|
},
|
547
557
|
_render: function TextLayer_render(timeout) {
|
548
|
-
var
|
558
|
+
var _this2 = this;
|
549
559
|
|
550
560
|
var capability = (0, _util.createPromiseCapability)();
|
551
561
|
var styleCache = Object.create(null);
|
@@ -564,7 +574,7 @@ var renderTextLayer = function renderTextLayerClosure() {
|
|
564
574
|
capability.resolve();
|
565
575
|
} else if (this._textContentStream) {
|
566
576
|
var pump = function pump() {
|
567
|
-
|
577
|
+
_this2._reader.read().then(function (_ref2) {
|
568
578
|
var value = _ref2.value,
|
569
579
|
done = _ref2.done;
|
570
580
|
|
@@ -575,7 +585,7 @@ var renderTextLayer = function renderTextLayerClosure() {
|
|
575
585
|
|
576
586
|
Object.assign(styleCache, value.styles);
|
577
587
|
|
578
|
-
|
588
|
+
_this2._processItems(value.items, styleCache);
|
579
589
|
|
580
590
|
pump();
|
581
591
|
}, capability.reject);
|
@@ -591,11 +601,11 @@ var renderTextLayer = function renderTextLayerClosure() {
|
|
591
601
|
styleCache = null;
|
592
602
|
|
593
603
|
if (!timeout) {
|
594
|
-
render(
|
604
|
+
render(_this2);
|
595
605
|
} else {
|
596
|
-
|
597
|
-
render(
|
598
|
-
|
606
|
+
_this2._renderTimer = setTimeout(function () {
|
607
|
+
render(_this2);
|
608
|
+
_this2._renderTimer = null;
|
599
609
|
}, timeout);
|
600
610
|
}
|
601
611
|
}, this._capability.reject);
|
@@ -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.
|
@@ -36,12 +36,23 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
36
36
|
|
37
37
|
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); }); }; }
|
38
38
|
|
39
|
-
|
39
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
40
|
+
|
41
|
+
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); } }
|
42
|
+
|
43
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
44
|
+
|
45
|
+
var PDFDataTransportStream =
|
46
|
+
/*#__PURE__*/
|
47
|
+
function () {
|
40
48
|
function PDFDataTransportStream(params, pdfDataRangeTransport) {
|
41
49
|
var _this = this;
|
42
50
|
|
51
|
+
_classCallCheck(this, PDFDataTransportStream);
|
52
|
+
|
43
53
|
(0, _util.assert)(pdfDataRangeTransport);
|
44
54
|
this._queuedChunks = [];
|
55
|
+
this._progressiveDone = params.progressiveDone || false;
|
45
56
|
var initialData = params.initialData;
|
46
57
|
|
47
58
|
if (initialData && initialData.length > 0) {
|
@@ -64,9 +75,10 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
|
|
64
75
|
});
|
65
76
|
});
|
66
77
|
|
67
|
-
this._pdfDataRangeTransport.addProgressListener(function (loaded) {
|
78
|
+
this._pdfDataRangeTransport.addProgressListener(function (loaded, total) {
|
68
79
|
_this._onProgress({
|
69
|
-
loaded: loaded
|
80
|
+
loaded: loaded,
|
81
|
+
total: total
|
70
82
|
});
|
71
83
|
});
|
72
84
|
|
@@ -76,11 +88,16 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
|
|
76
88
|
});
|
77
89
|
});
|
78
90
|
|
91
|
+
this._pdfDataRangeTransport.addProgressiveDoneListener(function () {
|
92
|
+
_this._onProgressiveDone();
|
93
|
+
});
|
94
|
+
|
79
95
|
this._pdfDataRangeTransport.transportReady();
|
80
96
|
}
|
81
97
|
|
82
|
-
PDFDataTransportStream
|
83
|
-
|
98
|
+
_createClass(PDFDataTransportStream, [{
|
99
|
+
key: "_onReceiveData",
|
100
|
+
value: function _onReceiveData(args) {
|
84
101
|
var buffer = new Uint8Array(args.chunk).buffer;
|
85
102
|
|
86
103
|
if (args.begin === undefined) {
|
@@ -102,32 +119,62 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
|
|
102
119
|
|
103
120
|
(0, _util.assert)(found);
|
104
121
|
}
|
105
|
-
}
|
106
|
-
|
107
|
-
|
122
|
+
}
|
123
|
+
}, {
|
124
|
+
key: "_onProgress",
|
125
|
+
value: function _onProgress(evt) {
|
126
|
+
if (evt.total === undefined) {
|
108
127
|
var firstReader = this._rangeReaders[0];
|
109
128
|
|
110
|
-
if (firstReader.onProgress) {
|
129
|
+
if (firstReader && firstReader.onProgress) {
|
111
130
|
firstReader.onProgress({
|
112
131
|
loaded: evt.loaded
|
113
132
|
});
|
114
133
|
}
|
134
|
+
} else {
|
135
|
+
var fullReader = this._fullRequestReader;
|
136
|
+
|
137
|
+
if (fullReader && fullReader.onProgress) {
|
138
|
+
fullReader.onProgress({
|
139
|
+
loaded: evt.loaded,
|
140
|
+
total: evt.total
|
141
|
+
});
|
142
|
+
}
|
115
143
|
}
|
116
|
-
}
|
117
|
-
|
144
|
+
}
|
145
|
+
}, {
|
146
|
+
key: "_onProgressiveDone",
|
147
|
+
value: function _onProgressiveDone() {
|
148
|
+
if (this._fullRequestReader) {
|
149
|
+
this._fullRequestReader.progressiveDone();
|
150
|
+
}
|
151
|
+
|
152
|
+
this._progressiveDone = true;
|
153
|
+
}
|
154
|
+
}, {
|
155
|
+
key: "_removeRangeReader",
|
156
|
+
value: function _removeRangeReader(reader) {
|
118
157
|
var i = this._rangeReaders.indexOf(reader);
|
119
158
|
|
120
159
|
if (i >= 0) {
|
121
160
|
this._rangeReaders.splice(i, 1);
|
122
161
|
}
|
123
|
-
}
|
124
|
-
|
162
|
+
}
|
163
|
+
}, {
|
164
|
+
key: "getFullReader",
|
165
|
+
value: function getFullReader() {
|
125
166
|
(0, _util.assert)(!this._fullRequestReader);
|
126
167
|
var queuedChunks = this._queuedChunks;
|
127
168
|
this._queuedChunks = null;
|
128
|
-
return new PDFDataTransportStreamReader(this, queuedChunks);
|
129
|
-
}
|
130
|
-
|
169
|
+
return new PDFDataTransportStreamReader(this, queuedChunks, this._progressiveDone);
|
170
|
+
}
|
171
|
+
}, {
|
172
|
+
key: "getRangeReader",
|
173
|
+
value: function getRangeReader(begin, end) {
|
174
|
+
if (end <= this._progressiveDataLength) {
|
175
|
+
return null;
|
176
|
+
}
|
177
|
+
|
131
178
|
var reader = new PDFDataTransportStreamRangeReader(this, begin, end);
|
132
179
|
|
133
180
|
this._pdfDataRangeTransport.requestDataRange(begin, end);
|
@@ -135,8 +182,10 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
|
|
135
182
|
this._rangeReaders.push(reader);
|
136
183
|
|
137
184
|
return reader;
|
138
|
-
}
|
139
|
-
|
185
|
+
}
|
186
|
+
}, {
|
187
|
+
key: "cancelAllRequests",
|
188
|
+
value: function cancelAllRequests(reason) {
|
140
189
|
if (this._fullRequestReader) {
|
141
190
|
this._fullRequestReader.cancel(reason);
|
142
191
|
}
|
@@ -149,21 +198,64 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
|
|
149
198
|
|
150
199
|
this._pdfDataRangeTransport.abort();
|
151
200
|
}
|
152
|
-
}
|
201
|
+
}, {
|
202
|
+
key: "_progressiveDataLength",
|
203
|
+
get: function get() {
|
204
|
+
return this._fullRequestReader ? this._fullRequestReader._loaded : 0;
|
205
|
+
}
|
206
|
+
}]);
|
207
|
+
|
208
|
+
return PDFDataTransportStream;
|
209
|
+
}();
|
210
|
+
|
211
|
+
exports.PDFDataTransportStream = PDFDataTransportStream;
|
153
212
|
|
213
|
+
var PDFDataTransportStreamReader =
|
214
|
+
/*#__PURE__*/
|
215
|
+
function () {
|
154
216
|
function PDFDataTransportStreamReader(stream, queuedChunks) {
|
217
|
+
var progressiveDone = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
218
|
+
|
219
|
+
_classCallCheck(this, PDFDataTransportStreamReader);
|
220
|
+
|
155
221
|
this._stream = stream;
|
156
|
-
this._done = false;
|
222
|
+
this._done = progressiveDone || false;
|
157
223
|
this._filename = null;
|
158
224
|
this._queuedChunks = queuedChunks || [];
|
225
|
+
this._loaded = 0;
|
226
|
+
var _iteratorNormalCompletion = true;
|
227
|
+
var _didIteratorError = false;
|
228
|
+
var _iteratorError = undefined;
|
229
|
+
|
230
|
+
try {
|
231
|
+
for (var _iterator = this._queuedChunks[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
232
|
+
var chunk = _step.value;
|
233
|
+
this._loaded += chunk.byteLength;
|
234
|
+
}
|
235
|
+
} catch (err) {
|
236
|
+
_didIteratorError = true;
|
237
|
+
_iteratorError = err;
|
238
|
+
} finally {
|
239
|
+
try {
|
240
|
+
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
|
241
|
+
_iterator["return"]();
|
242
|
+
}
|
243
|
+
} finally {
|
244
|
+
if (_didIteratorError) {
|
245
|
+
throw _iteratorError;
|
246
|
+
}
|
247
|
+
}
|
248
|
+
}
|
249
|
+
|
159
250
|
this._requests = [];
|
160
251
|
this._headersReady = Promise.resolve();
|
161
252
|
stream._fullRequestReader = this;
|
162
253
|
this.onProgress = null;
|
163
254
|
}
|
164
255
|
|
165
|
-
PDFDataTransportStreamReader
|
166
|
-
|
256
|
+
_createClass(PDFDataTransportStreamReader, [{
|
257
|
+
key: "_enqueue",
|
258
|
+
value: function _enqueue(chunk) {
|
167
259
|
if (this._done) {
|
168
260
|
return;
|
169
261
|
}
|
@@ -175,38 +267,20 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
|
|
175
267
|
value: chunk,
|
176
268
|
done: false
|
177
269
|
});
|
178
|
-
|
270
|
+
} else {
|
271
|
+
this._queuedChunks.push(chunk);
|
179
272
|
}
|
180
273
|
|
181
|
-
this.
|
182
|
-
}
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
},
|
187
|
-
|
188
|
-
get filename() {
|
189
|
-
return this._filename;
|
190
|
-
},
|
191
|
-
|
192
|
-
get isRangeSupported() {
|
193
|
-
return this._stream._isRangeSupported;
|
194
|
-
},
|
195
|
-
|
196
|
-
get isStreamingSupported() {
|
197
|
-
return this._stream._isStreamingSupported;
|
198
|
-
},
|
199
|
-
|
200
|
-
get contentLength() {
|
201
|
-
return this._stream._contentLength;
|
202
|
-
},
|
203
|
-
|
204
|
-
read: function () {
|
274
|
+
this._loaded += chunk.byteLength;
|
275
|
+
}
|
276
|
+
}, {
|
277
|
+
key: "read",
|
278
|
+
value: function () {
|
205
279
|
var _read = _asyncToGenerator(
|
206
280
|
/*#__PURE__*/
|
207
|
-
_regenerator
|
281
|
+
_regenerator["default"].mark(function _callee() {
|
208
282
|
var chunk, requestCapability;
|
209
|
-
return _regenerator
|
283
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
210
284
|
while (1) {
|
211
285
|
switch (_context.prev = _context.next) {
|
212
286
|
case 0:
|
@@ -252,8 +326,10 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
|
|
252
326
|
}
|
253
327
|
|
254
328
|
return read;
|
255
|
-
}()
|
256
|
-
|
329
|
+
}()
|
330
|
+
}, {
|
331
|
+
key: "cancel",
|
332
|
+
value: function cancel(reason) {
|
257
333
|
this._done = true;
|
258
334
|
|
259
335
|
this._requests.forEach(function (requestCapability) {
|
@@ -265,9 +341,51 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
|
|
265
341
|
|
266
342
|
this._requests = [];
|
267
343
|
}
|
268
|
-
}
|
344
|
+
}, {
|
345
|
+
key: "progressiveDone",
|
346
|
+
value: function progressiveDone() {
|
347
|
+
if (this._done) {
|
348
|
+
return;
|
349
|
+
}
|
350
|
+
|
351
|
+
this._done = true;
|
352
|
+
}
|
353
|
+
}, {
|
354
|
+
key: "headersReady",
|
355
|
+
get: function get() {
|
356
|
+
return this._headersReady;
|
357
|
+
}
|
358
|
+
}, {
|
359
|
+
key: "filename",
|
360
|
+
get: function get() {
|
361
|
+
return this._filename;
|
362
|
+
}
|
363
|
+
}, {
|
364
|
+
key: "isRangeSupported",
|
365
|
+
get: function get() {
|
366
|
+
return this._stream._isRangeSupported;
|
367
|
+
}
|
368
|
+
}, {
|
369
|
+
key: "isStreamingSupported",
|
370
|
+
get: function get() {
|
371
|
+
return this._stream._isStreamingSupported;
|
372
|
+
}
|
373
|
+
}, {
|
374
|
+
key: "contentLength",
|
375
|
+
get: function get() {
|
376
|
+
return this._stream._contentLength;
|
377
|
+
}
|
378
|
+
}]);
|
379
|
+
|
380
|
+
return PDFDataTransportStreamReader;
|
381
|
+
}();
|
269
382
|
|
383
|
+
var PDFDataTransportStreamRangeReader =
|
384
|
+
/*#__PURE__*/
|
385
|
+
function () {
|
270
386
|
function PDFDataTransportStreamRangeReader(stream, begin, end) {
|
387
|
+
_classCallCheck(this, PDFDataTransportStreamRangeReader);
|
388
|
+
|
271
389
|
this._stream = stream;
|
272
390
|
this._begin = begin;
|
273
391
|
this._end = end;
|
@@ -277,8 +395,9 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
|
|
277
395
|
this.onProgress = null;
|
278
396
|
}
|
279
397
|
|
280
|
-
PDFDataTransportStreamRangeReader
|
281
|
-
|
398
|
+
_createClass(PDFDataTransportStreamRangeReader, [{
|
399
|
+
key: "_enqueue",
|
400
|
+
value: function _enqueue(chunk) {
|
282
401
|
if (this._done) {
|
283
402
|
return;
|
284
403
|
}
|
@@ -306,18 +425,15 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
|
|
306
425
|
this._done = true;
|
307
426
|
|
308
427
|
this._stream._removeRangeReader(this);
|
309
|
-
}
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
},
|
314
|
-
|
315
|
-
read: function () {
|
428
|
+
}
|
429
|
+
}, {
|
430
|
+
key: "read",
|
431
|
+
value: function () {
|
316
432
|
var _read2 = _asyncToGenerator(
|
317
433
|
/*#__PURE__*/
|
318
|
-
_regenerator
|
434
|
+
_regenerator["default"].mark(function _callee2() {
|
319
435
|
var chunk, requestCapability;
|
320
|
-
return _regenerator
|
436
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
321
437
|
while (1) {
|
322
438
|
switch (_context2.prev = _context2.next) {
|
323
439
|
case 0:
|
@@ -364,8 +480,10 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
|
|
364
480
|
}
|
365
481
|
|
366
482
|
return read;
|
367
|
-
}()
|
368
|
-
|
483
|
+
}()
|
484
|
+
}, {
|
485
|
+
key: "cancel",
|
486
|
+
value: function cancel(reason) {
|
369
487
|
this._done = true;
|
370
488
|
|
371
489
|
this._requests.forEach(function (requestCapability) {
|
@@ -379,8 +497,12 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
|
|
379
497
|
|
380
498
|
this._stream._removeRangeReader(this);
|
381
499
|
}
|
382
|
-
}
|
383
|
-
|
384
|
-
|
500
|
+
}, {
|
501
|
+
key: "isStreamingSupported",
|
502
|
+
get: function get() {
|
503
|
+
return false;
|
504
|
+
}
|
505
|
+
}]);
|
385
506
|
|
386
|
-
|
507
|
+
return PDFDataTransportStreamRangeReader;
|
508
|
+
}();
|
package/lib/display/webgl.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 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.
|
@@ -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.
|
@@ -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.
|
@@ -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.
|
@@ -129,6 +129,9 @@ DOMElement.prototype = {
|
|
129
129
|
childNodes.push(element);
|
130
130
|
}
|
131
131
|
},
|
132
|
+
hasChildNodes: function DOMElement_hasChildNodes() {
|
133
|
+
return this.childNodes.length !== 0;
|
134
|
+
},
|
132
135
|
cloneNode: function DOMElement_cloneNode() {
|
133
136
|
var newNode = new DOMElement(this.nodeName);
|
134
137
|
newNode.childNodes = this.childNodes;
|
package/lib/pdf.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 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.
|
@@ -21,8 +21,8 @@
|
|
21
21
|
*/
|
22
22
|
'use strict';
|
23
23
|
|
24
|
-
var pdfjsVersion = '2.
|
25
|
-
var pdfjsBuild = '
|
24
|
+
var pdfjsVersion = '2.2.228';
|
25
|
+
var pdfjsBuild = 'd7afb74a';
|
26
26
|
|
27
27
|
var pdfjsSharedUtil = require('./shared/util.js');
|
28
28
|
|
@@ -32,7 +32,7 @@ var pdfjsDisplayTextLayer = require('./display/text_layer.js');
|
|
32
32
|
|
33
33
|
var pdfjsDisplayAnnotationLayer = require('./display/annotation_layer.js');
|
34
34
|
|
35
|
-
var
|
35
|
+
var pdfjsDisplayDisplayUtils = require('./display/display_utils.js');
|
36
36
|
|
37
37
|
var pdfjsDisplaySVG = require('./display/svg.js');
|
38
38
|
|
@@ -49,16 +49,20 @@ var pdfjsDisplayAPICompatibility = require('./display/api_compatibility.js');
|
|
49
49
|
pdfjsDisplayAPI.setPDFNetworkStreamFactory(function (params) {
|
50
50
|
return new PDFNodeStream(params);
|
51
51
|
});
|
52
|
-
} else if (typeof Response !== 'undefined' && 'body' in Response.prototype && typeof ReadableStream !== 'undefined') {
|
53
|
-
var PDFFetchStream = require('./display/fetch_stream.js').PDFFetchStream;
|
54
|
-
|
55
|
-
pdfjsDisplayAPI.setPDFNetworkStreamFactory(function (params) {
|
56
|
-
return new PDFFetchStream(params);
|
57
|
-
});
|
58
52
|
} else {
|
59
53
|
var PDFNetworkStream = require('./display/network.js').PDFNetworkStream;
|
60
54
|
|
55
|
+
var PDFFetchStream;
|
56
|
+
|
57
|
+
if (pdfjsDisplayDisplayUtils.isFetchSupported()) {
|
58
|
+
PDFFetchStream = require('./display/fetch_stream.js').PDFFetchStream;
|
59
|
+
}
|
60
|
+
|
61
61
|
pdfjsDisplayAPI.setPDFNetworkStreamFactory(function (params) {
|
62
|
+
if (PDFFetchStream && pdfjsDisplayDisplayUtils.isValidFetchUrl(params.url)) {
|
63
|
+
return new PDFFetchStream(params);
|
64
|
+
}
|
65
|
+
|
62
66
|
return new PDFNetworkStream(params);
|
63
67
|
});
|
64
68
|
}
|
@@ -90,10 +94,11 @@ exports.shadow = pdfjsSharedUtil.shadow;
|
|
90
94
|
exports.Util = pdfjsSharedUtil.Util;
|
91
95
|
exports.ReadableStream = pdfjsSharedUtil.ReadableStream;
|
92
96
|
exports.URL = pdfjsSharedUtil.URL;
|
93
|
-
exports.RenderingCancelledException =
|
94
|
-
exports.getFilenameFromUrl =
|
95
|
-
exports.LinkTarget =
|
96
|
-
exports.addLinkAttributes =
|
97
|
-
exports.loadScript =
|
97
|
+
exports.RenderingCancelledException = pdfjsDisplayDisplayUtils.RenderingCancelledException;
|
98
|
+
exports.getFilenameFromUrl = pdfjsDisplayDisplayUtils.getFilenameFromUrl;
|
99
|
+
exports.LinkTarget = pdfjsDisplayDisplayUtils.LinkTarget;
|
100
|
+
exports.addLinkAttributes = pdfjsDisplayDisplayUtils.addLinkAttributes;
|
101
|
+
exports.loadScript = pdfjsDisplayDisplayUtils.loadScript;
|
102
|
+
exports.PDFDateString = pdfjsDisplayDisplayUtils.PDFDateString;
|
98
103
|
exports.GlobalWorkerOptions = pdfjsDisplayWorkerOptions.GlobalWorkerOptions;
|
99
104
|
exports.apiCompatibilityParams = pdfjsDisplayAPICompatibility.apiCompatibilityParams;
|
package/lib/pdf.worker.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 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.
|
@@ -21,8 +21,8 @@
|
|
21
21
|
*/
|
22
22
|
'use strict';
|
23
23
|
|
24
|
-
var pdfjsVersion = '2.
|
25
|
-
var pdfjsBuild = '
|
24
|
+
var pdfjsVersion = '2.2.228';
|
25
|
+
var pdfjsBuild = 'd7afb74a';
|
26
26
|
|
27
27
|
var pdfjsCoreWorker = require('./core/worker.js');
|
28
28
|
|