pdfjs-dist 2.0.943 → 2.4.456
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pdfjs-dist might be problematic. Click here for more details.
- package/CODE_OF_CONDUCT.md +15 -0
- package/README.md +4 -0
- package/bower.json +1 -1
- package/build/pdf.js +8286 -14230
- 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 +25500 -26628
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +22 -1
- package/es5/build/pdf.js +25473 -0
- package/es5/build/pdf.js.map +1 -0
- package/{lib/shared/global_scope.js → es5/build/pdf.worker.entry.js} +5 -10
- package/es5/build/pdf.worker.js +57878 -0
- package/es5/build/pdf.worker.js.map +1 -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/images/texture.png +0 -0
- package/es5/web/pdf_viewer.css +407 -0
- package/es5/web/pdf_viewer.js +7757 -0
- package/es5/web/pdf_viewer.js.map +1 -0
- package/image_decoders/pdf.image_decoders.js +2887 -4094
- 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 +855 -778
- package/lib/core/arithmetic_decoder.js +325 -311
- package/lib/core/bidi.js +117 -50
- package/lib/core/ccitt.js +251 -89
- package/lib/core/ccitt_stream.js +26 -16
- package/lib/core/cff_parser.js +525 -197
- package/lib/core/charsets.js +6 -5
- package/lib/core/chunked_stream.js +541 -406
- package/lib/core/cmap.js +368 -253
- package/lib/core/colorspace.js +781 -800
- package/lib/core/core_utils.js +152 -0
- package/lib/core/crypto.js +609 -422
- package/lib/core/document.js +649 -481
- package/lib/core/encodings.js +33 -24
- package/lib/core/evaluator.js +1471 -736
- package/lib/core/font_renderer.js +289 -149
- package/lib/core/fonts.js +1067 -413
- package/lib/core/function.js +517 -287
- package/lib/core/glyphlist.js +4529 -4527
- package/lib/core/image.js +232 -114
- package/lib/core/image_utils.js +94 -0
- package/lib/core/jbig2.js +711 -342
- package/lib/core/jbig2_stream.js +31 -19
- package/lib/core/jpeg_stream.js +151 -26
- package/lib/core/jpg.js +433 -181
- package/lib/core/jpx.js +551 -143
- package/lib/core/jpx_stream.js +40 -28
- package/lib/core/metrics.js +2931 -2931
- package/lib/core/murmurhash3.js +104 -97
- package/lib/core/obj.js +1561 -1053
- package/lib/core/operator_list.js +192 -64
- package/lib/core/parser.js +1162 -864
- package/lib/core/pattern.js +224 -75
- package/lib/core/pdf_manager.js +154 -285
- package/lib/core/primitives.js +145 -69
- package/lib/core/ps_parser.js +212 -162
- package/lib/core/standard_fonts.js +245 -244
- package/lib/core/stream.js +353 -81
- package/lib/core/type1_parser.js +218 -68
- package/lib/core/unicode.js +1682 -1655
- package/lib/core/worker.js +233 -302
- package/lib/core/worker_stream.js +168 -0
- package/lib/display/annotation_layer.js +808 -862
- package/lib/display/api.js +1778 -1462
- package/lib/display/api_compatibility.js +14 -9
- package/lib/display/canvas.js +463 -140
- package/lib/display/content_disposition.js +86 -58
- package/lib/display/display_utils.js +524 -0
- package/lib/display/fetch_stream.js +202 -274
- package/lib/display/font_loader.js +311 -333
- package/lib/display/metadata.js +98 -88
- package/lib/display/network.js +343 -347
- package/lib/display/network_utils.js +46 -26
- package/lib/display/node_stream.js +326 -404
- package/lib/display/pattern_helper.js +168 -69
- package/lib/display/svg.js +1296 -885
- package/lib/display/text_layer.js +229 -103
- package/lib/display/transport_stream.js +290 -250
- package/lib/display/webgl.js +116 -83
- package/lib/display/worker_options.js +6 -5
- package/lib/display/xml_parser.js +358 -337
- package/lib/examples/node/domstubs.js +95 -39
- package/lib/pdf.js +49 -31
- package/lib/pdf.worker.js +7 -5
- package/lib/shared/compatibility.js +3 -145
- package/lib/shared/is_node.js +8 -7
- package/lib/shared/message_handler.js +367 -314
- package/lib/shared/util.js +421 -415
- package/lib/test/unit/annotation_spec.js +1570 -690
- package/lib/test/unit/api_spec.js +855 -493
- package/lib/test/unit/bidi_spec.js +12 -12
- package/lib/test/unit/cff_parser_spec.js +88 -61
- package/lib/test/unit/clitests_helper.js +9 -12
- package/lib/test/unit/cmap_spec.js +140 -88
- package/lib/test/unit/colorspace_spec.js +204 -152
- package/lib/test/unit/core_utils_spec.js +211 -0
- package/lib/test/unit/crypto_spec.js +194 -182
- package/lib/test/unit/custom_spec.js +50 -64
- package/lib/test/unit/display_svg_spec.js +53 -38
- package/lib/test/unit/display_utils_spec.js +263 -0
- package/lib/test/unit/document_spec.js +17 -22
- package/lib/test/unit/encodings_spec.js +15 -57
- package/lib/test/unit/evaluator_spec.js +90 -83
- package/lib/test/unit/fetch_stream_spec.js +111 -0
- package/lib/test/unit/function_spec.js +219 -205
- package/lib/test/unit/jasmine-boot.js +68 -39
- package/lib/test/unit/message_handler_spec.js +187 -160
- package/lib/test/unit/metadata_spec.js +87 -34
- package/lib/test/unit/murmurhash3_spec.js +13 -13
- package/lib/test/unit/network_spec.js +26 -59
- package/lib/test/unit/network_utils_spec.js +187 -121
- package/lib/test/unit/node_stream_spec.js +98 -90
- package/lib/test/unit/parser_spec.js +173 -131
- package/lib/test/unit/pdf_find_controller_spec.js +148 -67
- package/lib/test/unit/pdf_find_utils_spec.js +35 -34
- package/lib/test/unit/pdf_history_spec.js +45 -33
- package/lib/test/unit/primitives_spec.js +161 -126
- package/lib/test/unit/stream_spec.js +22 -15
- package/lib/test/unit/test_utils.js +149 -98
- package/lib/test/unit/testreporter.js +36 -18
- package/lib/test/unit/type1_parser_spec.js +46 -44
- package/lib/test/unit/ui_utils_spec.js +388 -372
- package/lib/test/unit/unicode_spec.js +49 -46
- package/lib/test/unit/util_spec.js +144 -248
- package/lib/web/annotation_layer_builder.js +75 -95
- package/lib/web/app.js +1538 -1147
- package/lib/web/app_options.js +116 -104
- package/lib/web/base_viewer.js +950 -775
- package/lib/web/chromecom.js +217 -225
- package/lib/web/debugger.js +236 -148
- package/lib/web/download_manager.js +50 -50
- package/lib/web/firefox_print_service.js +51 -33
- package/lib/web/firefoxcom.js +225 -352
- package/lib/web/genericcom.js +30 -93
- package/lib/web/genericl10n.js +26 -143
- package/lib/web/grab_to_pan.js +57 -33
- package/lib/web/interfaces.js +105 -232
- package/lib/web/overlay_manager.js +73 -227
- package/lib/web/password_prompt.js +44 -62
- package/lib/web/pdf_attachment_viewer.js +118 -123
- package/lib/web/pdf_cursor_tools.js +89 -93
- package/lib/web/pdf_document_properties.js +242 -281
- package/lib/web/pdf_find_bar.js +157 -163
- package/lib/web/pdf_find_controller.js +598 -454
- package/lib/web/pdf_find_utils.js +32 -16
- package/lib/web/pdf_history.js +481 -355
- package/lib/web/pdf_link_service.js +355 -323
- package/lib/web/pdf_outline_viewer.js +167 -152
- package/lib/web/pdf_page_view.js +511 -457
- package/lib/web/pdf_presentation_mode.js +347 -335
- package/lib/web/pdf_print_service.js +133 -103
- package/lib/web/pdf_rendering_queue.js +98 -100
- package/lib/web/pdf_sidebar.js +323 -299
- package/lib/web/pdf_sidebar_resizer.js +107 -108
- package/lib/web/pdf_single_page_viewer.js +94 -146
- package/lib/web/pdf_thumbnail_view.js +319 -269
- package/lib/web/pdf_thumbnail_viewer.js +219 -199
- package/lib/web/pdf_viewer.component.js +111 -32
- package/lib/web/pdf_viewer.js +61 -101
- package/lib/web/preferences.js +87 -272
- package/lib/web/secondary_toolbar.js +207 -220
- package/lib/web/text_layer_builder.js +322 -322
- package/lib/web/toolbar.js +227 -180
- package/lib/web/ui_utils.js +476 -421
- package/lib/web/view_history.js +59 -208
- package/lib/web/viewer_compatibility.js +9 -6
- package/package.json +2 -9
- package/web/pdf_viewer.css +36 -22
- package/web/pdf_viewer.js +4407 -4516
- package/web/pdf_viewer.js.map +1 -1
- package/webpack.js +14 -5
- package/external/streams/streams-lib.js +0 -3962
- package/external/url/url-lib.js +0 -627
- package/lib/display/dom_utils.js +0 -441
- package/lib/shared/streams_polyfill.js +0 -39
- package/lib/shared/url_polyfill.js +0 -50
- package/lib/test/unit/dom_utils_spec.js +0 -89
- package/lib/web/dom_events.js +0 -140
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.
|
@@ -19,29 +19,51 @@
|
|
19
19
|
* @licend The above is the entire license notice for the
|
20
20
|
* Javascript code in this page
|
21
21
|
*/
|
22
|
-
|
22
|
+
"use strict";
|
23
23
|
|
24
24
|
Object.defineProperty(exports, "__esModule", {
|
25
25
|
value: true
|
26
26
|
});
|
27
|
-
exports.
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
27
|
+
exports.arrayByteLength = arrayByteLength;
|
28
|
+
exports.arraysToBytes = arraysToBytes;
|
29
|
+
exports.assert = assert;
|
30
|
+
exports.bytesToString = bytesToString;
|
31
|
+
exports.createPromiseCapability = createPromiseCapability;
|
32
|
+
exports.getVerbosityLevel = getVerbosityLevel;
|
33
|
+
exports.info = info;
|
34
|
+
exports.isArrayBuffer = isArrayBuffer;
|
35
|
+
exports.isArrayEqual = isArrayEqual;
|
36
|
+
exports.isBool = isBool;
|
37
|
+
exports.isEmptyObj = isEmptyObj;
|
38
|
+
exports.isNum = isNum;
|
39
|
+
exports.isString = isString;
|
40
|
+
exports.isSameOrigin = isSameOrigin;
|
41
|
+
exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
|
42
|
+
exports.removeNullCharacters = removeNullCharacters;
|
43
|
+
exports.setVerbosityLevel = setVerbosityLevel;
|
44
|
+
exports.shadow = shadow;
|
45
|
+
exports.string32 = string32;
|
46
|
+
exports.stringToBytes = stringToBytes;
|
47
|
+
exports.stringToPDFString = stringToPDFString;
|
48
|
+
exports.stringToUTF8String = stringToUTF8String;
|
49
|
+
exports.utf8StringToString = utf8StringToString;
|
50
|
+
exports.warn = warn;
|
51
|
+
exports.unreachable = unreachable;
|
52
|
+
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.NativeImageDecoding = 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;
|
34
53
|
|
35
|
-
|
54
|
+
require("./compatibility.js");
|
36
55
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
56
|
+
const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
|
57
|
+
exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
|
58
|
+
const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
|
59
|
+
exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
|
60
|
+
const NativeImageDecoding = {
|
61
|
+
NONE: "none",
|
62
|
+
DECODE: "decode",
|
63
|
+
DISPLAY: "display"
|
43
64
|
};
|
44
|
-
|
65
|
+
exports.NativeImageDecoding = NativeImageDecoding;
|
66
|
+
const PermissionFlag = {
|
45
67
|
PRINT: 0x04,
|
46
68
|
MODIFY_CONTENTS: 0x08,
|
47
69
|
COPY: 0x10,
|
@@ -51,7 +73,8 @@ var PermissionFlag = {
|
|
51
73
|
ASSEMBLE: 0x400,
|
52
74
|
PRINT_HIGH_QUALITY: 0x800
|
53
75
|
};
|
54
|
-
|
76
|
+
exports.PermissionFlag = PermissionFlag;
|
77
|
+
const TextRenderingMode = {
|
55
78
|
FILL: 0,
|
56
79
|
STROKE: 1,
|
57
80
|
FILL_STROKE: 2,
|
@@ -63,12 +86,14 @@ var TextRenderingMode = {
|
|
63
86
|
FILL_STROKE_MASK: 3,
|
64
87
|
ADD_TO_PATH_FLAG: 4
|
65
88
|
};
|
66
|
-
|
89
|
+
exports.TextRenderingMode = TextRenderingMode;
|
90
|
+
const ImageKind = {
|
67
91
|
GRAYSCALE_1BPP: 1,
|
68
92
|
RGB_24BPP: 2,
|
69
93
|
RGBA_32BPP: 3
|
70
94
|
};
|
71
|
-
|
95
|
+
exports.ImageKind = ImageKind;
|
96
|
+
const AnnotationType = {
|
72
97
|
TEXT: 1,
|
73
98
|
LINK: 2,
|
74
99
|
FREETEXT: 3,
|
@@ -96,7 +121,31 @@ var AnnotationType = {
|
|
96
121
|
THREED: 25,
|
97
122
|
REDACT: 26
|
98
123
|
};
|
99
|
-
|
124
|
+
exports.AnnotationType = AnnotationType;
|
125
|
+
const AnnotationStateModelType = {
|
126
|
+
MARKED: "Marked",
|
127
|
+
REVIEW: "Review"
|
128
|
+
};
|
129
|
+
exports.AnnotationStateModelType = AnnotationStateModelType;
|
130
|
+
const AnnotationMarkedState = {
|
131
|
+
MARKED: "Marked",
|
132
|
+
UNMARKED: "Unmarked"
|
133
|
+
};
|
134
|
+
exports.AnnotationMarkedState = AnnotationMarkedState;
|
135
|
+
const AnnotationReviewState = {
|
136
|
+
ACCEPTED: "Accepted",
|
137
|
+
REJECTED: "Rejected",
|
138
|
+
CANCELLED: "Cancelled",
|
139
|
+
COMPLETED: "Completed",
|
140
|
+
NONE: "None"
|
141
|
+
};
|
142
|
+
exports.AnnotationReviewState = AnnotationReviewState;
|
143
|
+
const AnnotationReplyType = {
|
144
|
+
GROUP: "Group",
|
145
|
+
REPLY: "R"
|
146
|
+
};
|
147
|
+
exports.AnnotationReplyType = AnnotationReplyType;
|
148
|
+
const AnnotationFlag = {
|
100
149
|
INVISIBLE: 0x01,
|
101
150
|
HIDDEN: 0x02,
|
102
151
|
PRINT: 0x04,
|
@@ -108,7 +157,8 @@ var AnnotationFlag = {
|
|
108
157
|
TOGGLENOVIEW: 0x100,
|
109
158
|
LOCKEDCONTENTS: 0x200
|
110
159
|
};
|
111
|
-
|
160
|
+
exports.AnnotationFlag = AnnotationFlag;
|
161
|
+
const AnnotationFieldFlag = {
|
112
162
|
READONLY: 0x0000001,
|
113
163
|
REQUIRED: 0x0000002,
|
114
164
|
NOEXPORT: 0x0000004,
|
@@ -129,49 +179,55 @@ var AnnotationFieldFlag = {
|
|
129
179
|
RADIOSINUNISON: 0x2000000,
|
130
180
|
COMMITONSELCHANGE: 0x4000000
|
131
181
|
};
|
132
|
-
|
182
|
+
exports.AnnotationFieldFlag = AnnotationFieldFlag;
|
183
|
+
const AnnotationBorderStyleType = {
|
133
184
|
SOLID: 1,
|
134
185
|
DASHED: 2,
|
135
186
|
BEVELED: 3,
|
136
187
|
INSET: 4,
|
137
188
|
UNDERLINE: 5
|
138
189
|
};
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
190
|
+
exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
|
191
|
+
const StreamType = {
|
192
|
+
UNKNOWN: "UNKNOWN",
|
193
|
+
FLATE: "FLATE",
|
194
|
+
LZW: "LZW",
|
195
|
+
DCT: "DCT",
|
196
|
+
JPX: "JPX",
|
197
|
+
JBIG: "JBIG",
|
198
|
+
A85: "A85",
|
199
|
+
AHX: "AHX",
|
200
|
+
CCF: "CCF",
|
201
|
+
RLX: "RLX"
|
150
202
|
};
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
203
|
+
exports.StreamType = StreamType;
|
204
|
+
const FontType = {
|
205
|
+
UNKNOWN: "UNKNOWN",
|
206
|
+
TYPE1: "TYPE1",
|
207
|
+
TYPE1C: "TYPE1C",
|
208
|
+
CIDFONTTYPE0: "CIDFONTTYPE0",
|
209
|
+
CIDFONTTYPE0C: "CIDFONTTYPE0C",
|
210
|
+
TRUETYPE: "TRUETYPE",
|
211
|
+
CIDFONTTYPE2: "CIDFONTTYPE2",
|
212
|
+
TYPE3: "TYPE3",
|
213
|
+
OPENTYPE: "OPENTYPE",
|
214
|
+
TYPE0: "TYPE0",
|
215
|
+
MMTYPE1: "MMTYPE1"
|
163
216
|
};
|
164
|
-
|
217
|
+
exports.FontType = FontType;
|
218
|
+
const VerbosityLevel = {
|
165
219
|
ERRORS: 0,
|
166
220
|
WARNINGS: 1,
|
167
221
|
INFOS: 5
|
168
222
|
};
|
169
|
-
|
223
|
+
exports.VerbosityLevel = VerbosityLevel;
|
224
|
+
const CMapCompressionType = {
|
170
225
|
NONE: 0,
|
171
226
|
BINARY: 1,
|
172
227
|
STREAM: 2
|
173
228
|
};
|
174
|
-
|
229
|
+
exports.CMapCompressionType = CMapCompressionType;
|
230
|
+
const OPS = {
|
175
231
|
dependency: 1,
|
176
232
|
setLineWidth: 2,
|
177
233
|
setLineCap: 3,
|
@@ -264,568 +320,518 @@ var OPS = {
|
|
264
320
|
paintSolidColorImageMask: 90,
|
265
321
|
constructPath: 91
|
266
322
|
};
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
323
|
+
exports.OPS = OPS;
|
324
|
+
const UNSUPPORTED_FEATURES = {
|
325
|
+
unknown: "unknown",
|
326
|
+
forms: "forms",
|
327
|
+
javaScript: "javaScript",
|
328
|
+
smask: "smask",
|
329
|
+
shadingPattern: "shadingPattern",
|
330
|
+
font: "font"
|
274
331
|
};
|
275
|
-
|
332
|
+
exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
|
333
|
+
const PasswordResponses = {
|
276
334
|
NEED_PASSWORD: 1,
|
277
335
|
INCORRECT_PASSWORD: 2
|
278
336
|
};
|
279
|
-
|
337
|
+
exports.PasswordResponses = PasswordResponses;
|
338
|
+
let verbosity = VerbosityLevel.WARNINGS;
|
339
|
+
|
280
340
|
function setVerbosityLevel(level) {
|
281
341
|
if (Number.isInteger(level)) {
|
282
342
|
verbosity = level;
|
283
343
|
}
|
284
344
|
}
|
345
|
+
|
285
346
|
function getVerbosityLevel() {
|
286
347
|
return verbosity;
|
287
348
|
}
|
349
|
+
|
288
350
|
function info(msg) {
|
289
351
|
if (verbosity >= VerbosityLevel.INFOS) {
|
290
|
-
console.log(
|
352
|
+
console.log(`Info: ${msg}`);
|
291
353
|
}
|
292
354
|
}
|
355
|
+
|
293
356
|
function warn(msg) {
|
294
357
|
if (verbosity >= VerbosityLevel.WARNINGS) {
|
295
|
-
console.log(
|
358
|
+
console.log(`Warning: ${msg}`);
|
296
359
|
}
|
297
360
|
}
|
298
|
-
|
299
|
-
console.log('Deprecated API usage: ' + details);
|
300
|
-
}
|
361
|
+
|
301
362
|
function unreachable(msg) {
|
302
363
|
throw new Error(msg);
|
303
364
|
}
|
365
|
+
|
304
366
|
function assert(cond, msg) {
|
305
367
|
if (!cond) {
|
306
368
|
unreachable(msg);
|
307
369
|
}
|
308
370
|
}
|
371
|
+
|
309
372
|
function isSameOrigin(baseUrl, otherUrl) {
|
373
|
+
let base;
|
374
|
+
|
310
375
|
try {
|
311
|
-
|
312
|
-
|
376
|
+
base = new URL(baseUrl);
|
377
|
+
|
378
|
+
if (!base.origin || base.origin === "null") {
|
313
379
|
return false;
|
314
380
|
}
|
315
381
|
} catch (e) {
|
316
382
|
return false;
|
317
383
|
}
|
318
|
-
|
384
|
+
|
385
|
+
const other = new URL(otherUrl, base);
|
319
386
|
return base.origin === other.origin;
|
320
387
|
}
|
388
|
+
|
321
389
|
function _isValidProtocol(url) {
|
322
390
|
if (!url) {
|
323
391
|
return false;
|
324
392
|
}
|
393
|
+
|
325
394
|
switch (url.protocol) {
|
326
|
-
case
|
327
|
-
case
|
328
|
-
case
|
329
|
-
case
|
330
|
-
case
|
395
|
+
case "http:":
|
396
|
+
case "https:":
|
397
|
+
case "ftp:":
|
398
|
+
case "mailto:":
|
399
|
+
case "tel:":
|
331
400
|
return true;
|
401
|
+
|
332
402
|
default:
|
333
403
|
return false;
|
334
404
|
}
|
335
405
|
}
|
406
|
+
|
336
407
|
function createValidAbsoluteUrl(url, baseUrl) {
|
337
408
|
if (!url) {
|
338
409
|
return null;
|
339
410
|
}
|
411
|
+
|
340
412
|
try {
|
341
|
-
|
413
|
+
const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
|
414
|
+
|
342
415
|
if (_isValidProtocol(absoluteUrl)) {
|
343
416
|
return absoluteUrl;
|
344
417
|
}
|
345
418
|
} catch (ex) {}
|
419
|
+
|
346
420
|
return null;
|
347
421
|
}
|
422
|
+
|
348
423
|
function shadow(obj, prop, value) {
|
349
424
|
Object.defineProperty(obj, prop, {
|
350
|
-
value
|
425
|
+
value,
|
351
426
|
enumerable: true,
|
352
427
|
configurable: true,
|
353
428
|
writable: false
|
354
429
|
});
|
355
430
|
return value;
|
356
431
|
}
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
if (
|
361
|
-
|
362
|
-
initializer(lookup);
|
363
|
-
initializer = null;
|
432
|
+
|
433
|
+
const BaseException = function BaseExceptionClosure() {
|
434
|
+
function BaseException(message) {
|
435
|
+
if (this.constructor === BaseException) {
|
436
|
+
unreachable("Cannot initialize BaseException.");
|
364
437
|
}
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
var PasswordException = function PasswordExceptionClosure() {
|
369
|
-
function PasswordException(msg, code) {
|
370
|
-
this.name = 'PasswordException';
|
371
|
-
this.message = msg;
|
372
|
-
this.code = code;
|
438
|
+
|
439
|
+
this.message = message;
|
440
|
+
this.name = this.constructor.name;
|
373
441
|
}
|
374
|
-
|
375
|
-
|
376
|
-
|
442
|
+
|
443
|
+
BaseException.prototype = new Error();
|
444
|
+
BaseException.constructor = BaseException;
|
445
|
+
return BaseException;
|
377
446
|
}();
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
447
|
+
|
448
|
+
exports.BaseException = BaseException;
|
449
|
+
|
450
|
+
class PasswordException extends BaseException {
|
451
|
+
constructor(msg, code) {
|
452
|
+
super(msg);
|
453
|
+
this.code = code;
|
454
|
+
}
|
455
|
+
|
456
|
+
}
|
457
|
+
|
458
|
+
exports.PasswordException = PasswordException;
|
459
|
+
|
460
|
+
class UnknownErrorException extends BaseException {
|
461
|
+
constructor(msg, details) {
|
462
|
+
super(msg);
|
382
463
|
this.details = details;
|
383
464
|
}
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
this.message = msg;
|
401
|
-
}
|
402
|
-
MissingPDFException.prototype = new Error();
|
403
|
-
MissingPDFException.constructor = MissingPDFException;
|
404
|
-
return MissingPDFException;
|
405
|
-
}();
|
406
|
-
var UnexpectedResponseException = function UnexpectedResponseExceptionClosure() {
|
407
|
-
function UnexpectedResponseException(msg, status) {
|
408
|
-
this.name = 'UnexpectedResponseException';
|
409
|
-
this.message = msg;
|
465
|
+
|
466
|
+
}
|
467
|
+
|
468
|
+
exports.UnknownErrorException = UnknownErrorException;
|
469
|
+
|
470
|
+
class InvalidPDFException extends BaseException {}
|
471
|
+
|
472
|
+
exports.InvalidPDFException = InvalidPDFException;
|
473
|
+
|
474
|
+
class MissingPDFException extends BaseException {}
|
475
|
+
|
476
|
+
exports.MissingPDFException = MissingPDFException;
|
477
|
+
|
478
|
+
class UnexpectedResponseException extends BaseException {
|
479
|
+
constructor(msg, status) {
|
480
|
+
super(msg);
|
410
481
|
this.status = status;
|
411
482
|
}
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
}();
|
427
|
-
var XRefParseException = function XRefParseExceptionClosure() {
|
428
|
-
function XRefParseException(msg) {
|
429
|
-
this.message = msg;
|
430
|
-
}
|
431
|
-
XRefParseException.prototype = new Error();
|
432
|
-
XRefParseException.prototype.name = 'XRefParseException';
|
433
|
-
XRefParseException.constructor = XRefParseException;
|
434
|
-
return XRefParseException;
|
435
|
-
}();
|
436
|
-
var FormatError = function FormatErrorClosure() {
|
437
|
-
function FormatError(msg) {
|
438
|
-
this.message = msg;
|
439
|
-
}
|
440
|
-
FormatError.prototype = new Error();
|
441
|
-
FormatError.prototype.name = 'FormatError';
|
442
|
-
FormatError.constructor = FormatError;
|
443
|
-
return FormatError;
|
444
|
-
}();
|
445
|
-
var AbortException = function AbortExceptionClosure() {
|
446
|
-
function AbortException(msg) {
|
447
|
-
this.name = 'AbortException';
|
448
|
-
this.message = msg;
|
449
|
-
}
|
450
|
-
AbortException.prototype = new Error();
|
451
|
-
AbortException.constructor = AbortException;
|
452
|
-
return AbortException;
|
453
|
-
}();
|
454
|
-
var NullCharactersRegExp = /\x00/g;
|
483
|
+
|
484
|
+
}
|
485
|
+
|
486
|
+
exports.UnexpectedResponseException = UnexpectedResponseException;
|
487
|
+
|
488
|
+
class FormatError extends BaseException {}
|
489
|
+
|
490
|
+
exports.FormatError = FormatError;
|
491
|
+
|
492
|
+
class AbortException extends BaseException {}
|
493
|
+
|
494
|
+
exports.AbortException = AbortException;
|
495
|
+
const NullCharactersRegExp = /\x00/g;
|
496
|
+
|
455
497
|
function removeNullCharacters(str) {
|
456
|
-
if (typeof str !==
|
457
|
-
warn(
|
498
|
+
if (typeof str !== "string") {
|
499
|
+
warn("The argument for removeNullCharacters must be a string.");
|
458
500
|
return str;
|
459
501
|
}
|
460
|
-
|
502
|
+
|
503
|
+
return str.replace(NullCharactersRegExp, "");
|
461
504
|
}
|
505
|
+
|
462
506
|
function bytesToString(bytes) {
|
463
|
-
assert(bytes !== null &&
|
464
|
-
|
465
|
-
|
507
|
+
assert(bytes !== null && typeof bytes === "object" && bytes.length !== undefined, "Invalid argument for bytesToString");
|
508
|
+
const length = bytes.length;
|
509
|
+
const MAX_ARGUMENT_COUNT = 8192;
|
510
|
+
|
466
511
|
if (length < MAX_ARGUMENT_COUNT) {
|
467
512
|
return String.fromCharCode.apply(null, bytes);
|
468
513
|
}
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
514
|
+
|
515
|
+
const strBuf = [];
|
516
|
+
|
517
|
+
for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
|
518
|
+
const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
|
519
|
+
const chunk = bytes.subarray(i, chunkEnd);
|
473
520
|
strBuf.push(String.fromCharCode.apply(null, chunk));
|
474
521
|
}
|
475
|
-
|
522
|
+
|
523
|
+
return strBuf.join("");
|
476
524
|
}
|
525
|
+
|
477
526
|
function stringToBytes(str) {
|
478
|
-
assert(typeof str ===
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
527
|
+
assert(typeof str === "string", "Invalid argument for stringToBytes");
|
528
|
+
const length = str.length;
|
529
|
+
const bytes = new Uint8Array(length);
|
530
|
+
|
531
|
+
for (let i = 0; i < length; ++i) {
|
532
|
+
bytes[i] = str.charCodeAt(i) & 0xff;
|
483
533
|
}
|
534
|
+
|
484
535
|
return bytes;
|
485
536
|
}
|
537
|
+
|
486
538
|
function arrayByteLength(arr) {
|
487
539
|
if (arr.length !== undefined) {
|
488
540
|
return arr.length;
|
489
541
|
}
|
542
|
+
|
490
543
|
assert(arr.byteLength !== undefined);
|
491
544
|
return arr.byteLength;
|
492
545
|
}
|
546
|
+
|
493
547
|
function arraysToBytes(arr) {
|
494
|
-
|
548
|
+
const length = arr.length;
|
549
|
+
|
550
|
+
if (length === 1 && arr[0] instanceof Uint8Array) {
|
495
551
|
return arr[0];
|
496
552
|
}
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
553
|
+
|
554
|
+
let resultLength = 0;
|
555
|
+
|
556
|
+
for (let i = 0; i < length; i++) {
|
557
|
+
resultLength += arrayByteLength(arr[i]);
|
558
|
+
}
|
559
|
+
|
560
|
+
let pos = 0;
|
561
|
+
const data = new Uint8Array(resultLength);
|
562
|
+
|
563
|
+
for (let i = 0; i < length; i++) {
|
564
|
+
let item = arr[i];
|
565
|
+
|
510
566
|
if (!(item instanceof Uint8Array)) {
|
511
|
-
if (typeof item ===
|
567
|
+
if (typeof item === "string") {
|
512
568
|
item = stringToBytes(item);
|
513
569
|
} else {
|
514
570
|
item = new Uint8Array(item);
|
515
571
|
}
|
516
572
|
}
|
517
|
-
|
573
|
+
|
574
|
+
const itemLength = item.byteLength;
|
518
575
|
data.set(item, pos);
|
519
576
|
pos += itemLength;
|
520
577
|
}
|
578
|
+
|
521
579
|
return data;
|
522
580
|
}
|
581
|
+
|
523
582
|
function string32(value) {
|
524
583
|
return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
|
525
584
|
}
|
526
|
-
|
527
|
-
if (x <= 0) {
|
528
|
-
return 0;
|
529
|
-
}
|
530
|
-
return Math.ceil(Math.log2(x));
|
531
|
-
}
|
532
|
-
function readInt8(data, start) {
|
533
|
-
return data[start] << 24 >> 24;
|
534
|
-
}
|
535
|
-
function readUint16(data, offset) {
|
536
|
-
return data[offset] << 8 | data[offset + 1];
|
537
|
-
}
|
538
|
-
function readUint32(data, offset) {
|
539
|
-
return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
|
540
|
-
}
|
585
|
+
|
541
586
|
function isLittleEndian() {
|
542
|
-
|
587
|
+
const buffer8 = new Uint8Array(4);
|
543
588
|
buffer8[0] = 1;
|
544
|
-
|
589
|
+
const view32 = new Uint32Array(buffer8.buffer, 0, 1);
|
545
590
|
return view32[0] === 1;
|
546
591
|
}
|
592
|
+
|
593
|
+
const IsLittleEndianCached = {
|
594
|
+
get value() {
|
595
|
+
return shadow(this, "value", isLittleEndian());
|
596
|
+
}
|
597
|
+
|
598
|
+
};
|
599
|
+
exports.IsLittleEndianCached = IsLittleEndianCached;
|
600
|
+
|
547
601
|
function isEvalSupported() {
|
548
602
|
try {
|
549
|
-
new Function(
|
603
|
+
new Function("");
|
550
604
|
return true;
|
551
605
|
} catch (e) {
|
552
606
|
return false;
|
553
607
|
}
|
554
608
|
}
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
getArray = _ref$getArray === undefined ? false : _ref$getArray,
|
560
|
-
_ref$stopWhenFound = _ref.stopWhenFound,
|
561
|
-
stopWhenFound = _ref$stopWhenFound === undefined ? true : _ref$stopWhenFound;
|
562
|
-
|
563
|
-
var LOOP_LIMIT = 100;
|
564
|
-
var loopCount = 0;
|
565
|
-
var values = void 0;
|
566
|
-
while (dict) {
|
567
|
-
var value = getArray ? dict.getArray(key) : dict.get(key);
|
568
|
-
if (value !== undefined) {
|
569
|
-
if (stopWhenFound) {
|
570
|
-
return value;
|
571
|
-
}
|
572
|
-
if (!values) {
|
573
|
-
values = [];
|
574
|
-
}
|
575
|
-
values.push(value);
|
576
|
-
}
|
577
|
-
if (++loopCount > LOOP_LIMIT) {
|
578
|
-
warn('getInheritableProperty: maximum loop count exceeded for "' + key + '"');
|
579
|
-
break;
|
580
|
-
}
|
581
|
-
dict = dict.get('Parent');
|
609
|
+
|
610
|
+
const IsEvalSupportedCached = {
|
611
|
+
get value() {
|
612
|
+
return shadow(this, "value", isEvalSupported());
|
582
613
|
}
|
583
|
-
|
584
|
-
}
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
614
|
+
|
615
|
+
};
|
616
|
+
exports.IsEvalSupportedCached = IsEvalSupportedCached;
|
617
|
+
const rgbBuf = ["rgb(", 0, ",", 0, ",", 0, ")"];
|
618
|
+
|
619
|
+
class Util {
|
620
|
+
static makeCssRgb(r, g, b) {
|
589
621
|
rgbBuf[1] = r;
|
590
622
|
rgbBuf[3] = g;
|
591
623
|
rgbBuf[5] = b;
|
592
|
-
return rgbBuf.join(
|
593
|
-
}
|
594
|
-
|
624
|
+
return rgbBuf.join("");
|
625
|
+
}
|
626
|
+
|
627
|
+
static transform(m1, m2) {
|
595
628
|
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]];
|
596
|
-
}
|
597
|
-
|
598
|
-
|
599
|
-
|
629
|
+
}
|
630
|
+
|
631
|
+
static applyTransform(p, m) {
|
632
|
+
const xt = p[0] * m[0] + p[1] * m[2] + m[4];
|
633
|
+
const yt = p[0] * m[1] + p[1] * m[3] + m[5];
|
600
634
|
return [xt, yt];
|
601
|
-
}
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
635
|
+
}
|
636
|
+
|
637
|
+
static applyInverseTransform(p, m) {
|
638
|
+
const d = m[0] * m[3] - m[1] * m[2];
|
639
|
+
const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
|
640
|
+
const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
|
606
641
|
return [xt, yt];
|
607
|
-
}
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
642
|
+
}
|
643
|
+
|
644
|
+
static getAxialAlignedBoundingBox(r, m) {
|
645
|
+
const p1 = Util.applyTransform(r, m);
|
646
|
+
const p2 = Util.applyTransform(r.slice(2, 4), m);
|
647
|
+
const p3 = Util.applyTransform([r[0], r[3]], m);
|
648
|
+
const p4 = Util.applyTransform([r[2], r[1]], m);
|
613
649
|
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])];
|
614
|
-
}
|
615
|
-
|
616
|
-
|
650
|
+
}
|
651
|
+
|
652
|
+
static inverseTransform(m) {
|
653
|
+
const d = m[0] * m[3] - m[1] * m[2];
|
617
654
|
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];
|
618
|
-
}
|
619
|
-
|
655
|
+
}
|
656
|
+
|
657
|
+
static apply3dTransform(m, v) {
|
620
658
|
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]];
|
621
|
-
}
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
659
|
+
}
|
660
|
+
|
661
|
+
static singularValueDecompose2dScale(m) {
|
662
|
+
const transpose = [m[0], m[2], m[1], m[3]];
|
663
|
+
const a = m[0] * transpose[0] + m[1] * transpose[2];
|
664
|
+
const b = m[0] * transpose[1] + m[1] * transpose[3];
|
665
|
+
const c = m[2] * transpose[0] + m[3] * transpose[2];
|
666
|
+
const d = m[2] * transpose[1] + m[3] * transpose[3];
|
667
|
+
const first = (a + d) / 2;
|
668
|
+
const second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;
|
669
|
+
const sx = first + second || 1;
|
670
|
+
const sy = first - second || 1;
|
632
671
|
return [Math.sqrt(sx), Math.sqrt(sy)];
|
633
|
-
}
|
634
|
-
|
635
|
-
|
672
|
+
}
|
673
|
+
|
674
|
+
static normalizeRect(rect) {
|
675
|
+
const r = rect.slice(0);
|
676
|
+
|
636
677
|
if (rect[0] > rect[2]) {
|
637
678
|
r[0] = rect[2];
|
638
679
|
r[2] = rect[0];
|
639
680
|
}
|
681
|
+
|
640
682
|
if (rect[1] > rect[3]) {
|
641
683
|
r[1] = rect[3];
|
642
684
|
r[3] = rect[1];
|
643
685
|
}
|
686
|
+
|
644
687
|
return r;
|
645
|
-
}
|
646
|
-
|
688
|
+
}
|
689
|
+
|
690
|
+
static intersect(rect1, rect2) {
|
647
691
|
function compare(a, b) {
|
648
692
|
return a - b;
|
649
693
|
}
|
650
|
-
|
651
|
-
|
652
|
-
|
694
|
+
|
695
|
+
const orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);
|
696
|
+
const orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare);
|
697
|
+
const result = [];
|
653
698
|
rect1 = Util.normalizeRect(rect1);
|
654
699
|
rect2 = Util.normalizeRect(rect2);
|
700
|
+
|
655
701
|
if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
|
656
702
|
result[0] = orderedX[1];
|
657
703
|
result[2] = orderedX[2];
|
658
704
|
} else {
|
659
|
-
return
|
705
|
+
return null;
|
660
706
|
}
|
707
|
+
|
661
708
|
if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
|
662
709
|
result[1] = orderedY[1];
|
663
710
|
result[3] = orderedY[2];
|
664
711
|
} else {
|
665
|
-
return
|
712
|
+
return null;
|
666
713
|
}
|
714
|
+
|
667
715
|
return result;
|
668
|
-
}
|
669
|
-
|
670
|
-
}
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
assert(Number.isInteger(number) && number > 0, 'The number should be a positive integer.');
|
676
|
-
var pos = void 0,
|
677
|
-
romanBuf = [];
|
678
|
-
while (number >= 1000) {
|
679
|
-
number -= 1000;
|
680
|
-
romanBuf.push('M');
|
681
|
-
}
|
682
|
-
pos = number / 100 | 0;
|
683
|
-
number %= 100;
|
684
|
-
romanBuf.push(ROMAN_NUMBER_MAP[pos]);
|
685
|
-
pos = number / 10 | 0;
|
686
|
-
number %= 10;
|
687
|
-
romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
|
688
|
-
romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
|
689
|
-
var romanStr = romanBuf.join('');
|
690
|
-
return lowerCase ? romanStr.toLowerCase() : romanStr;
|
691
|
-
}
|
692
|
-
var 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];
|
716
|
+
}
|
717
|
+
|
718
|
+
}
|
719
|
+
|
720
|
+
exports.Util = Util;
|
721
|
+
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];
|
722
|
+
|
693
723
|
function stringToPDFString(str) {
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
if (str[0] ===
|
698
|
-
for (i = 2; i <
|
724
|
+
const length = str.length,
|
725
|
+
strBuf = [];
|
726
|
+
|
727
|
+
if (str[0] === "\xFE" && str[1] === "\xFF") {
|
728
|
+
for (let i = 2; i < length; i += 2) {
|
699
729
|
strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
|
700
730
|
}
|
731
|
+
} else if (str[0] === "\xFF" && str[1] === "\xFE") {
|
732
|
+
for (let i = 2; i < length; i += 2) {
|
733
|
+
strBuf.push(String.fromCharCode(str.charCodeAt(i + 1) << 8 | str.charCodeAt(i)));
|
734
|
+
}
|
701
735
|
} else {
|
702
|
-
for (i = 0; i <
|
703
|
-
|
736
|
+
for (let i = 0; i < length; ++i) {
|
737
|
+
const code = PDFStringTranslateTable[str.charCodeAt(i)];
|
704
738
|
strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
|
705
739
|
}
|
706
740
|
}
|
707
|
-
|
741
|
+
|
742
|
+
return strBuf.join("");
|
708
743
|
}
|
744
|
+
|
709
745
|
function stringToUTF8String(str) {
|
710
746
|
return decodeURIComponent(escape(str));
|
711
747
|
}
|
748
|
+
|
712
749
|
function utf8StringToString(str) {
|
713
750
|
return unescape(encodeURIComponent(str));
|
714
751
|
}
|
752
|
+
|
715
753
|
function isEmptyObj(obj) {
|
716
|
-
for (
|
754
|
+
for (const key in obj) {
|
717
755
|
return false;
|
718
756
|
}
|
757
|
+
|
719
758
|
return true;
|
720
759
|
}
|
760
|
+
|
721
761
|
function isBool(v) {
|
722
|
-
return typeof v ===
|
762
|
+
return typeof v === "boolean";
|
723
763
|
}
|
764
|
+
|
724
765
|
function isNum(v) {
|
725
|
-
return typeof v ===
|
766
|
+
return typeof v === "number";
|
726
767
|
}
|
768
|
+
|
727
769
|
function isString(v) {
|
728
|
-
return typeof v ===
|
770
|
+
return typeof v === "string";
|
729
771
|
}
|
772
|
+
|
730
773
|
function isArrayBuffer(v) {
|
731
|
-
return
|
774
|
+
return typeof v === "object" && v !== null && v.byteLength !== undefined;
|
732
775
|
}
|
733
|
-
|
734
|
-
|
776
|
+
|
777
|
+
function isArrayEqual(arr1, arr2) {
|
778
|
+
if (arr1.length !== arr2.length) {
|
779
|
+
return false;
|
780
|
+
}
|
781
|
+
|
782
|
+
return arr1.every(function (element, index) {
|
783
|
+
return element === arr2[index];
|
784
|
+
});
|
735
785
|
}
|
786
|
+
|
736
787
|
function createPromiseCapability() {
|
737
|
-
|
788
|
+
const capability = Object.create(null);
|
789
|
+
let isSettled = false;
|
790
|
+
Object.defineProperty(capability, "settled", {
|
791
|
+
get() {
|
792
|
+
return isSettled;
|
793
|
+
}
|
794
|
+
|
795
|
+
});
|
738
796
|
capability.promise = new Promise(function (resolve, reject) {
|
739
|
-
capability.resolve =
|
740
|
-
|
797
|
+
capability.resolve = function (data) {
|
798
|
+
isSettled = true;
|
799
|
+
resolve(data);
|
800
|
+
};
|
801
|
+
|
802
|
+
capability.reject = function (reason) {
|
803
|
+
isSettled = true;
|
804
|
+
reject(reason);
|
805
|
+
};
|
741
806
|
});
|
742
807
|
return capability;
|
743
808
|
}
|
744
|
-
var createObjectURL = function createObjectURLClosure() {
|
745
|
-
var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
746
|
-
return function createObjectURL(data, contentType) {
|
747
|
-
var forceDataSchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
748
809
|
|
749
|
-
|
750
|
-
|
751
|
-
|
810
|
+
const createObjectURL = function createObjectURLClosure() {
|
811
|
+
const digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
812
|
+
return function createObjectURL(data, contentType, forceDataSchema = false) {
|
813
|
+
if (!forceDataSchema && URL.createObjectURL) {
|
814
|
+
const blob = new Blob([data], {
|
815
|
+
type: contentType
|
816
|
+
});
|
817
|
+
return URL.createObjectURL(blob);
|
752
818
|
}
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
819
|
+
|
820
|
+
let buffer = `data:${contentType};base64,`;
|
821
|
+
|
822
|
+
for (let i = 0, ii = data.length; i < ii; i += 3) {
|
823
|
+
const b1 = data[i] & 0xff;
|
824
|
+
const b2 = data[i + 1] & 0xff;
|
825
|
+
const b3 = data[i + 2] & 0xff;
|
826
|
+
const d1 = b1 >> 2,
|
827
|
+
d2 = (b1 & 3) << 4 | b2 >> 4;
|
828
|
+
const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64;
|
829
|
+
const d4 = i + 2 < ii ? b3 & 0x3f : 64;
|
762
830
|
buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
|
763
831
|
}
|
832
|
+
|
764
833
|
return buffer;
|
765
834
|
};
|
766
835
|
}();
|
767
|
-
|
768
|
-
exports.
|
769
|
-
exports.OPS = OPS;
|
770
|
-
exports.VerbosityLevel = VerbosityLevel;
|
771
|
-
exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
|
772
|
-
exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
|
773
|
-
exports.AnnotationFieldFlag = AnnotationFieldFlag;
|
774
|
-
exports.AnnotationFlag = AnnotationFlag;
|
775
|
-
exports.AnnotationType = AnnotationType;
|
776
|
-
exports.FontType = FontType;
|
777
|
-
exports.ImageKind = ImageKind;
|
778
|
-
exports.CMapCompressionType = CMapCompressionType;
|
779
|
-
exports.AbortException = AbortException;
|
780
|
-
exports.InvalidPDFException = InvalidPDFException;
|
781
|
-
exports.MissingDataException = MissingDataException;
|
782
|
-
exports.MissingPDFException = MissingPDFException;
|
783
|
-
exports.NativeImageDecoding = NativeImageDecoding;
|
784
|
-
exports.PasswordException = PasswordException;
|
785
|
-
exports.PasswordResponses = PasswordResponses;
|
786
|
-
exports.PermissionFlag = PermissionFlag;
|
787
|
-
exports.StreamType = StreamType;
|
788
|
-
exports.TextRenderingMode = TextRenderingMode;
|
789
|
-
exports.UnexpectedResponseException = UnexpectedResponseException;
|
790
|
-
exports.UnknownErrorException = UnknownErrorException;
|
791
|
-
exports.Util = Util;
|
792
|
-
exports.toRomanNumerals = toRomanNumerals;
|
793
|
-
exports.XRefParseException = XRefParseException;
|
794
|
-
exports.FormatError = FormatError;
|
795
|
-
exports.arrayByteLength = arrayByteLength;
|
796
|
-
exports.arraysToBytes = arraysToBytes;
|
797
|
-
exports.assert = assert;
|
798
|
-
exports.bytesToString = bytesToString;
|
799
|
-
exports.createPromiseCapability = createPromiseCapability;
|
800
|
-
exports.createObjectURL = createObjectURL;
|
801
|
-
exports.deprecated = deprecated;
|
802
|
-
exports.getInheritableProperty = getInheritableProperty;
|
803
|
-
exports.getLookupTableFactory = getLookupTableFactory;
|
804
|
-
exports.getVerbosityLevel = getVerbosityLevel;
|
805
|
-
exports.info = info;
|
806
|
-
exports.isArrayBuffer = isArrayBuffer;
|
807
|
-
exports.isBool = isBool;
|
808
|
-
exports.isEmptyObj = isEmptyObj;
|
809
|
-
exports.isNum = isNum;
|
810
|
-
exports.isString = isString;
|
811
|
-
exports.isSpace = isSpace;
|
812
|
-
exports.isSameOrigin = isSameOrigin;
|
813
|
-
exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
|
814
|
-
exports.isLittleEndian = isLittleEndian;
|
815
|
-
exports.isEvalSupported = isEvalSupported;
|
816
|
-
exports.log2 = log2;
|
817
|
-
exports.readInt8 = readInt8;
|
818
|
-
exports.readUint16 = readUint16;
|
819
|
-
exports.readUint32 = readUint32;
|
820
|
-
exports.removeNullCharacters = removeNullCharacters;
|
821
|
-
exports.ReadableStream = _streams_polyfill.ReadableStream;
|
822
|
-
exports.URL = _url_polyfill.URL;
|
823
|
-
exports.setVerbosityLevel = setVerbosityLevel;
|
824
|
-
exports.shadow = shadow;
|
825
|
-
exports.string32 = string32;
|
826
|
-
exports.stringToBytes = stringToBytes;
|
827
|
-
exports.stringToPDFString = stringToPDFString;
|
828
|
-
exports.stringToUTF8String = stringToUTF8String;
|
829
|
-
exports.utf8StringToString = utf8StringToString;
|
830
|
-
exports.warn = warn;
|
831
|
-
exports.unreachable = unreachable;
|
836
|
+
|
837
|
+
exports.createObjectURL = createObjectURL;
|