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.
|
package/lib/core/bidi.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.
|
package/lib/core/ccitt.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.
|
package/lib/core/ccitt_stream.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.
|
package/lib/core/cff_parser.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.
|
@@ -35,6 +35,7 @@ var _encodings = require("./encodings");
|
|
35
35
|
var MAX_SUBR_NESTING = 10;
|
36
36
|
var CFFStandardStrings = ['.notdef', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar', 'percent', 'ampersand', 'quoteright', 'parenleft', 'parenright', 'asterisk', 'plus', 'comma', 'hyphen', 'period', 'slash', 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'colon', 'semicolon', 'less', 'equal', 'greater', 'question', 'at', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'bracketleft', 'backslash', 'bracketright', 'asciicircum', 'underscore', 'quoteleft', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'braceleft', 'bar', 'braceright', 'asciitilde', 'exclamdown', 'cent', 'sterling', 'fraction', 'yen', 'florin', 'section', 'currency', 'quotesingle', 'quotedblleft', 'guillemotleft', 'guilsinglleft', 'guilsinglright', 'fi', 'fl', 'endash', 'dagger', 'daggerdbl', 'periodcentered', 'paragraph', 'bullet', 'quotesinglbase', 'quotedblbase', 'quotedblright', 'guillemotright', 'ellipsis', 'perthousand', 'questiondown', 'grave', 'acute', 'circumflex', 'tilde', 'macron', 'breve', 'dotaccent', 'dieresis', 'ring', 'cedilla', 'hungarumlaut', 'ogonek', 'caron', 'emdash', 'AE', 'ordfeminine', 'Lslash', 'Oslash', 'OE', 'ordmasculine', 'ae', 'dotlessi', 'lslash', 'oslash', 'oe', 'germandbls', 'onesuperior', 'logicalnot', 'mu', 'trademark', 'Eth', 'onehalf', 'plusminus', 'Thorn', 'onequarter', 'divide', 'brokenbar', 'degree', 'thorn', 'threequarters', 'twosuperior', 'registered', 'minus', 'eth', 'multiply', 'threesuperior', 'copyright', 'Aacute', 'Acircumflex', 'Adieresis', 'Agrave', 'Aring', 'Atilde', 'Ccedilla', 'Eacute', 'Ecircumflex', 'Edieresis', 'Egrave', 'Iacute', 'Icircumflex', 'Idieresis', 'Igrave', 'Ntilde', 'Oacute', 'Ocircumflex', 'Odieresis', 'Ograve', 'Otilde', 'Scaron', 'Uacute', 'Ucircumflex', 'Udieresis', 'Ugrave', 'Yacute', 'Ydieresis', 'Zcaron', 'aacute', 'acircumflex', 'adieresis', 'agrave', 'aring', 'atilde', 'ccedilla', 'eacute', 'ecircumflex', 'edieresis', 'egrave', 'iacute', 'icircumflex', 'idieresis', 'igrave', 'ntilde', 'oacute', 'ocircumflex', 'odieresis', 'ograve', 'otilde', 'scaron', 'uacute', 'ucircumflex', 'udieresis', 'ugrave', 'yacute', 'ydieresis', 'zcaron', 'exclamsmall', 'Hungarumlautsmall', 'dollaroldstyle', 'dollarsuperior', 'ampersandsmall', 'Acutesmall', 'parenleftsuperior', 'parenrightsuperior', 'twodotenleader', 'onedotenleader', 'zerooldstyle', 'oneoldstyle', 'twooldstyle', 'threeoldstyle', 'fouroldstyle', 'fiveoldstyle', 'sixoldstyle', 'sevenoldstyle', 'eightoldstyle', 'nineoldstyle', 'commasuperior', 'threequartersemdash', 'periodsuperior', 'questionsmall', 'asuperior', 'bsuperior', 'centsuperior', 'dsuperior', 'esuperior', 'isuperior', 'lsuperior', 'msuperior', 'nsuperior', 'osuperior', 'rsuperior', 'ssuperior', 'tsuperior', 'ff', 'ffi', 'ffl', 'parenleftinferior', 'parenrightinferior', 'Circumflexsmall', 'hyphensuperior', 'Gravesmall', 'Asmall', 'Bsmall', 'Csmall', 'Dsmall', 'Esmall', 'Fsmall', 'Gsmall', 'Hsmall', 'Ismall', 'Jsmall', 'Ksmall', 'Lsmall', 'Msmall', 'Nsmall', 'Osmall', 'Psmall', 'Qsmall', 'Rsmall', 'Ssmall', 'Tsmall', 'Usmall', 'Vsmall', 'Wsmall', 'Xsmall', 'Ysmall', 'Zsmall', 'colonmonetary', 'onefitted', 'rupiah', 'Tildesmall', 'exclamdownsmall', 'centoldstyle', 'Lslashsmall', 'Scaronsmall', 'Zcaronsmall', 'Dieresissmall', 'Brevesmall', 'Caronsmall', 'Dotaccentsmall', 'Macronsmall', 'figuredash', 'hypheninferior', 'Ogoneksmall', 'Ringsmall', 'Cedillasmall', 'questiondownsmall', 'oneeighth', 'threeeighths', 'fiveeighths', 'seveneighths', 'onethird', 'twothirds', 'zerosuperior', 'foursuperior', 'fivesuperior', 'sixsuperior', 'sevensuperior', 'eightsuperior', 'ninesuperior', 'zeroinferior', 'oneinferior', 'twoinferior', 'threeinferior', 'fourinferior', 'fiveinferior', 'sixinferior', 'seveninferior', 'eightinferior', 'nineinferior', 'centinferior', 'dollarinferior', 'periodinferior', 'commainferior', 'Agravesmall', 'Aacutesmall', 'Acircumflexsmall', 'Atildesmall', 'Adieresissmall', 'Aringsmall', 'AEsmall', 'Ccedillasmall', 'Egravesmall', 'Eacutesmall', 'Ecircumflexsmall', 'Edieresissmall', 'Igravesmall', 'Iacutesmall', 'Icircumflexsmall', 'Idieresissmall', 'Ethsmall', 'Ntildesmall', 'Ogravesmall', 'Oacutesmall', 'Ocircumflexsmall', 'Otildesmall', 'Odieresissmall', 'OEsmall', 'Oslashsmall', 'Ugravesmall', 'Uacutesmall', 'Ucircumflexsmall', 'Udieresissmall', 'Yacutesmall', 'Thornsmall', 'Ydieresissmall', '001.000', '001.001', '001.002', '001.003', 'Black', 'Bold', 'Book', 'Light', 'Medium', 'Regular', 'Roman', 'Semibold'];
|
37
37
|
exports.CFFStandardStrings = CFFStandardStrings;
|
38
|
+
var NUM_STANDARD_CFF_STRINGS = 391;
|
38
39
|
|
39
40
|
var CFFParser = function CFFParserClosure() {
|
40
41
|
var CharstringValidationData = [null, {
|
@@ -1031,16 +1032,31 @@ var CFFStrings = function CFFStringsClosure() {
|
|
1031
1032
|
|
1032
1033
|
CFFStrings.prototype = {
|
1033
1034
|
get: function CFFStrings_get(index) {
|
1034
|
-
if (index >= 0 && index <=
|
1035
|
+
if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
|
1035
1036
|
return CFFStandardStrings[index];
|
1036
1037
|
}
|
1037
1038
|
|
1038
|
-
if (index -
|
1039
|
-
return this.strings[index -
|
1039
|
+
if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
|
1040
|
+
return this.strings[index - NUM_STANDARD_CFF_STRINGS];
|
1040
1041
|
}
|
1041
1042
|
|
1042
1043
|
return CFFStandardStrings[0];
|
1043
1044
|
},
|
1045
|
+
getSID: function CFFStrings_getSID(str) {
|
1046
|
+
var index = CFFStandardStrings.indexOf(str);
|
1047
|
+
|
1048
|
+
if (index !== -1) {
|
1049
|
+
return index;
|
1050
|
+
}
|
1051
|
+
|
1052
|
+
index = this.strings.indexOf(str);
|
1053
|
+
|
1054
|
+
if (index !== -1) {
|
1055
|
+
return index + NUM_STANDARD_CFF_STRINGS;
|
1056
|
+
}
|
1057
|
+
|
1058
|
+
return -1;
|
1059
|
+
},
|
1044
1060
|
add: function CFFStrings_add(value) {
|
1045
1061
|
this.strings.push(value);
|
1046
1062
|
},
|
@@ -1377,7 +1393,7 @@ var CFFCompiler = function CFFCompilerClosure() {
|
|
1377
1393
|
}
|
1378
1394
|
}
|
1379
1395
|
|
1380
|
-
var charset = this.compileCharset(cff.charset);
|
1396
|
+
var charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
|
1381
1397
|
topDictTracker.setEntryLocation('charset', [output.length], output);
|
1382
1398
|
output.add(charset);
|
1383
1399
|
var charStrings = this.compileCharStrings(cff.charStrings);
|
@@ -1472,13 +1488,13 @@ var CFFCompiler = function CFFCompilerClosure() {
|
|
1472
1488
|
var sanitizedName = new Array(length);
|
1473
1489
|
|
1474
1490
|
for (var j = 0; j < length; j++) {
|
1475
|
-
var
|
1491
|
+
var _char = name[j];
|
1476
1492
|
|
1477
|
-
if (
|
1478
|
-
|
1493
|
+
if (_char < '!' || _char > '~' || _char === '[' || _char === ']' || _char === '(' || _char === ')' || _char === '{' || _char === '}' || _char === '<' || _char === '>' || _char === '/' || _char === '%') {
|
1494
|
+
_char = '_';
|
1479
1495
|
}
|
1480
1496
|
|
1481
|
-
sanitizedName[j] =
|
1497
|
+
sanitizedName[j] = _char;
|
1482
1498
|
}
|
1483
1499
|
|
1484
1500
|
sanitizedName = sanitizedName.join('');
|
@@ -1643,9 +1659,42 @@ var CFFCompiler = function CFFCompilerClosure() {
|
|
1643
1659
|
|
1644
1660
|
return this.compileIndex(charStringsIndex);
|
1645
1661
|
},
|
1646
|
-
compileCharset: function CFFCompiler_compileCharset(charset) {
|
1647
|
-
var
|
1648
|
-
var
|
1662
|
+
compileCharset: function CFFCompiler_compileCharset(charset, numGlyphs, strings, isCIDFont) {
|
1663
|
+
var out;
|
1664
|
+
var numGlyphsLessNotDef = numGlyphs - 1;
|
1665
|
+
|
1666
|
+
if (isCIDFont) {
|
1667
|
+
out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xFF, numGlyphsLessNotDef & 0xFF]);
|
1668
|
+
} else {
|
1669
|
+
var length = 1 + numGlyphsLessNotDef * 2;
|
1670
|
+
out = new Uint8Array(length);
|
1671
|
+
out[0] = 0;
|
1672
|
+
var charsetIndex = 0;
|
1673
|
+
var numCharsets = charset.charset.length;
|
1674
|
+
var warned = false;
|
1675
|
+
|
1676
|
+
for (var i = 1; i < out.length; i += 2) {
|
1677
|
+
var sid = 0;
|
1678
|
+
|
1679
|
+
if (charsetIndex < numCharsets) {
|
1680
|
+
var name = charset.charset[charsetIndex++];
|
1681
|
+
sid = strings.getSID(name);
|
1682
|
+
|
1683
|
+
if (sid === -1) {
|
1684
|
+
sid = 0;
|
1685
|
+
|
1686
|
+
if (!warned) {
|
1687
|
+
warned = true;
|
1688
|
+
(0, _util.warn)("Couldn't find ".concat(name, " in CFF strings"));
|
1689
|
+
}
|
1690
|
+
}
|
1691
|
+
}
|
1692
|
+
|
1693
|
+
out[i] = sid >> 8 & 0xFF;
|
1694
|
+
out[i + 1] = sid & 0xFF;
|
1695
|
+
}
|
1696
|
+
}
|
1697
|
+
|
1649
1698
|
return this.compileTypedArray(out);
|
1650
1699
|
},
|
1651
1700
|
compileEncoding: function CFFCompiler_compileEncoding(encoding) {
|
package/lib/core/charsets.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.
|
@@ -28,6 +28,8 @@ exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
|
|
28
28
|
|
29
29
|
var _util = require("../shared/util");
|
30
30
|
|
31
|
+
var _core_utils = require("./core_utils");
|
32
|
+
|
31
33
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
32
34
|
|
33
35
|
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); } }
|
@@ -122,6 +124,10 @@ function () {
|
|
122
124
|
}, {
|
123
125
|
key: "ensureByte",
|
124
126
|
value: function ensureByte(pos) {
|
127
|
+
if (pos < this.progressiveDataLength) {
|
128
|
+
return;
|
129
|
+
}
|
130
|
+
|
125
131
|
var chunk = Math.floor(pos / this.chunkSize);
|
126
132
|
|
127
133
|
if (chunk === this.lastSuccessfulEnsureByteChunk) {
|
@@ -129,7 +135,7 @@ function () {
|
|
129
135
|
}
|
130
136
|
|
131
137
|
if (!this.loadedChunks[chunk]) {
|
132
|
-
throw new
|
138
|
+
throw new _core_utils.MissingDataException(pos, pos + 1);
|
133
139
|
}
|
134
140
|
|
135
141
|
this.lastSuccessfulEnsureByteChunk = chunk;
|
@@ -151,7 +157,7 @@ function () {
|
|
151
157
|
|
152
158
|
for (var chunk = beginChunk; chunk < endChunk; ++chunk) {
|
153
159
|
if (!this.loadedChunks[chunk]) {
|
154
|
-
throw new
|
160
|
+
throw new _core_utils.MissingDataException(begin, end);
|
155
161
|
}
|
156
162
|
}
|
157
163
|
}
|
@@ -278,7 +284,11 @@ function () {
|
|
278
284
|
}, {
|
279
285
|
key: "makeSubStream",
|
280
286
|
value: function makeSubStream(start, length, dict) {
|
281
|
-
|
287
|
+
if (length) {
|
288
|
+
this.ensureRange(start, start + length);
|
289
|
+
} else {
|
290
|
+
this.ensureByte(start);
|
291
|
+
}
|
282
292
|
|
283
293
|
function ChunkedStreamSubstream() {}
|
284
294
|
|
@@ -432,8 +442,8 @@ function () {
|
|
432
442
|
_iteratorError = err;
|
433
443
|
} finally {
|
434
444
|
try {
|
435
|
-
if (!_iteratorNormalCompletion && _iterator
|
436
|
-
_iterator
|
445
|
+
if (!_iteratorNormalCompletion && _iterator["return"] != null) {
|
446
|
+
_iterator["return"]();
|
437
447
|
}
|
438
448
|
} finally {
|
439
449
|
if (_didIteratorError) {
|
@@ -482,8 +492,8 @@ function () {
|
|
482
492
|
_iteratorError2 = err;
|
483
493
|
} finally {
|
484
494
|
try {
|
485
|
-
if (!_iteratorNormalCompletion2 && _iterator2
|
486
|
-
_iterator2
|
495
|
+
if (!_iteratorNormalCompletion2 && _iterator2["return"] != null) {
|
496
|
+
_iterator2["return"]();
|
487
497
|
}
|
488
498
|
} finally {
|
489
499
|
if (_didIteratorError2) {
|
@@ -539,8 +549,8 @@ function () {
|
|
539
549
|
_iteratorError3 = err;
|
540
550
|
} finally {
|
541
551
|
try {
|
542
|
-
if (!_iteratorNormalCompletion3 && _iterator3
|
543
|
-
_iterator3
|
552
|
+
if (!_iteratorNormalCompletion3 && _iterator3["return"] != null) {
|
553
|
+
_iterator3["return"]();
|
544
554
|
}
|
545
555
|
} finally {
|
546
556
|
if (_didIteratorError3) {
|
@@ -646,8 +656,8 @@ function () {
|
|
646
656
|
_iteratorError4 = err;
|
647
657
|
} finally {
|
648
658
|
try {
|
649
|
-
if (!_iteratorNormalCompletion4 && _iterator4
|
650
|
-
_iterator4
|
659
|
+
if (!_iteratorNormalCompletion4 && _iterator4["return"] != null) {
|
660
|
+
_iterator4["return"]();
|
651
661
|
}
|
652
662
|
} finally {
|
653
663
|
if (_didIteratorError4) {
|
@@ -675,8 +685,8 @@ function () {
|
|
675
685
|
}
|
676
686
|
}
|
677
687
|
|
678
|
-
for (var _i = 0; _i <
|
679
|
-
var _requestId =
|
688
|
+
for (var _i = 0, _loadedRequests = loadedRequests; _i < _loadedRequests.length; _i++) {
|
689
|
+
var _requestId = _loadedRequests[_i];
|
680
690
|
var capability = this.promisesByRequest[_requestId];
|
681
691
|
delete this.promisesByRequest[_requestId];
|
682
692
|
capability.resolve();
|
package/lib/core/cmap.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.
|
@@ -32,6 +32,8 @@ var _primitives = require("./primitives");
|
|
32
32
|
|
33
33
|
var _parser = require("./parser");
|
34
34
|
|
35
|
+
var _core_utils = require("./core_utils");
|
36
|
+
|
35
37
|
var _stream = require("./stream");
|
36
38
|
|
37
39
|
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); }
|
@@ -452,7 +454,9 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
|
|
452
454
|
var useCMap = null;
|
453
455
|
var start = new Uint8Array(MAX_NUM_SIZE);
|
454
456
|
var end = new Uint8Array(MAX_NUM_SIZE);
|
455
|
-
|
457
|
+
|
458
|
+
var _char = new Uint8Array(MAX_NUM_SIZE);
|
459
|
+
|
456
460
|
var charCode = new Uint8Array(MAX_NUM_SIZE);
|
457
461
|
var tmp = new Uint8Array(MAX_NUM_SIZE);
|
458
462
|
var code;
|
@@ -522,20 +526,20 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
|
|
522
526
|
break;
|
523
527
|
|
524
528
|
case 2:
|
525
|
-
stream.readHex(
|
529
|
+
stream.readHex(_char, dataSize);
|
526
530
|
code = stream.readNumber();
|
527
|
-
cMap.mapOne(hexToInt(
|
531
|
+
cMap.mapOne(hexToInt(_char, dataSize), code);
|
528
532
|
|
529
533
|
for (i = 1; i < subitemsCount; i++) {
|
530
|
-
incHex(
|
534
|
+
incHex(_char, dataSize);
|
531
535
|
|
532
536
|
if (!sequence) {
|
533
537
|
stream.readHexNumber(tmp, dataSize);
|
534
|
-
addHex(
|
538
|
+
addHex(_char, tmp, dataSize);
|
535
539
|
}
|
536
540
|
|
537
541
|
code = stream.readSigned() + (code + 1);
|
538
|
-
cMap.mapOne(hexToInt(
|
542
|
+
cMap.mapOne(hexToInt(_char, dataSize), code);
|
539
543
|
}
|
540
544
|
|
541
545
|
break;
|
@@ -566,22 +570,22 @@ var BinaryCMapReader = function BinaryCMapReaderClosure() {
|
|
566
570
|
break;
|
567
571
|
|
568
572
|
case 4:
|
569
|
-
stream.readHex(
|
573
|
+
stream.readHex(_char, ucs2DataSize);
|
570
574
|
stream.readHex(charCode, dataSize);
|
571
|
-
cMap.mapOne(hexToInt(
|
575
|
+
cMap.mapOne(hexToInt(_char, ucs2DataSize), hexToStr(charCode, dataSize));
|
572
576
|
|
573
577
|
for (i = 1; i < subitemsCount; i++) {
|
574
|
-
incHex(
|
578
|
+
incHex(_char, ucs2DataSize);
|
575
579
|
|
576
580
|
if (!sequence) {
|
577
581
|
stream.readHexNumber(tmp, ucs2DataSize);
|
578
|
-
addHex(
|
582
|
+
addHex(_char, tmp, ucs2DataSize);
|
579
583
|
}
|
580
584
|
|
581
585
|
incHex(charCode, dataSize);
|
582
586
|
stream.readHexSigned(tmp, dataSize);
|
583
587
|
addHex(charCode, tmp, dataSize);
|
584
|
-
cMap.mapOne(hexToInt(
|
588
|
+
cMap.mapOne(hexToInt(_char, ucs2DataSize), hexToStr(charCode, dataSize));
|
585
589
|
}
|
586
590
|
|
587
591
|
break;
|
@@ -861,7 +865,7 @@ var CMapFactory = function CMapFactoryClosure() {
|
|
861
865
|
}
|
862
866
|
}
|
863
867
|
} catch (ex) {
|
864
|
-
if (ex instanceof
|
868
|
+
if (ex instanceof _core_utils.MissingDataException) {
|
865
869
|
throw ex;
|
866
870
|
}
|
867
871
|
|
package/lib/core/colorspace.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.
|
@@ -0,0 +1,147 @@
|
|
1
|
+
/**
|
2
|
+
* @licstart The following is the entire license notice for the
|
3
|
+
* Javascript code in this page
|
4
|
+
*
|
5
|
+
* Copyright 2019 Mozilla Foundation
|
6
|
+
*
|
7
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
* you may not use this file except in compliance with the License.
|
9
|
+
* You may obtain a copy of the License at
|
10
|
+
*
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
*
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
* See the License for the specific language governing permissions and
|
17
|
+
* limitations under the License.
|
18
|
+
*
|
19
|
+
* @licend The above is the entire license notice for the
|
20
|
+
* Javascript code in this page
|
21
|
+
*/
|
22
|
+
"use strict";
|
23
|
+
|
24
|
+
Object.defineProperty(exports, "__esModule", {
|
25
|
+
value: true
|
26
|
+
});
|
27
|
+
exports.getLookupTableFactory = getLookupTableFactory;
|
28
|
+
exports.getInheritableProperty = getInheritableProperty;
|
29
|
+
exports.toRomanNumerals = toRomanNumerals;
|
30
|
+
exports.XRefParseException = exports.XRefEntryException = exports.MissingDataException = void 0;
|
31
|
+
|
32
|
+
var _util = require("../shared/util");
|
33
|
+
|
34
|
+
function getLookupTableFactory(initializer) {
|
35
|
+
var lookup;
|
36
|
+
return function () {
|
37
|
+
if (initializer) {
|
38
|
+
lookup = Object.create(null);
|
39
|
+
initializer(lookup);
|
40
|
+
initializer = null;
|
41
|
+
}
|
42
|
+
|
43
|
+
return lookup;
|
44
|
+
};
|
45
|
+
}
|
46
|
+
|
47
|
+
var MissingDataException = function MissingDataExceptionClosure() {
|
48
|
+
function MissingDataException(begin, end) {
|
49
|
+
this.begin = begin;
|
50
|
+
this.end = end;
|
51
|
+
this.message = "Missing data [".concat(begin, ", ").concat(end, ")");
|
52
|
+
}
|
53
|
+
|
54
|
+
MissingDataException.prototype = new Error();
|
55
|
+
MissingDataException.prototype.name = 'MissingDataException';
|
56
|
+
MissingDataException.constructor = MissingDataException;
|
57
|
+
return MissingDataException;
|
58
|
+
}();
|
59
|
+
|
60
|
+
exports.MissingDataException = MissingDataException;
|
61
|
+
|
62
|
+
var XRefEntryException = function XRefEntryExceptionClosure() {
|
63
|
+
function XRefEntryException(msg) {
|
64
|
+
this.message = msg;
|
65
|
+
}
|
66
|
+
|
67
|
+
XRefEntryException.prototype = new Error();
|
68
|
+
XRefEntryException.prototype.name = 'XRefEntryException';
|
69
|
+
XRefEntryException.constructor = XRefEntryException;
|
70
|
+
return XRefEntryException;
|
71
|
+
}();
|
72
|
+
|
73
|
+
exports.XRefEntryException = XRefEntryException;
|
74
|
+
|
75
|
+
var XRefParseException = function XRefParseExceptionClosure() {
|
76
|
+
function XRefParseException(msg) {
|
77
|
+
this.message = msg;
|
78
|
+
}
|
79
|
+
|
80
|
+
XRefParseException.prototype = new Error();
|
81
|
+
XRefParseException.prototype.name = 'XRefParseException';
|
82
|
+
XRefParseException.constructor = XRefParseException;
|
83
|
+
return XRefParseException;
|
84
|
+
}();
|
85
|
+
|
86
|
+
exports.XRefParseException = XRefParseException;
|
87
|
+
|
88
|
+
function getInheritableProperty(_ref) {
|
89
|
+
var dict = _ref.dict,
|
90
|
+
key = _ref.key,
|
91
|
+
_ref$getArray = _ref.getArray,
|
92
|
+
getArray = _ref$getArray === void 0 ? false : _ref$getArray,
|
93
|
+
_ref$stopWhenFound = _ref.stopWhenFound,
|
94
|
+
stopWhenFound = _ref$stopWhenFound === void 0 ? true : _ref$stopWhenFound;
|
95
|
+
var LOOP_LIMIT = 100;
|
96
|
+
var loopCount = 0;
|
97
|
+
var values;
|
98
|
+
|
99
|
+
while (dict) {
|
100
|
+
var value = getArray ? dict.getArray(key) : dict.get(key);
|
101
|
+
|
102
|
+
if (value !== undefined) {
|
103
|
+
if (stopWhenFound) {
|
104
|
+
return value;
|
105
|
+
}
|
106
|
+
|
107
|
+
if (!values) {
|
108
|
+
values = [];
|
109
|
+
}
|
110
|
+
|
111
|
+
values.push(value);
|
112
|
+
}
|
113
|
+
|
114
|
+
if (++loopCount > LOOP_LIMIT) {
|
115
|
+
(0, _util.warn)("getInheritableProperty: maximum loop count exceeded for \"".concat(key, "\""));
|
116
|
+
break;
|
117
|
+
}
|
118
|
+
|
119
|
+
dict = dict.get('Parent');
|
120
|
+
}
|
121
|
+
|
122
|
+
return values;
|
123
|
+
}
|
124
|
+
|
125
|
+
var ROMAN_NUMBER_MAP = ['', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM', '', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC', '', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX'];
|
126
|
+
|
127
|
+
function toRomanNumerals(number) {
|
128
|
+
var lowerCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
129
|
+
(0, _util.assert)(Number.isInteger(number) && number > 0, 'The number should be a positive integer.');
|
130
|
+
var pos,
|
131
|
+
romanBuf = [];
|
132
|
+
|
133
|
+
while (number >= 1000) {
|
134
|
+
number -= 1000;
|
135
|
+
romanBuf.push('M');
|
136
|
+
}
|
137
|
+
|
138
|
+
pos = number / 100 | 0;
|
139
|
+
number %= 100;
|
140
|
+
romanBuf.push(ROMAN_NUMBER_MAP[pos]);
|
141
|
+
pos = number / 10 | 0;
|
142
|
+
number %= 10;
|
143
|
+
romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
|
144
|
+
romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
|
145
|
+
var romanStr = romanBuf.join('');
|
146
|
+
return lowerCase ? romanStr.toLowerCase() : romanStr;
|
147
|
+
}
|
package/lib/core/crypto.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.
|