pdfjs-dist 2.2.228 → 2.6.347
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/README.md +4 -0
- package/bower.json +1 -1
- package/build/pdf.js +8816 -19300
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +22 -1
- package/build/pdf.worker.entry.js +5 -3
- package/build/pdf.worker.js +27185 -35746
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +22 -1
- package/es5/build/pdf.js +26665 -0
- package/es5/build/pdf.js.map +1 -0
- package/es5/build/pdf.min.js +22 -0
- package/{lib/shared/global_scope.js → es5/build/pdf.worker.entry.js} +5 -10
- package/es5/build/pdf.worker.js +61231 -0
- package/es5/build/pdf.worker.js.map +1 -0
- package/es5/build/pdf.worker.min.js +22 -0
- package/es5/image_decoders/pdf.image_decoders.js +12529 -0
- package/es5/image_decoders/pdf.image_decoders.js.map +1 -0
- package/es5/image_decoders/pdf.image_decoders.min.js +22 -0
- package/es5/web/images/annotation-check.svg +11 -0
- package/es5/web/images/annotation-comment.svg +16 -0
- package/es5/web/images/annotation-help.svg +26 -0
- package/es5/web/images/annotation-insert.svg +10 -0
- package/es5/web/images/annotation-key.svg +11 -0
- package/es5/web/images/annotation-newparagraph.svg +11 -0
- package/es5/web/images/annotation-noicon.svg +7 -0
- package/es5/web/images/annotation-note.svg +42 -0
- package/es5/web/images/annotation-paragraph.svg +16 -0
- package/es5/web/images/loading-icon.gif +0 -0
- package/es5/web/images/shadow.png +0 -0
- package/es5/web/pdf_viewer.css +406 -0
- package/es5/web/pdf_viewer.js +7886 -0
- package/es5/web/pdf_viewer.js.map +1 -0
- package/image_decoders/pdf.image_decoders.js +1498 -4832
- package/image_decoders/pdf.image_decoders.js.map +1 -1
- package/image_decoders/pdf.image_decoders.min.js +22 -1
- package/lib/README.md +7 -0
- package/lib/core/annotation.js +1144 -927
- package/lib/core/arithmetic_decoder.js +81 -97
- package/lib/core/bidi.js +54 -46
- package/lib/core/ccitt.js +88 -81
- package/lib/core/ccitt_stream.js +15 -14
- package/lib/core/cff_parser.js +747 -716
- package/lib/core/charsets.js +4 -4
- package/lib/core/chunked_stream.js +462 -553
- package/lib/core/cmap.js +231 -277
- package/lib/core/colorspace.js +715 -857
- package/lib/core/core_utils.js +57 -52
- package/lib/core/crypto.js +416 -437
- package/lib/core/document.js +629 -670
- package/lib/core/encodings.js +15 -15
- package/lib/core/evaluator.js +3229 -2800
- package/lib/core/font_renderer.js +135 -178
- package/lib/core/fonts.js +602 -534
- package/lib/core/function.js +355 -279
- package/lib/core/glyphlist.js +4527 -4526
- package/lib/core/image.js +442 -439
- package/lib/core/image_utils.js +221 -61
- package/lib/core/jbig2.js +325 -316
- package/lib/core/jbig2_stream.js +18 -17
- package/lib/core/jpeg_stream.js +21 -26
- package/lib/core/jpg.js +289 -233
- package/lib/core/jpx.js +161 -143
- package/lib/core/jpx_stream.js +28 -28
- package/lib/core/metrics.js +2928 -2928
- package/lib/core/murmurhash3.js +87 -102
- package/lib/core/obj.js +1343 -1300
- package/lib/core/operator_list.js +90 -67
- package/lib/core/parser.js +990 -987
- package/lib/core/pattern.js +105 -77
- package/lib/core/pdf_manager.js +149 -316
- package/lib/core/primitives.js +156 -104
- package/lib/core/ps_parser.js +175 -214
- package/lib/core/standard_fonts.js +237 -236
- package/lib/core/stream.js +94 -74
- package/lib/core/type1_parser.js +89 -69
- package/lib/core/unicode.js +1654 -1654
- package/lib/core/worker.js +275 -290
- package/lib/core/worker_stream.js +101 -210
- package/lib/core/writer.js +242 -0
- package/lib/display/annotation_layer.js +772 -1041
- package/lib/display/annotation_storage.js +89 -0
- package/lib/display/api.js +1575 -1868
- package/lib/display/api_compatibility.js +12 -17
- package/lib/display/canvas.js +370 -222
- package/lib/display/content_disposition.js +40 -59
- package/lib/display/display_utils.js +341 -536
- package/lib/display/fetch_stream.js +188 -304
- package/lib/display/font_loader.js +282 -414
- package/lib/display/metadata.js +81 -99
- package/lib/display/network.js +362 -511
- package/lib/display/network_utils.js +25 -18
- package/lib/display/node_stream.js +283 -465
- package/lib/display/node_utils.js +87 -0
- package/lib/display/optional_content_config.js +184 -0
- package/lib/display/pattern_helper.js +93 -44
- package/lib/display/svg.js +1163 -1401
- package/lib/display/text_layer.js +154 -137
- package/lib/display/transport_stream.js +237 -375
- package/lib/display/webgl.js +70 -83
- package/lib/display/worker_options.js +3 -3
- package/lib/display/xml_parser.js +303 -392
- package/lib/examples/node/domstubs.js +37 -37
- package/lib/pdf.js +220 -58
- package/lib/pdf.worker.js +14 -6
- package/lib/shared/compatibility.js +3 -246
- package/lib/shared/is_node.js +7 -6
- package/lib/shared/message_handler.js +327 -332
- package/lib/shared/util.js +271 -306
- package/lib/test/unit/annotation_spec.js +1902 -763
- package/lib/test/unit/annotation_storage_spec.js +83 -0
- package/lib/test/unit/api_spec.js +790 -592
- package/lib/test/unit/bidi_spec.js +7 -7
- package/lib/test/unit/cff_parser_spec.js +73 -72
- package/lib/test/unit/clitests_helper.js +7 -9
- package/lib/test/unit/cmap_spec.js +86 -88
- package/lib/test/unit/colorspace_spec.js +346 -154
- package/lib/test/unit/core_utils_spec.js +125 -105
- package/lib/test/unit/crypto_spec.js +232 -185
- package/lib/test/unit/custom_spec.js +150 -24
- package/lib/test/unit/display_svg_spec.js +34 -39
- package/lib/test/unit/display_utils_spec.js +139 -149
- package/lib/test/unit/document_spec.js +128 -17
- package/lib/test/unit/encodings_spec.js +12 -34
- package/lib/test/unit/evaluator_spec.js +112 -91
- package/lib/test/unit/fetch_stream_spec.js +31 -29
- package/lib/test/unit/function_spec.js +206 -204
- package/lib/test/unit/jasmine-boot.js +48 -32
- package/lib/test/unit/message_handler_spec.js +173 -159
- package/lib/test/unit/metadata_spec.js +71 -71
- package/lib/test/unit/murmurhash3_spec.js +12 -12
- package/lib/test/unit/network_spec.js +13 -11
- package/lib/test/unit/network_utils_spec.js +158 -144
- package/lib/test/unit/node_stream_spec.js +76 -90
- package/lib/test/unit/parser_spec.js +108 -114
- package/lib/test/unit/pdf_find_controller_spec.js +55 -86
- package/lib/test/unit/pdf_find_utils_spec.js +32 -32
- package/lib/test/unit/pdf_history_spec.js +32 -32
- package/lib/test/unit/primitives_spec.js +337 -156
- package/lib/test/unit/stream_spec.js +16 -14
- package/lib/test/unit/test_utils.js +91 -304
- package/lib/test/unit/testreporter.js +33 -22
- package/lib/test/unit/type1_parser_spec.js +42 -42
- package/lib/test/unit/ui_utils_spec.js +299 -461
- package/lib/test/unit/unicode_spec.js +42 -42
- package/lib/test/unit/util_spec.js +129 -149
- package/lib/test/unit/writer_spec.js +84 -0
- package/lib/web/annotation_layer_builder.js +78 -111
- package/lib/web/app.js +1542 -1267
- package/lib/web/app_options.js +76 -91
- package/lib/web/base_tree_viewer.js +100 -0
- package/lib/web/base_viewer.js +869 -834
- package/lib/web/chromecom.js +165 -252
- package/lib/web/debugger.js +149 -205
- package/lib/web/download_manager.js +34 -58
- package/lib/web/firefox_print_service.js +62 -34
- package/lib/web/firefoxcom.js +206 -374
- package/lib/web/genericcom.js +26 -108
- package/lib/web/genericl10n.js +24 -153
- package/lib/web/grab_to_pan.js +30 -30
- package/lib/web/interfaces.js +80 -254
- package/lib/web/overlay_manager.js +70 -246
- package/lib/web/password_prompt.js +38 -64
- package/lib/web/pdf_attachment_viewer.js +150 -126
- package/lib/web/pdf_cursor_tools.js +75 -102
- package/lib/web/pdf_document_properties.js +229 -383
- package/lib/web/pdf_find_bar.js +136 -170
- package/lib/web/pdf_find_controller.js +492 -548
- package/lib/web/pdf_find_utils.js +13 -13
- package/lib/web/pdf_history.js +397 -406
- package/lib/web/pdf_layer_viewer.js +208 -0
- package/lib/web/pdf_link_service.js +304 -348
- package/lib/web/pdf_outline_viewer.js +119 -212
- package/lib/web/pdf_page_view.js +474 -513
- package/lib/web/pdf_presentation_mode.js +308 -357
- package/lib/web/pdf_print_service.js +96 -110
- package/lib/web/pdf_rendering_queue.js +87 -108
- package/lib/web/pdf_sidebar.js +286 -302
- package/lib/web/pdf_sidebar_resizer.js +92 -119
- package/lib/web/pdf_single_page_viewer.js +77 -126
- package/lib/web/pdf_thumbnail_view.js +289 -297
- package/lib/web/pdf_thumbnail_viewer.js +202 -206
- package/lib/web/pdf_viewer.component.js +20 -21
- package/lib/web/pdf_viewer.js +55 -115
- package/lib/web/preferences.js +69 -273
- package/lib/web/secondary_toolbar.js +164 -196
- package/lib/web/text_layer_builder.js +284 -319
- package/lib/web/toolbar.js +217 -210
- package/lib/web/ui_utils.js +274 -421
- package/lib/web/view_history.js +52 -226
- package/lib/web/viewer_compatibility.js +21 -6
- package/package.json +4 -9
- package/types/display/annotation_layer.d.ts +61 -0
- package/types/display/annotation_storage.d.ts +36 -0
- package/types/display/api.d.ts +1107 -0
- package/types/display/api_compatibility.d.ts +1 -0
- package/types/display/canvas.d.ts +4 -0
- package/types/display/content_disposition.d.ts +7 -0
- package/types/display/display_utils.d.ts +243 -0
- package/types/display/fetch_stream.d.ts +67 -0
- package/types/display/font_loader.d.ts +19 -0
- package/types/display/metadata.d.ts +9 -0
- package/types/display/network.d.ts +80 -0
- package/types/display/network_utils.d.ts +14 -0
- package/types/display/node_stream.d.ts +72 -0
- package/types/display/node_utils.d.ts +6 -0
- package/types/display/optional_content_config.d.ts +12 -0
- package/types/display/pattern_helper.d.ts +5 -0
- package/types/display/svg.d.ts +2 -0
- package/types/display/text_layer.d.ts +83 -0
- package/types/display/transport_stream.d.ts +57 -0
- package/types/display/webgl.d.ts +20 -0
- package/types/display/worker_options.d.ts +27 -0
- package/types/display/xml_parser.d.ts +35 -0
- package/types/pdf.d.ts +33 -0
- package/types/shared/compatibility.d.ts +1 -0
- package/types/shared/is_node.d.ts +1 -0
- package/types/shared/message_handler.d.ts +62 -0
- package/types/shared/util.d.ts +421 -0
- package/web/images/shadow.png +0 -0
- package/web/pdf_viewer.css +29 -27
- package/web/pdf_viewer.js +3524 -4746
- package/web/pdf_viewer.js.map +1 -1
- package/webpack.js +6 -5
- package/external/streams/streams-lib.js +0 -3962
- package/external/url/url-lib.js +0 -627
- package/lib/shared/streams_polyfill.js +0 -43
- package/lib/shared/url_polyfill.js +0 -56
- package/web/images/texture.png +0 -0
package/lib/shared/util.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 2020 Mozilla Foundation
|
6
6
|
*
|
7
7
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
8
|
* you may not use this file except in compliance with the License.
|
@@ -29,23 +29,17 @@ exports.arraysToBytes = arraysToBytes;
|
|
29
29
|
exports.assert = assert;
|
30
30
|
exports.bytesToString = bytesToString;
|
31
31
|
exports.createPromiseCapability = createPromiseCapability;
|
32
|
+
exports.escapeString = escapeString;
|
33
|
+
exports.getModificationDate = getModificationDate;
|
32
34
|
exports.getVerbosityLevel = getVerbosityLevel;
|
33
35
|
exports.info = info;
|
34
36
|
exports.isArrayBuffer = isArrayBuffer;
|
35
37
|
exports.isArrayEqual = isArrayEqual;
|
36
38
|
exports.isBool = isBool;
|
37
|
-
exports.isEmptyObj = isEmptyObj;
|
38
39
|
exports.isNum = isNum;
|
39
40
|
exports.isString = isString;
|
40
|
-
exports.isSpace = isSpace;
|
41
41
|
exports.isSameOrigin = isSameOrigin;
|
42
42
|
exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
|
43
|
-
exports.isLittleEndian = isLittleEndian;
|
44
|
-
exports.isEvalSupported = isEvalSupported;
|
45
|
-
exports.log2 = log2;
|
46
|
-
exports.readInt8 = readInt8;
|
47
|
-
exports.readUint16 = readUint16;
|
48
|
-
exports.readUint32 = readUint32;
|
49
43
|
exports.removeNullCharacters = removeNullCharacters;
|
50
44
|
exports.setVerbosityLevel = setVerbosityLevel;
|
51
45
|
exports.shadow = shadow;
|
@@ -56,39 +50,15 @@ exports.stringToUTF8String = stringToUTF8String;
|
|
56
50
|
exports.utf8StringToString = utf8StringToString;
|
57
51
|
exports.warn = warn;
|
58
52
|
exports.unreachable = unreachable;
|
59
|
-
|
60
|
-
enumerable: true,
|
61
|
-
get: function get() {
|
62
|
-
return _streams_polyfill.ReadableStream;
|
63
|
-
}
|
64
|
-
});
|
65
|
-
Object.defineProperty(exports, "URL", {
|
66
|
-
enumerable: true,
|
67
|
-
get: function get() {
|
68
|
-
return _url_polyfill.URL;
|
69
|
-
}
|
70
|
-
});
|
71
|
-
exports.createObjectURL = exports.FormatError = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.NativeImageDecoding = exports.MissingPDFException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = void 0;
|
72
|
-
|
73
|
-
require("./compatibility");
|
74
|
-
|
75
|
-
var _streams_polyfill = require("./streams_polyfill");
|
53
|
+
exports.IsEvalSupportedCached = exports.IsLittleEndianCached = exports.createObjectURL = exports.FormatError = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.MissingPDFException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = exports.BaseException = void 0;
|
76
54
|
|
77
|
-
|
55
|
+
require("./compatibility.js");
|
78
56
|
|
79
|
-
|
80
|
-
|
81
|
-
var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
|
57
|
+
const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
|
82
58
|
exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
|
83
|
-
|
59
|
+
const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
|
84
60
|
exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
|
85
|
-
|
86
|
-
NONE: 'none',
|
87
|
-
DECODE: 'decode',
|
88
|
-
DISPLAY: 'display'
|
89
|
-
};
|
90
|
-
exports.NativeImageDecoding = NativeImageDecoding;
|
91
|
-
var PermissionFlag = {
|
61
|
+
const PermissionFlag = {
|
92
62
|
PRINT: 0x04,
|
93
63
|
MODIFY_CONTENTS: 0x08,
|
94
64
|
COPY: 0x10,
|
@@ -99,7 +69,7 @@ var PermissionFlag = {
|
|
99
69
|
PRINT_HIGH_QUALITY: 0x800
|
100
70
|
};
|
101
71
|
exports.PermissionFlag = PermissionFlag;
|
102
|
-
|
72
|
+
const TextRenderingMode = {
|
103
73
|
FILL: 0,
|
104
74
|
STROKE: 1,
|
105
75
|
FILL_STROKE: 2,
|
@@ -112,13 +82,13 @@ var TextRenderingMode = {
|
|
112
82
|
ADD_TO_PATH_FLAG: 4
|
113
83
|
};
|
114
84
|
exports.TextRenderingMode = TextRenderingMode;
|
115
|
-
|
85
|
+
const ImageKind = {
|
116
86
|
GRAYSCALE_1BPP: 1,
|
117
87
|
RGB_24BPP: 2,
|
118
88
|
RGBA_32BPP: 3
|
119
89
|
};
|
120
90
|
exports.ImageKind = ImageKind;
|
121
|
-
|
91
|
+
const AnnotationType = {
|
122
92
|
TEXT: 1,
|
123
93
|
LINK: 2,
|
124
94
|
FREETEXT: 3,
|
@@ -147,7 +117,30 @@ var AnnotationType = {
|
|
147
117
|
REDACT: 26
|
148
118
|
};
|
149
119
|
exports.AnnotationType = AnnotationType;
|
150
|
-
|
120
|
+
const AnnotationStateModelType = {
|
121
|
+
MARKED: "Marked",
|
122
|
+
REVIEW: "Review"
|
123
|
+
};
|
124
|
+
exports.AnnotationStateModelType = AnnotationStateModelType;
|
125
|
+
const AnnotationMarkedState = {
|
126
|
+
MARKED: "Marked",
|
127
|
+
UNMARKED: "Unmarked"
|
128
|
+
};
|
129
|
+
exports.AnnotationMarkedState = AnnotationMarkedState;
|
130
|
+
const AnnotationReviewState = {
|
131
|
+
ACCEPTED: "Accepted",
|
132
|
+
REJECTED: "Rejected",
|
133
|
+
CANCELLED: "Cancelled",
|
134
|
+
COMPLETED: "Completed",
|
135
|
+
NONE: "None"
|
136
|
+
};
|
137
|
+
exports.AnnotationReviewState = AnnotationReviewState;
|
138
|
+
const AnnotationReplyType = {
|
139
|
+
GROUP: "Group",
|
140
|
+
REPLY: "R"
|
141
|
+
};
|
142
|
+
exports.AnnotationReplyType = AnnotationReplyType;
|
143
|
+
const AnnotationFlag = {
|
151
144
|
INVISIBLE: 0x01,
|
152
145
|
HIDDEN: 0x02,
|
153
146
|
PRINT: 0x04,
|
@@ -160,7 +153,7 @@ var AnnotationFlag = {
|
|
160
153
|
LOCKEDCONTENTS: 0x200
|
161
154
|
};
|
162
155
|
exports.AnnotationFlag = AnnotationFlag;
|
163
|
-
|
156
|
+
const AnnotationFieldFlag = {
|
164
157
|
READONLY: 0x0000001,
|
165
158
|
REQUIRED: 0x0000002,
|
166
159
|
NOEXPORT: 0x0000004,
|
@@ -182,7 +175,7 @@ var AnnotationFieldFlag = {
|
|
182
175
|
COMMITONSELCHANGE: 0x4000000
|
183
176
|
};
|
184
177
|
exports.AnnotationFieldFlag = AnnotationFieldFlag;
|
185
|
-
|
178
|
+
const AnnotationBorderStyleType = {
|
186
179
|
SOLID: 1,
|
187
180
|
DASHED: 2,
|
188
181
|
BEVELED: 3,
|
@@ -190,46 +183,46 @@ var AnnotationBorderStyleType = {
|
|
190
183
|
UNDERLINE: 5
|
191
184
|
};
|
192
185
|
exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
|
193
|
-
|
194
|
-
UNKNOWN:
|
195
|
-
FLATE:
|
196
|
-
LZW:
|
197
|
-
DCT:
|
198
|
-
JPX:
|
199
|
-
JBIG:
|
200
|
-
A85:
|
201
|
-
AHX:
|
202
|
-
CCF:
|
203
|
-
|
186
|
+
const StreamType = {
|
187
|
+
UNKNOWN: "UNKNOWN",
|
188
|
+
FLATE: "FLATE",
|
189
|
+
LZW: "LZW",
|
190
|
+
DCT: "DCT",
|
191
|
+
JPX: "JPX",
|
192
|
+
JBIG: "JBIG",
|
193
|
+
A85: "A85",
|
194
|
+
AHX: "AHX",
|
195
|
+
CCF: "CCF",
|
196
|
+
RLX: "RLX"
|
204
197
|
};
|
205
198
|
exports.StreamType = StreamType;
|
206
|
-
|
207
|
-
UNKNOWN:
|
208
|
-
TYPE1:
|
209
|
-
TYPE1C:
|
210
|
-
CIDFONTTYPE0:
|
211
|
-
CIDFONTTYPE0C:
|
212
|
-
TRUETYPE:
|
213
|
-
CIDFONTTYPE2:
|
214
|
-
TYPE3:
|
215
|
-
OPENTYPE:
|
216
|
-
TYPE0:
|
217
|
-
MMTYPE1:
|
199
|
+
const FontType = {
|
200
|
+
UNKNOWN: "UNKNOWN",
|
201
|
+
TYPE1: "TYPE1",
|
202
|
+
TYPE1C: "TYPE1C",
|
203
|
+
CIDFONTTYPE0: "CIDFONTTYPE0",
|
204
|
+
CIDFONTTYPE0C: "CIDFONTTYPE0C",
|
205
|
+
TRUETYPE: "TRUETYPE",
|
206
|
+
CIDFONTTYPE2: "CIDFONTTYPE2",
|
207
|
+
TYPE3: "TYPE3",
|
208
|
+
OPENTYPE: "OPENTYPE",
|
209
|
+
TYPE0: "TYPE0",
|
210
|
+
MMTYPE1: "MMTYPE1"
|
218
211
|
};
|
219
212
|
exports.FontType = FontType;
|
220
|
-
|
213
|
+
const VerbosityLevel = {
|
221
214
|
ERRORS: 0,
|
222
215
|
WARNINGS: 1,
|
223
216
|
INFOS: 5
|
224
217
|
};
|
225
218
|
exports.VerbosityLevel = VerbosityLevel;
|
226
|
-
|
219
|
+
const CMapCompressionType = {
|
227
220
|
NONE: 0,
|
228
221
|
BINARY: 1,
|
229
222
|
STREAM: 2
|
230
223
|
};
|
231
224
|
exports.CMapCompressionType = CMapCompressionType;
|
232
|
-
|
225
|
+
const OPS = {
|
233
226
|
dependency: 1,
|
234
227
|
setLineWidth: 2,
|
235
228
|
setLineCap: 3,
|
@@ -323,21 +316,34 @@ var OPS = {
|
|
323
316
|
constructPath: 91
|
324
317
|
};
|
325
318
|
exports.OPS = OPS;
|
326
|
-
|
327
|
-
unknown:
|
328
|
-
forms:
|
329
|
-
javaScript:
|
330
|
-
smask:
|
331
|
-
shadingPattern:
|
332
|
-
font:
|
319
|
+
const UNSUPPORTED_FEATURES = {
|
320
|
+
unknown: "unknown",
|
321
|
+
forms: "forms",
|
322
|
+
javaScript: "javaScript",
|
323
|
+
smask: "smask",
|
324
|
+
shadingPattern: "shadingPattern",
|
325
|
+
font: "font",
|
326
|
+
errorTilingPattern: "errorTilingPattern",
|
327
|
+
errorExtGState: "errorExtGState",
|
328
|
+
errorXObject: "errorXObject",
|
329
|
+
errorFontLoadType3: "errorFontLoadType3",
|
330
|
+
errorFontState: "errorFontState",
|
331
|
+
errorFontMissing: "errorFontMissing",
|
332
|
+
errorFontTranslate: "errorFontTranslate",
|
333
|
+
errorColorSpace: "errorColorSpace",
|
334
|
+
errorOperatorList: "errorOperatorList",
|
335
|
+
errorFontToUnicode: "errorFontToUnicode",
|
336
|
+
errorFontLoadNative: "errorFontLoadNative",
|
337
|
+
errorFontGetPath: "errorFontGetPath",
|
338
|
+
errorMarkedContent: "errorMarkedContent"
|
333
339
|
};
|
334
340
|
exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
|
335
|
-
|
341
|
+
const PasswordResponses = {
|
336
342
|
NEED_PASSWORD: 1,
|
337
343
|
INCORRECT_PASSWORD: 2
|
338
344
|
};
|
339
345
|
exports.PasswordResponses = PasswordResponses;
|
340
|
-
|
346
|
+
let verbosity = VerbosityLevel.WARNINGS;
|
341
347
|
|
342
348
|
function setVerbosityLevel(level) {
|
343
349
|
if (Number.isInteger(level)) {
|
@@ -351,13 +357,13 @@ function getVerbosityLevel() {
|
|
351
357
|
|
352
358
|
function info(msg) {
|
353
359
|
if (verbosity >= VerbosityLevel.INFOS) {
|
354
|
-
console.log(
|
360
|
+
console.log(`Info: ${msg}`);
|
355
361
|
}
|
356
362
|
}
|
357
363
|
|
358
364
|
function warn(msg) {
|
359
365
|
if (verbosity >= VerbosityLevel.WARNINGS) {
|
360
|
-
console.log(
|
366
|
+
console.log(`Warning: ${msg}`);
|
361
367
|
}
|
362
368
|
}
|
363
369
|
|
@@ -372,17 +378,19 @@ function assert(cond, msg) {
|
|
372
378
|
}
|
373
379
|
|
374
380
|
function isSameOrigin(baseUrl, otherUrl) {
|
381
|
+
let base;
|
382
|
+
|
375
383
|
try {
|
376
|
-
|
384
|
+
base = new URL(baseUrl);
|
377
385
|
|
378
|
-
if (!base.origin || base.origin ===
|
386
|
+
if (!base.origin || base.origin === "null") {
|
379
387
|
return false;
|
380
388
|
}
|
381
389
|
} catch (e) {
|
382
390
|
return false;
|
383
391
|
}
|
384
392
|
|
385
|
-
|
393
|
+
const other = new URL(otherUrl, base);
|
386
394
|
return base.origin === other.origin;
|
387
395
|
}
|
388
396
|
|
@@ -392,11 +400,11 @@ function _isValidProtocol(url) {
|
|
392
400
|
}
|
393
401
|
|
394
402
|
switch (url.protocol) {
|
395
|
-
case
|
396
|
-
case
|
397
|
-
case
|
398
|
-
case
|
399
|
-
case
|
403
|
+
case "http:":
|
404
|
+
case "https:":
|
405
|
+
case "ftp:":
|
406
|
+
case "mailto:":
|
407
|
+
case "tel:":
|
400
408
|
return true;
|
401
409
|
|
402
410
|
default:
|
@@ -410,7 +418,7 @@ function createValidAbsoluteUrl(url, baseUrl) {
|
|
410
418
|
}
|
411
419
|
|
412
420
|
try {
|
413
|
-
|
421
|
+
const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
|
414
422
|
|
415
423
|
if (_isValidProtocol(absoluteUrl)) {
|
416
424
|
return absoluteUrl;
|
@@ -422,7 +430,7 @@ function createValidAbsoluteUrl(url, baseUrl) {
|
|
422
430
|
|
423
431
|
function shadow(obj, prop, value) {
|
424
432
|
Object.defineProperty(obj, prop, {
|
425
|
-
value
|
433
|
+
value,
|
426
434
|
enumerable: true,
|
427
435
|
configurable: true,
|
428
436
|
writable: false
|
@@ -430,137 +438,106 @@ function shadow(obj, prop, value) {
|
|
430
438
|
return value;
|
431
439
|
}
|
432
440
|
|
433
|
-
|
434
|
-
function
|
435
|
-
this.
|
436
|
-
|
437
|
-
|
441
|
+
const BaseException = function BaseExceptionClosure() {
|
442
|
+
function BaseException(message) {
|
443
|
+
if (this.constructor === BaseException) {
|
444
|
+
unreachable("Cannot initialize BaseException.");
|
445
|
+
}
|
446
|
+
|
447
|
+
this.message = message;
|
448
|
+
this.name = this.constructor.name;
|
438
449
|
}
|
439
450
|
|
440
|
-
|
441
|
-
|
442
|
-
return
|
451
|
+
BaseException.prototype = new Error();
|
452
|
+
BaseException.constructor = BaseException;
|
453
|
+
return BaseException;
|
443
454
|
}();
|
444
455
|
|
456
|
+
exports.BaseException = BaseException;
|
457
|
+
|
458
|
+
class PasswordException extends BaseException {
|
459
|
+
constructor(msg, code) {
|
460
|
+
super(msg);
|
461
|
+
this.code = code;
|
462
|
+
}
|
463
|
+
|
464
|
+
}
|
465
|
+
|
445
466
|
exports.PasswordException = PasswordException;
|
446
467
|
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
this.message = msg;
|
468
|
+
class UnknownErrorException extends BaseException {
|
469
|
+
constructor(msg, details) {
|
470
|
+
super(msg);
|
451
471
|
this.details = details;
|
452
472
|
}
|
453
473
|
|
454
|
-
|
455
|
-
UnknownErrorException.constructor = UnknownErrorException;
|
456
|
-
return UnknownErrorException;
|
457
|
-
}();
|
474
|
+
}
|
458
475
|
|
459
476
|
exports.UnknownErrorException = UnknownErrorException;
|
460
477
|
|
461
|
-
|
462
|
-
function InvalidPDFException(msg) {
|
463
|
-
this.name = 'InvalidPDFException';
|
464
|
-
this.message = msg;
|
465
|
-
}
|
466
|
-
|
467
|
-
InvalidPDFException.prototype = new Error();
|
468
|
-
InvalidPDFException.constructor = InvalidPDFException;
|
469
|
-
return InvalidPDFException;
|
470
|
-
}();
|
478
|
+
class InvalidPDFException extends BaseException {}
|
471
479
|
|
472
480
|
exports.InvalidPDFException = InvalidPDFException;
|
473
481
|
|
474
|
-
|
475
|
-
function MissingPDFException(msg) {
|
476
|
-
this.name = 'MissingPDFException';
|
477
|
-
this.message = msg;
|
478
|
-
}
|
479
|
-
|
480
|
-
MissingPDFException.prototype = new Error();
|
481
|
-
MissingPDFException.constructor = MissingPDFException;
|
482
|
-
return MissingPDFException;
|
483
|
-
}();
|
482
|
+
class MissingPDFException extends BaseException {}
|
484
483
|
|
485
484
|
exports.MissingPDFException = MissingPDFException;
|
486
485
|
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
this.message = msg;
|
486
|
+
class UnexpectedResponseException extends BaseException {
|
487
|
+
constructor(msg, status) {
|
488
|
+
super(msg);
|
491
489
|
this.status = status;
|
492
490
|
}
|
493
491
|
|
494
|
-
|
495
|
-
UnexpectedResponseException.constructor = UnexpectedResponseException;
|
496
|
-
return UnexpectedResponseException;
|
497
|
-
}();
|
492
|
+
}
|
498
493
|
|
499
494
|
exports.UnexpectedResponseException = UnexpectedResponseException;
|
500
495
|
|
501
|
-
|
502
|
-
function FormatError(msg) {
|
503
|
-
this.message = msg;
|
504
|
-
}
|
505
|
-
|
506
|
-
FormatError.prototype = new Error();
|
507
|
-
FormatError.prototype.name = 'FormatError';
|
508
|
-
FormatError.constructor = FormatError;
|
509
|
-
return FormatError;
|
510
|
-
}();
|
496
|
+
class FormatError extends BaseException {}
|
511
497
|
|
512
498
|
exports.FormatError = FormatError;
|
513
499
|
|
514
|
-
|
515
|
-
function AbortException(msg) {
|
516
|
-
this.name = 'AbortException';
|
517
|
-
this.message = msg;
|
518
|
-
}
|
519
|
-
|
520
|
-
AbortException.prototype = new Error();
|
521
|
-
AbortException.constructor = AbortException;
|
522
|
-
return AbortException;
|
523
|
-
}();
|
500
|
+
class AbortException extends BaseException {}
|
524
501
|
|
525
502
|
exports.AbortException = AbortException;
|
526
|
-
|
503
|
+
const NullCharactersRegExp = /\x00/g;
|
527
504
|
|
528
505
|
function removeNullCharacters(str) {
|
529
|
-
if (typeof str !==
|
530
|
-
warn(
|
506
|
+
if (typeof str !== "string") {
|
507
|
+
warn("The argument for removeNullCharacters must be a string.");
|
531
508
|
return str;
|
532
509
|
}
|
533
510
|
|
534
|
-
return str.replace(NullCharactersRegExp,
|
511
|
+
return str.replace(NullCharactersRegExp, "");
|
535
512
|
}
|
536
513
|
|
537
514
|
function bytesToString(bytes) {
|
538
|
-
assert(bytes !== null &&
|
539
|
-
|
540
|
-
|
515
|
+
assert(bytes !== null && typeof bytes === "object" && bytes.length !== undefined, "Invalid argument for bytesToString");
|
516
|
+
const length = bytes.length;
|
517
|
+
const MAX_ARGUMENT_COUNT = 8192;
|
541
518
|
|
542
519
|
if (length < MAX_ARGUMENT_COUNT) {
|
543
520
|
return String.fromCharCode.apply(null, bytes);
|
544
521
|
}
|
545
522
|
|
546
|
-
|
523
|
+
const strBuf = [];
|
547
524
|
|
548
|
-
for (
|
549
|
-
|
550
|
-
|
525
|
+
for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
|
526
|
+
const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
|
527
|
+
const chunk = bytes.subarray(i, chunkEnd);
|
551
528
|
strBuf.push(String.fromCharCode.apply(null, chunk));
|
552
529
|
}
|
553
530
|
|
554
|
-
return strBuf.join(
|
531
|
+
return strBuf.join("");
|
555
532
|
}
|
556
533
|
|
557
534
|
function stringToBytes(str) {
|
558
|
-
assert(typeof str ===
|
559
|
-
|
560
|
-
|
535
|
+
assert(typeof str === "string", "Invalid argument for stringToBytes");
|
536
|
+
const length = str.length;
|
537
|
+
const bytes = new Uint8Array(length);
|
561
538
|
|
562
|
-
for (
|
563
|
-
bytes[i] = str.charCodeAt(i) &
|
539
|
+
for (let i = 0; i < length; ++i) {
|
540
|
+
bytes[i] = str.charCodeAt(i) & 0xff;
|
564
541
|
}
|
565
542
|
|
566
543
|
return bytes;
|
@@ -571,41 +548,38 @@ function arrayByteLength(arr) {
|
|
571
548
|
return arr.length;
|
572
549
|
}
|
573
550
|
|
574
|
-
assert(arr.byteLength !== undefined);
|
551
|
+
assert(arr.byteLength !== undefined, "arrayByteLength - invalid argument.");
|
575
552
|
return arr.byteLength;
|
576
553
|
}
|
577
554
|
|
578
555
|
function arraysToBytes(arr) {
|
579
|
-
|
556
|
+
const length = arr.length;
|
557
|
+
|
558
|
+
if (length === 1 && arr[0] instanceof Uint8Array) {
|
580
559
|
return arr[0];
|
581
560
|
}
|
582
561
|
|
583
|
-
|
584
|
-
var i,
|
585
|
-
ii = arr.length;
|
586
|
-
var item, itemLength;
|
562
|
+
let resultLength = 0;
|
587
563
|
|
588
|
-
for (i = 0; i <
|
589
|
-
|
590
|
-
itemLength = arrayByteLength(item);
|
591
|
-
resultLength += itemLength;
|
564
|
+
for (let i = 0; i < length; i++) {
|
565
|
+
resultLength += arrayByteLength(arr[i]);
|
592
566
|
}
|
593
567
|
|
594
|
-
|
595
|
-
|
568
|
+
let pos = 0;
|
569
|
+
const data = new Uint8Array(resultLength);
|
596
570
|
|
597
|
-
for (i = 0; i <
|
598
|
-
item = arr[i];
|
571
|
+
for (let i = 0; i < length; i++) {
|
572
|
+
let item = arr[i];
|
599
573
|
|
600
574
|
if (!(item instanceof Uint8Array)) {
|
601
|
-
if (typeof item ===
|
575
|
+
if (typeof item === "string") {
|
602
576
|
item = stringToBytes(item);
|
603
577
|
} else {
|
604
578
|
item = new Uint8Array(item);
|
605
579
|
}
|
606
580
|
}
|
607
581
|
|
608
|
-
itemLength = item.byteLength;
|
582
|
+
const itemLength = item.byteLength;
|
609
583
|
data.set(item, pos);
|
610
584
|
pos += itemLength;
|
611
585
|
}
|
@@ -617,103 +591,96 @@ function string32(value) {
|
|
617
591
|
return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
|
618
592
|
}
|
619
593
|
|
620
|
-
function log2(x) {
|
621
|
-
if (x <= 0) {
|
622
|
-
return 0;
|
623
|
-
}
|
624
|
-
|
625
|
-
return Math.ceil(Math.log2(x));
|
626
|
-
}
|
627
|
-
|
628
|
-
function readInt8(data, start) {
|
629
|
-
return data[start] << 24 >> 24;
|
630
|
-
}
|
631
|
-
|
632
|
-
function readUint16(data, offset) {
|
633
|
-
return data[offset] << 8 | data[offset + 1];
|
634
|
-
}
|
635
|
-
|
636
|
-
function readUint32(data, offset) {
|
637
|
-
return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
|
638
|
-
}
|
639
|
-
|
640
594
|
function isLittleEndian() {
|
641
|
-
|
595
|
+
const buffer8 = new Uint8Array(4);
|
642
596
|
buffer8[0] = 1;
|
643
|
-
|
597
|
+
const view32 = new Uint32Array(buffer8.buffer, 0, 1);
|
644
598
|
return view32[0] === 1;
|
645
599
|
}
|
646
600
|
|
601
|
+
const IsLittleEndianCached = {
|
602
|
+
get value() {
|
603
|
+
return shadow(this, "value", isLittleEndian());
|
604
|
+
}
|
605
|
+
|
606
|
+
};
|
607
|
+
exports.IsLittleEndianCached = IsLittleEndianCached;
|
608
|
+
|
647
609
|
function isEvalSupported() {
|
648
610
|
try {
|
649
|
-
new Function(
|
611
|
+
new Function("");
|
650
612
|
return true;
|
651
613
|
} catch (e) {
|
652
614
|
return false;
|
653
615
|
}
|
654
616
|
}
|
655
617
|
|
656
|
-
|
657
|
-
|
618
|
+
const IsEvalSupportedCached = {
|
619
|
+
get value() {
|
620
|
+
return shadow(this, "value", isEvalSupported());
|
621
|
+
}
|
658
622
|
|
659
|
-
|
623
|
+
};
|
624
|
+
exports.IsEvalSupportedCached = IsEvalSupportedCached;
|
625
|
+
const rgbBuf = ["rgb(", 0, ",", 0, ",", 0, ")"];
|
660
626
|
|
661
|
-
|
627
|
+
class Util {
|
628
|
+
static makeCssRgb(r, g, b) {
|
662
629
|
rgbBuf[1] = r;
|
663
630
|
rgbBuf[3] = g;
|
664
631
|
rgbBuf[5] = b;
|
665
|
-
return rgbBuf.join(
|
666
|
-
}
|
632
|
+
return rgbBuf.join("");
|
633
|
+
}
|
667
634
|
|
668
|
-
|
635
|
+
static transform(m1, m2) {
|
669
636
|
return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]];
|
670
|
-
}
|
637
|
+
}
|
671
638
|
|
672
|
-
|
673
|
-
|
674
|
-
|
639
|
+
static applyTransform(p, m) {
|
640
|
+
const xt = p[0] * m[0] + p[1] * m[2] + m[4];
|
641
|
+
const yt = p[0] * m[1] + p[1] * m[3] + m[5];
|
675
642
|
return [xt, yt];
|
676
|
-
}
|
643
|
+
}
|
677
644
|
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
645
|
+
static applyInverseTransform(p, m) {
|
646
|
+
const d = m[0] * m[3] - m[1] * m[2];
|
647
|
+
const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
|
648
|
+
const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
|
682
649
|
return [xt, yt];
|
683
|
-
}
|
650
|
+
}
|
684
651
|
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
652
|
+
static getAxialAlignedBoundingBox(r, m) {
|
653
|
+
const p1 = Util.applyTransform(r, m);
|
654
|
+
const p2 = Util.applyTransform(r.slice(2, 4), m);
|
655
|
+
const p3 = Util.applyTransform([r[0], r[3]], m);
|
656
|
+
const p4 = Util.applyTransform([r[2], r[1]], m);
|
690
657
|
return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1])];
|
691
|
-
}
|
658
|
+
}
|
692
659
|
|
693
|
-
|
694
|
-
|
660
|
+
static inverseTransform(m) {
|
661
|
+
const d = m[0] * m[3] - m[1] * m[2];
|
695
662
|
return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d];
|
696
|
-
}
|
663
|
+
}
|
697
664
|
|
698
|
-
|
665
|
+
static apply3dTransform(m, v) {
|
699
666
|
return [m[0] * v[0] + m[1] * v[1] + m[2] * v[2], m[3] * v[0] + m[4] * v[1] + m[5] * v[2], m[6] * v[0] + m[7] * v[1] + m[8] * v[2]];
|
700
|
-
}
|
667
|
+
}
|
701
668
|
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
669
|
+
static singularValueDecompose2dScale(m) {
|
670
|
+
const transpose = [m[0], m[2], m[1], m[3]];
|
671
|
+
const a = m[0] * transpose[0] + m[1] * transpose[2];
|
672
|
+
const b = m[0] * transpose[1] + m[1] * transpose[3];
|
673
|
+
const c = m[2] * transpose[0] + m[3] * transpose[2];
|
674
|
+
const d = m[2] * transpose[1] + m[3] * transpose[3];
|
675
|
+
const first = (a + d) / 2;
|
676
|
+
const second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;
|
677
|
+
const sx = first + second || 1;
|
678
|
+
const sy = first - second || 1;
|
712
679
|
return [Math.sqrt(sx), Math.sqrt(sy)];
|
713
|
-
}
|
680
|
+
}
|
714
681
|
|
715
|
-
|
716
|
-
|
682
|
+
static normalizeRect(rect) {
|
683
|
+
const r = rect.slice(0);
|
717
684
|
|
718
685
|
if (rect[0] > rect[2]) {
|
719
686
|
r[0] = rect[2];
|
@@ -726,16 +693,16 @@ var Util = function UtilClosure() {
|
|
726
693
|
}
|
727
694
|
|
728
695
|
return r;
|
729
|
-
}
|
696
|
+
}
|
730
697
|
|
731
|
-
|
698
|
+
static intersect(rect1, rect2) {
|
732
699
|
function compare(a, b) {
|
733
700
|
return a - b;
|
734
701
|
}
|
735
702
|
|
736
|
-
|
737
|
-
|
738
|
-
|
703
|
+
const orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);
|
704
|
+
const orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare);
|
705
|
+
const result = [];
|
739
706
|
rect1 = Util.normalizeRect(rect1);
|
740
707
|
rect2 = Util.normalizeRect(rect2);
|
741
708
|
|
@@ -743,42 +710,48 @@ var Util = function UtilClosure() {
|
|
743
710
|
result[0] = orderedX[1];
|
744
711
|
result[2] = orderedX[2];
|
745
712
|
} else {
|
746
|
-
return
|
713
|
+
return null;
|
747
714
|
}
|
748
715
|
|
749
716
|
if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
|
750
717
|
result[1] = orderedY[1];
|
751
718
|
result[3] = orderedY[2];
|
752
719
|
} else {
|
753
|
-
return
|
720
|
+
return null;
|
754
721
|
}
|
755
722
|
|
756
723
|
return result;
|
757
|
-
}
|
724
|
+
}
|
758
725
|
|
759
|
-
|
760
|
-
}();
|
726
|
+
}
|
761
727
|
|
762
728
|
exports.Util = Util;
|
763
|
-
|
729
|
+
const PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2D8, 0x2C7, 0x2C6, 0x2D9, 0x2DD, 0x2DB, 0x2DA, 0x2DC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203A, 0x2212, 0x2030, 0x201E, 0x201C, 0x201D, 0x2018, 0x2019, 0x201A, 0x2122, 0xFB01, 0xFB02, 0x141, 0x152, 0x160, 0x178, 0x17D, 0x131, 0x142, 0x153, 0x161, 0x17E, 0, 0x20AC];
|
764
730
|
|
765
731
|
function stringToPDFString(str) {
|
766
|
-
|
767
|
-
|
768
|
-
strBuf = [];
|
732
|
+
const length = str.length,
|
733
|
+
strBuf = [];
|
769
734
|
|
770
|
-
if (str[0] ===
|
771
|
-
for (i = 2; i <
|
735
|
+
if (str[0] === "\xFE" && str[1] === "\xFF") {
|
736
|
+
for (let i = 2; i < length; i += 2) {
|
772
737
|
strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
|
773
738
|
}
|
739
|
+
} else if (str[0] === "\xFF" && str[1] === "\xFE") {
|
740
|
+
for (let i = 2; i < length; i += 2) {
|
741
|
+
strBuf.push(String.fromCharCode(str.charCodeAt(i + 1) << 8 | str.charCodeAt(i)));
|
742
|
+
}
|
774
743
|
} else {
|
775
|
-
for (i = 0; i <
|
776
|
-
|
744
|
+
for (let i = 0; i < length; ++i) {
|
745
|
+
const code = PDFStringTranslateTable[str.charCodeAt(i)];
|
777
746
|
strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
|
778
747
|
}
|
779
748
|
}
|
780
749
|
|
781
|
-
return strBuf.join(
|
750
|
+
return strBuf.join("");
|
751
|
+
}
|
752
|
+
|
753
|
+
function escapeString(str) {
|
754
|
+
return str.replace(/([\(\)\\])/g, "\\$1");
|
782
755
|
}
|
783
756
|
|
784
757
|
function stringToUTF8String(str) {
|
@@ -789,28 +762,20 @@ function utf8StringToString(str) {
|
|
789
762
|
return unescape(encodeURIComponent(str));
|
790
763
|
}
|
791
764
|
|
792
|
-
function isEmptyObj(obj) {
|
793
|
-
for (var key in obj) {
|
794
|
-
return false;
|
795
|
-
}
|
796
|
-
|
797
|
-
return true;
|
798
|
-
}
|
799
|
-
|
800
765
|
function isBool(v) {
|
801
|
-
return typeof v ===
|
766
|
+
return typeof v === "boolean";
|
802
767
|
}
|
803
768
|
|
804
769
|
function isNum(v) {
|
805
|
-
return typeof v ===
|
770
|
+
return typeof v === "number";
|
806
771
|
}
|
807
772
|
|
808
773
|
function isString(v) {
|
809
|
-
return typeof v ===
|
774
|
+
return typeof v === "string";
|
810
775
|
}
|
811
776
|
|
812
777
|
function isArrayBuffer(v) {
|
813
|
-
return
|
778
|
+
return typeof v === "object" && v !== null && v.byteLength !== undefined;
|
814
779
|
}
|
815
780
|
|
816
781
|
function isArrayEqual(arr1, arr2) {
|
@@ -823,17 +788,19 @@ function isArrayEqual(arr1, arr2) {
|
|
823
788
|
});
|
824
789
|
}
|
825
790
|
|
826
|
-
function
|
827
|
-
|
791
|
+
function getModificationDate(date = new Date(Date.now())) {
|
792
|
+
const buffer = [date.getUTCFullYear().toString(), (date.getUTCMonth() + 1).toString().padStart(2, "0"), (date.getUTCDate() + 1).toString().padStart(2, "0"), date.getUTCHours().toString().padStart(2, "0"), date.getUTCMinutes().toString().padStart(2, "0"), date.getUTCSeconds().toString().padStart(2, "0")];
|
793
|
+
return buffer.join("");
|
828
794
|
}
|
829
795
|
|
830
796
|
function createPromiseCapability() {
|
831
|
-
|
832
|
-
|
833
|
-
Object.defineProperty(capability,
|
834
|
-
get
|
797
|
+
const capability = Object.create(null);
|
798
|
+
let isSettled = false;
|
799
|
+
Object.defineProperty(capability, "settled", {
|
800
|
+
get() {
|
835
801
|
return isSettled;
|
836
802
|
}
|
803
|
+
|
837
804
|
});
|
838
805
|
capability.promise = new Promise(function (resolve, reject) {
|
839
806
|
capability.resolve = function (data) {
|
@@ -849,28 +816,26 @@ function createPromiseCapability() {
|
|
849
816
|
return capability;
|
850
817
|
}
|
851
818
|
|
852
|
-
|
853
|
-
|
854
|
-
return function createObjectURL(data, contentType) {
|
855
|
-
|
856
|
-
|
857
|
-
if (!forceDataSchema && _url_polyfill.URL.createObjectURL) {
|
858
|
-
var blob = new Blob([data], {
|
819
|
+
const createObjectURL = function createObjectURLClosure() {
|
820
|
+
const digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
821
|
+
return function createObjectURL(data, contentType, forceDataSchema = false) {
|
822
|
+
if (!forceDataSchema && URL.createObjectURL) {
|
823
|
+
const blob = new Blob([data], {
|
859
824
|
type: contentType
|
860
825
|
});
|
861
|
-
return
|
826
|
+
return URL.createObjectURL(blob);
|
862
827
|
}
|
863
828
|
|
864
|
-
|
829
|
+
let buffer = `data:${contentType};base64,`;
|
865
830
|
|
866
|
-
for (
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
831
|
+
for (let i = 0, ii = data.length; i < ii; i += 3) {
|
832
|
+
const b1 = data[i] & 0xff;
|
833
|
+
const b2 = data[i + 1] & 0xff;
|
834
|
+
const b3 = data[i + 2] & 0xff;
|
835
|
+
const d1 = b1 >> 2,
|
836
|
+
d2 = (b1 & 3) << 4 | b2 >> 4;
|
837
|
+
const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64;
|
838
|
+
const d4 = i + 2 < ii ? b3 & 0x3f : 64;
|
874
839
|
buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
|
875
840
|
}
|
876
841
|
|