pdfjs-dist 2.2.228 → 2.3.200
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 +8851 -8582
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +1 -1
- package/build/pdf.worker.js +8717 -8394
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +1 -1
- package/image_decoders/pdf.image_decoders.js +3014 -2864
- 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 +203 -39
- package/lib/core/chunked_stream.js +32 -9
- package/lib/core/core_utils.js +48 -22
- package/lib/core/document.js +44 -33
- package/lib/core/evaluator.js +68 -32
- package/lib/core/fonts.js +2 -2
- package/lib/core/glyphlist.js +1 -0
- package/lib/core/image.js +1 -1
- package/lib/core/jbig2.js +23 -6
- package/lib/core/jpg.js +54 -23
- package/lib/core/jpx.js +23 -6
- package/lib/core/obj.js +18 -16
- package/lib/core/operator_list.js +17 -14
- package/lib/core/parser.js +9 -12
- package/lib/core/pattern.js +22 -7
- package/lib/core/pdf_manager.js +4 -4
- package/lib/core/primitives.js +63 -42
- package/lib/core/stream.js +14 -0
- package/lib/core/type1_parser.js +9 -1
- package/lib/core/worker.js +17 -56
- package/lib/display/annotation_layer.js +194 -85
- package/lib/display/api.js +331 -213
- package/lib/display/canvas.js +6 -1
- package/lib/display/content_disposition.js +1 -1
- package/lib/display/display_utils.js +48 -18
- package/lib/display/network_utils.js +6 -0
- package/lib/display/pattern_helper.js +22 -5
- package/lib/display/svg.js +1 -1
- package/lib/display/text_layer.js +62 -53
- package/lib/display/xml_parser.js +1 -1
- package/lib/pdf.js +2 -3
- package/lib/pdf.worker.js +2 -2
- package/lib/shared/compatibility.js +23 -19
- package/lib/shared/message_handler.js +163 -196
- package/lib/shared/streams_polyfill.js +1 -1
- package/lib/shared/util.js +288 -196
- package/lib/test/unit/annotation_spec.js +687 -93
- package/lib/test/unit/api_spec.js +72 -27
- package/lib/test/unit/display_utils_spec.js +1 -1
- package/lib/test/unit/evaluator_spec.js +21 -5
- package/lib/test/unit/fetch_stream_spec.js +3 -1
- package/lib/test/unit/message_handler_spec.js +10 -6
- package/lib/test/unit/network_spec.js +3 -1
- package/lib/test/unit/network_utils_spec.js +14 -0
- package/lib/test/unit/node_stream_spec.js +3 -3
- package/lib/test/unit/primitives_spec.js +2 -2
- package/lib/test/unit/type1_parser_spec.js +1 -1
- package/lib/test/unit/ui_utils_spec.js +1 -1
- package/lib/test/unit/util_spec.js +10 -10
- package/lib/web/app.js +47 -35
- package/lib/web/app_options.js +4 -4
- package/lib/web/base_viewer.js +36 -12
- package/lib/web/chromecom.js +1 -3
- package/lib/web/download_manager.js +1 -1
- package/lib/web/firefox_print_service.js +7 -4
- package/lib/web/firefoxcom.js +10 -5
- package/lib/web/interfaces.js +4 -0
- package/lib/web/pdf_document_properties.js +1 -1
- package/lib/web/pdf_history.js +1 -1
- package/lib/web/pdf_link_service.js +7 -3
- package/lib/web/pdf_outline_viewer.js +2 -1
- package/lib/web/pdf_page_view.js +12 -16
- package/lib/web/pdf_print_service.js +3 -5
- package/lib/web/pdf_sidebar.js +3 -0
- package/lib/web/pdf_viewer.component.js +2 -2
- package/lib/web/toolbar.js +2 -0
- package/lib/web/ui_utils.js +1 -1
- package/package.json +1 -1
- package/web/pdf_viewer.css +5 -9
- package/web/pdf_viewer.js +60 -45
- package/web/pdf_viewer.js.map +1 -1
- package/external/streams/streams-lib.js +0 -3962
- package/external/url/url-lib.js +0 -627
- package/lib/shared/url_polyfill.js +0 -56
package/lib/core/document.js
CHANGED
@@ -52,7 +52,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
52
52
|
|
53
53
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
54
54
|
|
55
|
-
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
55
|
+
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
56
56
|
|
57
57
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
58
58
|
|
@@ -128,6 +128,21 @@ function () {
|
|
128
128
|
|
129
129
|
return _primitives.Dict.merge(this.xref, value);
|
130
130
|
}
|
131
|
+
}, {
|
132
|
+
key: "_getBoundingBox",
|
133
|
+
value: function _getBoundingBox(name) {
|
134
|
+
var box = this._getInheritableProperty(name, true);
|
135
|
+
|
136
|
+
if (Array.isArray(box) && box.length === 4) {
|
137
|
+
if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
|
138
|
+
return box;
|
139
|
+
}
|
140
|
+
|
141
|
+
(0, _util.warn)("Empty /".concat(name, " entry."));
|
142
|
+
}
|
143
|
+
|
144
|
+
return null;
|
145
|
+
}
|
131
146
|
}, {
|
132
147
|
key: "getContentStream",
|
133
148
|
value: function getContentStream() {
|
@@ -190,6 +205,7 @@ function () {
|
|
190
205
|
var _this2 = this;
|
191
206
|
|
192
207
|
var handler = _ref2.handler,
|
208
|
+
sink = _ref2.sink,
|
193
209
|
task = _ref2.task,
|
194
210
|
intent = _ref2.intent,
|
195
211
|
renderInteractiveForms = _ref2.renderInteractiveForms;
|
@@ -210,7 +226,7 @@ function () {
|
|
210
226
|
var _ref4 = _slicedToArray(_ref3, 1),
|
211
227
|
contentStream = _ref4[0];
|
212
228
|
|
213
|
-
var opList = new _operator_list.OperatorList(intent,
|
229
|
+
var opList = new _operator_list.OperatorList(intent, sink, _this2.pageIndex);
|
214
230
|
handler.send('StartRenderPage', {
|
215
231
|
transparency: partialEvaluator.hasBlendModes(_this2.resources),
|
216
232
|
pageIndex: _this2.pageIndex,
|
@@ -232,7 +248,9 @@ function () {
|
|
232
248
|
|
233
249
|
if (annotations.length === 0) {
|
234
250
|
pageOpList.flush(true);
|
235
|
-
return
|
251
|
+
return {
|
252
|
+
length: pageOpList.totalLength
|
253
|
+
};
|
236
254
|
}
|
237
255
|
|
238
256
|
var opListPromises = [];
|
@@ -291,7 +309,9 @@ function () {
|
|
291
309
|
|
292
310
|
pageOpList.addOp(_util.OPS.endAnnotations, []);
|
293
311
|
pageOpList.flush(true);
|
294
|
-
return
|
312
|
+
return {
|
313
|
+
length: pageOpList.totalLength
|
314
|
+
};
|
295
315
|
});
|
296
316
|
});
|
297
317
|
}
|
@@ -360,24 +380,12 @@ function () {
|
|
360
380
|
}, {
|
361
381
|
key: "mediaBox",
|
362
382
|
get: function get() {
|
363
|
-
|
364
|
-
|
365
|
-
if (!Array.isArray(mediaBox) || mediaBox.length !== 4) {
|
366
|
-
return (0, _util.shadow)(this, 'mediaBox', LETTER_SIZE_MEDIABOX);
|
367
|
-
}
|
368
|
-
|
369
|
-
return (0, _util.shadow)(this, 'mediaBox', mediaBox);
|
383
|
+
return (0, _util.shadow)(this, 'mediaBox', this._getBoundingBox('MediaBox') || LETTER_SIZE_MEDIABOX);
|
370
384
|
}
|
371
385
|
}, {
|
372
386
|
key: "cropBox",
|
373
387
|
get: function get() {
|
374
|
-
|
375
|
-
|
376
|
-
if (!Array.isArray(cropBox) || cropBox.length !== 4) {
|
377
|
-
return (0, _util.shadow)(this, 'cropBox', this.mediaBox);
|
378
|
-
}
|
379
|
-
|
380
|
-
return (0, _util.shadow)(this, 'cropBox', cropBox);
|
388
|
+
return (0, _util.shadow)(this, 'cropBox', this._getBoundingBox('CropBox') || this.mediaBox);
|
381
389
|
}
|
382
390
|
}, {
|
383
391
|
key: "userUnit",
|
@@ -393,16 +401,23 @@ function () {
|
|
393
401
|
}, {
|
394
402
|
key: "view",
|
395
403
|
get: function get() {
|
396
|
-
var
|
397
|
-
|
404
|
+
var cropBox = this.cropBox,
|
405
|
+
mediaBox = this.mediaBox;
|
406
|
+
var view;
|
398
407
|
|
399
|
-
if (
|
400
|
-
|
401
|
-
}
|
408
|
+
if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) {
|
409
|
+
view = mediaBox;
|
410
|
+
} else {
|
411
|
+
var box = _util.Util.intersect(cropBox, mediaBox);
|
402
412
|
|
403
|
-
|
413
|
+
if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
|
414
|
+
view = box;
|
415
|
+
} else {
|
416
|
+
(0, _util.warn)('Empty /CropBox and /MediaBox intersection.');
|
417
|
+
}
|
418
|
+
}
|
404
419
|
|
405
|
-
return (0, _util.shadow)(this, 'view',
|
420
|
+
return (0, _util.shadow)(this, 'view', view || mediaBox);
|
406
421
|
}
|
407
422
|
}, {
|
408
423
|
key: "rotate",
|
@@ -834,21 +849,17 @@ function () {
|
|
834
849
|
if (Array.isArray(idArray) && idArray[0] && (0, _util.isString)(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) {
|
835
850
|
hash = (0, _util.stringToBytes)(idArray[0]);
|
836
851
|
} else {
|
837
|
-
|
838
|
-
this.stream.ensureRange(0, Math.min(FINGERPRINT_FIRST_BYTES, this.stream.end));
|
839
|
-
}
|
840
|
-
|
841
|
-
hash = (0, _crypto.calculateMD5)(this.stream.bytes.subarray(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
|
852
|
+
hash = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
|
842
853
|
}
|
843
854
|
|
844
|
-
var
|
855
|
+
var fingerprintBuf = [];
|
845
856
|
|
846
857
|
for (var i = 0, ii = hash.length; i < ii; i++) {
|
847
858
|
var hex = hash[i].toString(16);
|
848
|
-
|
859
|
+
fingerprintBuf.push(hex.padStart(2, '0'));
|
849
860
|
}
|
850
861
|
|
851
|
-
return (0, _util.shadow)(this, 'fingerprint',
|
862
|
+
return (0, _util.shadow)(this, 'fingerprint', fingerprintBuf.join(''));
|
852
863
|
}
|
853
864
|
}]);
|
854
865
|
|
package/lib/core/evaluator.js
CHANGED
@@ -114,7 +114,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
|
114
114
|
var _ref2 = _asyncToGenerator(
|
115
115
|
/*#__PURE__*/
|
116
116
|
_regenerator["default"].mark(function _callee(name) {
|
117
|
-
var data;
|
117
|
+
var readableStream, reader, data;
|
118
118
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
119
119
|
while (1) {
|
120
120
|
switch (_context.prev = _context.next) {
|
@@ -127,12 +127,30 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
|
127
127
|
return _context.abrupt("return", _this.builtInCMapCache.get(name));
|
128
128
|
|
129
129
|
case 2:
|
130
|
-
|
131
|
-
return _this.handler.sendWithPromise('FetchBuiltInCMap', {
|
130
|
+
readableStream = _this.handler.sendWithStream('FetchBuiltInCMap', {
|
132
131
|
name: name
|
133
132
|
});
|
133
|
+
reader = readableStream.getReader();
|
134
|
+
_context.next = 6;
|
135
|
+
return new Promise(function (resolve, reject) {
|
136
|
+
function pump() {
|
137
|
+
reader.read().then(function (_ref3) {
|
138
|
+
var value = _ref3.value,
|
139
|
+
done = _ref3.done;
|
140
|
+
|
141
|
+
if (done) {
|
142
|
+
return;
|
143
|
+
}
|
144
|
+
|
145
|
+
resolve(value);
|
146
|
+
pump();
|
147
|
+
}, reject);
|
148
|
+
}
|
149
|
+
|
150
|
+
pump();
|
151
|
+
});
|
134
152
|
|
135
|
-
case
|
153
|
+
case 6:
|
136
154
|
data = _context.sent;
|
137
155
|
|
138
156
|
if (data.compressionType !== _util.CMapCompressionType.NONE) {
|
@@ -141,7 +159,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
|
141
159
|
|
142
160
|
return _context.abrupt("return", data);
|
143
161
|
|
144
|
-
case
|
162
|
+
case 9:
|
145
163
|
case "end":
|
146
164
|
return _context.stop();
|
147
165
|
}
|
@@ -355,7 +373,13 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
|
355
373
|
groupOptions.knockout = group.get('K') || false;
|
356
374
|
|
357
375
|
if (group.has('CS')) {
|
358
|
-
colorSpace =
|
376
|
+
colorSpace = group.get('CS');
|
377
|
+
|
378
|
+
if (colorSpace) {
|
379
|
+
colorSpace = _colorspace.ColorSpace.parse(colorSpace, this.xref, resources, this.pdfFunctionFactory);
|
380
|
+
} else {
|
381
|
+
(0, _util.warn)('buildFormXObject - invalid/non-existent Group /CS entry: ' + group.getRaw('CS'));
|
382
|
+
}
|
359
383
|
}
|
360
384
|
}
|
361
385
|
|
@@ -385,16 +409,16 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
|
385
409
|
buildPaintImageXObject: function () {
|
386
410
|
var _buildPaintImageXObject = _asyncToGenerator(
|
387
411
|
/*#__PURE__*/
|
388
|
-
_regenerator["default"].mark(function _callee2(
|
412
|
+
_regenerator["default"].mark(function _callee2(_ref4) {
|
389
413
|
var _this2 = this;
|
390
414
|
|
391
|
-
var resources, image,
|
415
|
+
var resources, image, _ref4$isInline, isInline, operatorList, cacheKey, imageCache, _ref4$forceDisableNat, forceDisableNativeImageDecoder, dict, w, h, maxImageSize, imageMask, imgData, args, width, height, bitStrideLength, imgArray, decode, softMask, mask, SMALL_IMAGE_DIMENSIONS, imageObj, nativeImageDecoderSupport, objId, nativeImageDecoder, imgPromise;
|
392
416
|
|
393
417
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
394
418
|
while (1) {
|
395
419
|
switch (_context2.prev = _context2.next) {
|
396
420
|
case 0:
|
397
|
-
resources =
|
421
|
+
resources = _ref4.resources, image = _ref4.image, _ref4$isInline = _ref4.isInline, isInline = _ref4$isInline === void 0 ? false : _ref4$isInline, operatorList = _ref4.operatorList, cacheKey = _ref4.cacheKey, imageCache = _ref4.imageCache, _ref4$forceDisableNat = _ref4.forceDisableNativeImageDecoder, forceDisableNativeImageDecoder = _ref4$forceDisableNat === void 0 ? false : _ref4$forceDisableNat;
|
398
422
|
dict = image.dict;
|
399
423
|
w = dict.get('Width', 'W');
|
400
424
|
h = dict.get('Height', 'H');
|
@@ -635,6 +659,10 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
|
635
659
|
operatorList.addDependencies(tilingOpList.dependencies);
|
636
660
|
operatorList.addOp(fn, tilingPatternIR);
|
637
661
|
}, function (reason) {
|
662
|
+
if (reason instanceof _util.AbortException) {
|
663
|
+
return;
|
664
|
+
}
|
665
|
+
|
638
666
|
if (_this3.options.ignoreErrors) {
|
639
667
|
_this3.handler.send('UnsupportedFeature', {
|
640
668
|
featureId: _util.UNSUPPORTED_FEATURES.unknown
|
@@ -994,15 +1022,15 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
|
994
1022
|
|
995
1023
|
return handleColorN;
|
996
1024
|
}(),
|
997
|
-
getOperatorList: function getOperatorList(
|
1025
|
+
getOperatorList: function getOperatorList(_ref5) {
|
998
1026
|
var _this7 = this;
|
999
1027
|
|
1000
|
-
var stream =
|
1001
|
-
task =
|
1002
|
-
resources =
|
1003
|
-
operatorList =
|
1004
|
-
|
1005
|
-
initialState =
|
1028
|
+
var stream = _ref5.stream,
|
1029
|
+
task = _ref5.task,
|
1030
|
+
resources = _ref5.resources,
|
1031
|
+
operatorList = _ref5.operatorList,
|
1032
|
+
_ref5$initialState = _ref5.initialState,
|
1033
|
+
initialState = _ref5$initialState === void 0 ? null : _ref5$initialState;
|
1006
1034
|
resources = resources || _primitives.Dict.empty;
|
1007
1035
|
initialState = initialState || new EvalState();
|
1008
1036
|
|
@@ -1031,7 +1059,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
|
1031
1059
|
|
1032
1060
|
return new Promise(function promiseBody(resolve, reject) {
|
1033
1061
|
var next = function next(promise) {
|
1034
|
-
promise.then(function () {
|
1062
|
+
Promise.all([promise, operatorList.ready]).then(function () {
|
1035
1063
|
try {
|
1036
1064
|
promiseBody(resolve, reject);
|
1037
1065
|
} catch (ex) {
|
@@ -1115,6 +1143,10 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
|
1115
1143
|
|
1116
1144
|
resolveXObject();
|
1117
1145
|
})["catch"](function (reason) {
|
1146
|
+
if (reason instanceof _util.AbortException) {
|
1147
|
+
return;
|
1148
|
+
}
|
1149
|
+
|
1118
1150
|
if (self.options.ignoreErrors) {
|
1119
1151
|
self.handler.send('UnsupportedFeature', {
|
1120
1152
|
featureId: _util.UNSUPPORTED_FEATURES.unknown
|
@@ -1364,6 +1396,10 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
|
1364
1396
|
closePendingRestoreOPS();
|
1365
1397
|
resolve();
|
1366
1398
|
})["catch"](function (reason) {
|
1399
|
+
if (reason instanceof _util.AbortException) {
|
1400
|
+
return;
|
1401
|
+
}
|
1402
|
+
|
1367
1403
|
if (_this7.options.ignoreErrors) {
|
1368
1404
|
_this7.handler.send('UnsupportedFeature', {
|
1369
1405
|
featureId: _util.UNSUPPORTED_FEATURES.unknown
|
@@ -1377,21 +1413,21 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
|
|
1377
1413
|
throw reason;
|
1378
1414
|
});
|
1379
1415
|
},
|
1380
|
-
getTextContent: function getTextContent(
|
1416
|
+
getTextContent: function getTextContent(_ref6) {
|
1381
1417
|
var _this8 = this;
|
1382
1418
|
|
1383
|
-
var stream =
|
1384
|
-
task =
|
1385
|
-
resources =
|
1386
|
-
|
1387
|
-
stateManager =
|
1388
|
-
|
1389
|
-
normalizeWhitespace =
|
1390
|
-
|
1391
|
-
combineTextItems =
|
1392
|
-
sink =
|
1393
|
-
|
1394
|
-
seenStyles =
|
1419
|
+
var stream = _ref6.stream,
|
1420
|
+
task = _ref6.task,
|
1421
|
+
resources = _ref6.resources,
|
1422
|
+
_ref6$stateManager = _ref6.stateManager,
|
1423
|
+
stateManager = _ref6$stateManager === void 0 ? null : _ref6$stateManager,
|
1424
|
+
_ref6$normalizeWhites = _ref6.normalizeWhitespace,
|
1425
|
+
normalizeWhitespace = _ref6$normalizeWhites === void 0 ? false : _ref6$normalizeWhites,
|
1426
|
+
_ref6$combineTextItem = _ref6.combineTextItems,
|
1427
|
+
combineTextItems = _ref6$combineTextItem === void 0 ? false : _ref6$combineTextItem,
|
1428
|
+
sink = _ref6.sink,
|
1429
|
+
_ref6$seenStyles = _ref6.seenStyles,
|
1430
|
+
seenStyles = _ref6$seenStyles === void 0 ? Object.create(null) : _ref6$seenStyles;
|
1395
1431
|
resources = resources || _primitives.Dict.empty;
|
1396
1432
|
stateManager = stateManager || new StateManager(new TextState());
|
1397
1433
|
var WhitespaceRegexp = /\s/g;
|
@@ -3352,7 +3388,7 @@ var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() {
|
|
3352
3388
|
while (true) {
|
3353
3389
|
var obj = this.parser.getObj();
|
3354
3390
|
|
3355
|
-
if (
|
3391
|
+
if (obj instanceof _primitives.Cmd) {
|
3356
3392
|
var cmd = obj.cmd;
|
3357
3393
|
var opSpec = this.opMap[cmd];
|
3358
3394
|
|
@@ -3409,7 +3445,7 @@ var EvaluatorPreprocessor = function EvaluatorPreprocessorClosure() {
|
|
3409
3445
|
return true;
|
3410
3446
|
}
|
3411
3447
|
|
3412
|
-
if (
|
3448
|
+
if (obj === _primitives.EOF) {
|
3413
3449
|
return false;
|
3414
3450
|
}
|
3415
3451
|
|
package/lib/core/fonts.js
CHANGED
@@ -53,7 +53,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
53
53
|
|
54
54
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
55
55
|
|
56
|
-
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
56
|
+
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
57
57
|
|
58
58
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
59
59
|
|
@@ -2923,7 +2923,7 @@ var Type1Font = function Type1FontClosure() {
|
|
2923
2923
|
|
2924
2924
|
var eexecBlock = getEexecBlock(file, eexecBlockLength);
|
2925
2925
|
var eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED);
|
2926
|
-
var data = eexecBlockParser.extractFontProgram();
|
2926
|
+
var data = eexecBlockParser.extractFontProgram(properties);
|
2927
2927
|
|
2928
2928
|
for (var info in data.properties) {
|
2929
2929
|
properties[info] = data.properties[info];
|
package/lib/core/glyphlist.js
CHANGED
package/lib/core/image.js
CHANGED
@@ -42,7 +42,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
42
42
|
|
43
43
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
44
44
|
|
45
|
-
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
45
|
+
function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
46
46
|
|
47
47
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
48
48
|
|
package/lib/core/jbig2.js
CHANGED
@@ -32,16 +32,33 @@ var _arithmetic_decoder = require("./arithmetic_decoder");
|
|
32
32
|
|
33
33
|
var _ccitt = require("./ccitt");
|
34
34
|
|
35
|
-
|
35
|
+
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); }
|
36
|
+
|
37
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
38
|
+
|
39
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
40
|
+
|
41
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
42
|
+
|
43
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
44
|
+
|
45
|
+
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); }
|
46
|
+
|
47
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
48
|
+
|
49
|
+
var Jbig2Error =
|
50
|
+
/*#__PURE__*/
|
51
|
+
function (_BaseException) {
|
52
|
+
_inherits(Jbig2Error, _BaseException);
|
53
|
+
|
36
54
|
function Jbig2Error(msg) {
|
37
|
-
this
|
55
|
+
_classCallCheck(this, Jbig2Error);
|
56
|
+
|
57
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(Jbig2Error).call(this, "JBIG2 error: ".concat(msg)));
|
38
58
|
}
|
39
59
|
|
40
|
-
Jbig2Error.prototype = new Error();
|
41
|
-
Jbig2Error.prototype.name = 'Jbig2Error';
|
42
|
-
Jbig2Error.constructor = Jbig2Error;
|
43
60
|
return Jbig2Error;
|
44
|
-
}();
|
61
|
+
}(_util.BaseException);
|
45
62
|
|
46
63
|
var Jbig2Image = function Jbig2ImageClosure() {
|
47
64
|
function ContextCache() {}
|
package/lib/core/jpg.js
CHANGED
@@ -30,39 +30,63 @@ var _util = require("../shared/util");
|
|
30
30
|
|
31
31
|
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
32
32
|
|
33
|
-
|
33
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
34
|
+
|
35
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
36
|
+
|
37
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
38
|
+
|
39
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
40
|
+
|
41
|
+
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); }
|
42
|
+
|
43
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
44
|
+
|
45
|
+
var JpegError =
|
46
|
+
/*#__PURE__*/
|
47
|
+
function (_BaseException) {
|
48
|
+
_inherits(JpegError, _BaseException);
|
49
|
+
|
34
50
|
function JpegError(msg) {
|
35
|
-
this
|
51
|
+
_classCallCheck(this, JpegError);
|
52
|
+
|
53
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(JpegError).call(this, "JPEG error: ".concat(msg)));
|
36
54
|
}
|
37
55
|
|
38
|
-
JpegError.prototype = new Error();
|
39
|
-
JpegError.prototype.name = 'JpegError';
|
40
|
-
JpegError.constructor = JpegError;
|
41
56
|
return JpegError;
|
42
|
-
}();
|
57
|
+
}(_util.BaseException);
|
58
|
+
|
59
|
+
var DNLMarkerError =
|
60
|
+
/*#__PURE__*/
|
61
|
+
function (_BaseException2) {
|
62
|
+
_inherits(DNLMarkerError, _BaseException2);
|
43
63
|
|
44
|
-
var DNLMarkerError = function DNLMarkerErrorClosure() {
|
45
64
|
function DNLMarkerError(message, scanLines) {
|
46
|
-
|
47
|
-
|
65
|
+
var _this;
|
66
|
+
|
67
|
+
_classCallCheck(this, DNLMarkerError);
|
68
|
+
|
69
|
+
_this = _possibleConstructorReturn(this, _getPrototypeOf(DNLMarkerError).call(this, message));
|
70
|
+
_this.scanLines = scanLines;
|
71
|
+
return _this;
|
48
72
|
}
|
49
73
|
|
50
|
-
DNLMarkerError.prototype = new Error();
|
51
|
-
DNLMarkerError.prototype.name = 'DNLMarkerError';
|
52
|
-
DNLMarkerError.constructor = DNLMarkerError;
|
53
74
|
return DNLMarkerError;
|
54
|
-
}();
|
75
|
+
}(_util.BaseException);
|
76
|
+
|
77
|
+
var EOIMarkerError =
|
78
|
+
/*#__PURE__*/
|
79
|
+
function (_BaseException3) {
|
80
|
+
_inherits(EOIMarkerError, _BaseException3);
|
81
|
+
|
82
|
+
function EOIMarkerError() {
|
83
|
+
_classCallCheck(this, EOIMarkerError);
|
55
84
|
|
56
|
-
|
57
|
-
function EOIMarkerError(message) {
|
58
|
-
this.message = message;
|
85
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(EOIMarkerError).apply(this, arguments));
|
59
86
|
}
|
60
87
|
|
61
|
-
EOIMarkerError.prototype = new Error();
|
62
|
-
EOIMarkerError.prototype.name = 'EOIMarkerError';
|
63
|
-
EOIMarkerError.constructor = EOIMarkerError;
|
64
88
|
return EOIMarkerError;
|
65
|
-
}();
|
89
|
+
}(_util.BaseException);
|
66
90
|
|
67
91
|
var JpegImage = function JpegImageClosure() {
|
68
92
|
var dctZigZag = new Uint8Array([0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63]);
|
@@ -457,7 +481,9 @@ var JpegImage = function JpegImageClosure() {
|
|
457
481
|
bitsCount = 0;
|
458
482
|
fileMarker = findNextFileMarker(data, offset);
|
459
483
|
|
460
|
-
if (fileMarker
|
484
|
+
if (!fileMarker) {
|
485
|
+
break;
|
486
|
+
} else if (fileMarker.invalid) {
|
461
487
|
(0, _util.warn)('decodeScan - unexpected MCU data, current marker is: ' + fileMarker.invalid);
|
462
488
|
offset = fileMarker.offset;
|
463
489
|
}
|
@@ -465,7 +491,7 @@ var JpegImage = function JpegImageClosure() {
|
|
465
491
|
var marker = fileMarker && fileMarker.marker;
|
466
492
|
|
467
493
|
if (!marker || marker <= 0xFF00) {
|
468
|
-
throw new JpegError('marker was not found');
|
494
|
+
throw new JpegError('decodeScan - a valid marker was not found.');
|
469
495
|
}
|
470
496
|
|
471
497
|
if (marker >= 0xFFD0 && marker <= 0xFFD7) {
|
@@ -986,7 +1012,12 @@ var JpegImage = function JpegImageClosure() {
|
|
986
1012
|
break;
|
987
1013
|
}
|
988
1014
|
|
989
|
-
|
1015
|
+
if (offset > data.length - 2) {
|
1016
|
+
(0, _util.warn)('JpegImage.parse - reached the end of the image data ' + 'without finding an EOI marker (0xFFD9).');
|
1017
|
+
break markerLoop;
|
1018
|
+
}
|
1019
|
+
|
1020
|
+
throw new JpegError('JpegImage.parse - unknown marker: ' + fileMarker.toString(16));
|
990
1021
|
}
|
991
1022
|
|
992
1023
|
fileMarker = readUint16();
|
package/lib/core/jpx.js
CHANGED
@@ -30,16 +30,33 @@ var _util = require("../shared/util");
|
|
30
30
|
|
31
31
|
var _arithmetic_decoder = require("./arithmetic_decoder");
|
32
32
|
|
33
|
-
|
33
|
+
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); }
|
34
|
+
|
35
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
36
|
+
|
37
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
38
|
+
|
39
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
40
|
+
|
41
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
42
|
+
|
43
|
+
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); }
|
44
|
+
|
45
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
46
|
+
|
47
|
+
var JpxError =
|
48
|
+
/*#__PURE__*/
|
49
|
+
function (_BaseException) {
|
50
|
+
_inherits(JpxError, _BaseException);
|
51
|
+
|
34
52
|
function JpxError(msg) {
|
35
|
-
this
|
53
|
+
_classCallCheck(this, JpxError);
|
54
|
+
|
55
|
+
return _possibleConstructorReturn(this, _getPrototypeOf(JpxError).call(this, "JPX error: ".concat(msg)));
|
36
56
|
}
|
37
57
|
|
38
|
-
JpxError.prototype = new Error();
|
39
|
-
JpxError.prototype.name = 'JpxError';
|
40
|
-
JpxError.constructor = JpxError;
|
41
58
|
return JpxError;
|
42
|
-
}();
|
59
|
+
}(_util.BaseException);
|
43
60
|
|
44
61
|
var JpxImage = function JpxImageClosure() {
|
45
62
|
var SubbandsGainLog2 = {
|