pdfjs-dist 2.1.266 → 2.5.207
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 +8382 -18492
- 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 +20417 -29816
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +22 -1
- package/es5/build/pdf.js +25688 -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 +58239 -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 +403 -0
- package/es5/web/pdf_viewer.js +7742 -0
- package/es5/web/pdf_viewer.js.map +1 -0
- package/image_decoders/pdf.image_decoders.js +1475 -4897
- 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 +750 -899
- 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 +235 -183
- package/lib/core/charsets.js +4 -4
- package/lib/core/chunked_stream.js +447 -542
- package/lib/core/cmap.js +222 -264
- package/lib/core/colorspace.js +699 -863
- package/lib/core/core_utils.js +152 -0
- package/lib/core/crypto.js +379 -437
- package/lib/core/document.js +573 -660
- package/lib/core/encodings.js +15 -15
- package/lib/core/evaluator.js +1103 -868
- package/lib/core/font_renderer.js +135 -178
- package/lib/core/fonts.js +570 -491
- package/lib/core/function.js +291 -288
- package/lib/core/glyphlist.js +4527 -4526
- package/lib/core/image.js +145 -149
- package/lib/core/image_utils.js +170 -0
- 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 +284 -232
- package/lib/core/jpx.js +161 -143
- package/lib/core/jpx_stream.js +28 -28
- package/lib/core/metrics.js +2929 -2929
- package/lib/core/murmurhash3.js +90 -101
- package/lib/core/obj.js +1183 -1157
- package/lib/core/operator_list.js +99 -67
- package/lib/core/parser.js +972 -911
- package/lib/core/pattern.js +87 -70
- package/lib/core/pdf_manager.js +150 -315
- package/lib/core/primitives.js +83 -56
- 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 +87 -69
- package/lib/core/unicode.js +1654 -1654
- package/lib/core/worker.js +193 -390
- package/lib/core/worker_stream.js +168 -0
- package/lib/display/annotation_layer.js +741 -972
- package/lib/display/api.js +1500 -1791
- package/lib/display/api_compatibility.js +12 -17
- package/lib/display/canvas.js +165 -165
- package/lib/display/content_disposition.js +40 -59
- package/lib/display/display_utils.js +515 -0
- package/lib/display/fetch_stream.js +183 -298
- package/lib/display/font_loader.js +273 -413
- package/lib/display/metadata.js +86 -98
- package/lib/display/network.js +266 -359
- package/lib/display/network_utils.js +25 -18
- package/lib/display/node_stream.js +285 -458
- package/lib/display/pattern_helper.js +113 -65
- package/lib/display/svg.js +1166 -901
- package/lib/display/text_layer.js +156 -132
- package/lib/display/transport_stream.js +262 -278
- 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 +40 -37
- package/lib/pdf.js +226 -59
- 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 +266 -416
- package/lib/test/unit/annotation_spec.js +1555 -701
- package/lib/test/unit/api_spec.js +802 -604
- package/lib/test/unit/bidi_spec.js +7 -7
- package/lib/test/unit/cff_parser_spec.js +84 -69
- package/lib/test/unit/clitests_helper.js +7 -9
- package/lib/test/unit/cmap_spec.js +74 -76
- package/lib/test/unit/colorspace_spec.js +166 -161
- package/lib/test/unit/core_utils_spec.js +211 -0
- package/lib/test/unit/crypto_spec.js +181 -181
- package/lib/test/unit/custom_spec.js +20 -22
- package/lib/test/unit/display_svg_spec.js +34 -39
- package/lib/test/unit/display_utils_spec.js +263 -0
- package/lib/test/unit/document_spec.js +16 -21
- package/lib/test/unit/encodings_spec.js +12 -34
- package/lib/test/unit/evaluator_spec.js +83 -83
- package/lib/test/unit/fetch_stream_spec.js +111 -0
- package/lib/test/unit/function_spec.js +206 -204
- package/lib/test/unit/jasmine-boot.js +46 -30
- package/lib/test/unit/message_handler_spec.js +173 -159
- package/lib/test/unit/metadata_spec.js +69 -69
- package/lib/test/unit/murmurhash3_spec.js +12 -12
- package/lib/test/unit/network_spec.js +13 -61
- package/lib/test/unit/network_utils_spec.js +183 -119
- package/lib/test/unit/node_stream_spec.js +78 -92
- package/lib/test/unit/parser_spec.js +172 -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 +140 -125
- package/lib/test/unit/stream_spec.js +16 -14
- package/lib/test/unit/test_utils.js +131 -143
- package/lib/test/unit/testreporter.js +19 -19
- package/lib/test/unit/type1_parser_spec.js +42 -42
- package/lib/test/unit/ui_utils_spec.js +297 -459
- package/lib/test/unit/unicode_spec.js +38 -38
- package/lib/test/unit/util_spec.js +121 -305
- package/lib/web/annotation_layer_builder.js +66 -103
- package/lib/web/app.js +1328 -1214
- package/lib/web/app_options.js +105 -107
- package/lib/web/base_viewer.js +824 -838
- package/lib/web/chromecom.js +165 -252
- package/lib/web/debugger.js +149 -205
- package/lib/web/download_manager.js +39 -55
- package/lib/web/firefox_print_service.js +37 -27
- package/lib/web/firefoxcom.js +212 -363
- package/lib/web/genericcom.js +26 -108
- package/lib/web/genericl10n.js +24 -153
- package/lib/web/grab_to_pan.js +32 -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 +113 -131
- package/lib/web/pdf_cursor_tools.js +75 -102
- package/lib/web/pdf_document_properties.js +221 -306
- package/lib/web/pdf_find_bar.js +136 -170
- package/lib/web/pdf_find_controller.js +491 -548
- package/lib/web/pdf_find_utils.js +13 -13
- package/lib/web/pdf_history.js +397 -406
- package/lib/web/pdf_link_service.js +304 -348
- package/lib/web/pdf_outline_viewer.js +140 -175
- package/lib/web/pdf_page_view.js +452 -523
- package/lib/web/pdf_presentation_mode.js +308 -357
- package/lib/web/pdf_print_service.js +90 -104
- package/lib/web/pdf_rendering_queue.js +84 -108
- package/lib/web/pdf_sidebar.js +276 -306
- 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 +276 -297
- package/lib/web/pdf_thumbnail_viewer.js +186 -206
- package/lib/web/pdf_viewer.component.js +20 -21
- package/lib/web/pdf_viewer.js +55 -115
- package/lib/web/preferences.js +82 -286
- package/lib/web/secondary_toolbar.js +164 -196
- package/lib/web/text_layer_builder.js +282 -339
- package/lib/web/toolbar.js +217 -210
- package/lib/web/ui_utils.js +267 -420
- package/lib/web/view_history.js +52 -226
- package/lib/web/viewer_compatibility.js +21 -6
- package/package.json +2 -9
- package/web/pdf_viewer.css +35 -25
- package/web/pdf_viewer.js +3489 -4855
- 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 -494
- package/lib/shared/streams_polyfill.js +0 -43
- package/lib/shared/url_polyfill.js +0 -56
- package/lib/test/unit/dom_utils_spec.js +0 -89
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.
|
@@ -24,31 +24,21 @@
|
|
24
24
|
Object.defineProperty(exports, "__esModule", {
|
25
25
|
value: true
|
26
26
|
});
|
27
|
-
exports.toRomanNumerals = toRomanNumerals;
|
28
27
|
exports.arrayByteLength = arrayByteLength;
|
29
28
|
exports.arraysToBytes = arraysToBytes;
|
30
29
|
exports.assert = assert;
|
31
30
|
exports.bytesToString = bytesToString;
|
32
31
|
exports.createPromiseCapability = createPromiseCapability;
|
33
|
-
exports.deprecated = deprecated;
|
34
|
-
exports.getInheritableProperty = getInheritableProperty;
|
35
|
-
exports.getLookupTableFactory = getLookupTableFactory;
|
36
32
|
exports.getVerbosityLevel = getVerbosityLevel;
|
37
33
|
exports.info = info;
|
38
34
|
exports.isArrayBuffer = isArrayBuffer;
|
35
|
+
exports.isArrayEqual = isArrayEqual;
|
39
36
|
exports.isBool = isBool;
|
40
37
|
exports.isEmptyObj = isEmptyObj;
|
41
38
|
exports.isNum = isNum;
|
42
39
|
exports.isString = isString;
|
43
|
-
exports.isSpace = isSpace;
|
44
40
|
exports.isSameOrigin = isSameOrigin;
|
45
41
|
exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
|
46
|
-
exports.isLittleEndian = isLittleEndian;
|
47
|
-
exports.isEvalSupported = isEvalSupported;
|
48
|
-
exports.log2 = log2;
|
49
|
-
exports.readInt8 = readInt8;
|
50
|
-
exports.readUint16 = readUint16;
|
51
|
-
exports.readUint32 = readUint32;
|
52
42
|
exports.removeNullCharacters = removeNullCharacters;
|
53
43
|
exports.setVerbosityLevel = setVerbosityLevel;
|
54
44
|
exports.shadow = shadow;
|
@@ -59,39 +49,15 @@ exports.stringToUTF8String = stringToUTF8String;
|
|
59
49
|
exports.utf8StringToString = utf8StringToString;
|
60
50
|
exports.warn = warn;
|
61
51
|
exports.unreachable = unreachable;
|
62
|
-
|
63
|
-
enumerable: true,
|
64
|
-
get: function get() {
|
65
|
-
return _streams_polyfill.ReadableStream;
|
66
|
-
}
|
67
|
-
});
|
68
|
-
Object.defineProperty(exports, "URL", {
|
69
|
-
enumerable: true,
|
70
|
-
get: function get() {
|
71
|
-
return _url_polyfill.URL;
|
72
|
-
}
|
73
|
-
});
|
74
|
-
exports.createObjectURL = exports.FormatError = exports.XRefParseException = exports.XRefEntryException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = 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;
|
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.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;
|
75
53
|
|
76
|
-
require("./compatibility");
|
54
|
+
require("./compatibility.js");
|
77
55
|
|
78
|
-
|
79
|
-
|
80
|
-
var _url_polyfill = require("./url_polyfill");
|
81
|
-
|
82
|
-
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); }
|
83
|
-
|
84
|
-
var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
|
56
|
+
const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
|
85
57
|
exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
|
86
|
-
|
58
|
+
const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
|
87
59
|
exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
|
88
|
-
|
89
|
-
NONE: 'none',
|
90
|
-
DECODE: 'decode',
|
91
|
-
DISPLAY: 'display'
|
92
|
-
};
|
93
|
-
exports.NativeImageDecoding = NativeImageDecoding;
|
94
|
-
var PermissionFlag = {
|
60
|
+
const PermissionFlag = {
|
95
61
|
PRINT: 0x04,
|
96
62
|
MODIFY_CONTENTS: 0x08,
|
97
63
|
COPY: 0x10,
|
@@ -102,7 +68,7 @@ var PermissionFlag = {
|
|
102
68
|
PRINT_HIGH_QUALITY: 0x800
|
103
69
|
};
|
104
70
|
exports.PermissionFlag = PermissionFlag;
|
105
|
-
|
71
|
+
const TextRenderingMode = {
|
106
72
|
FILL: 0,
|
107
73
|
STROKE: 1,
|
108
74
|
FILL_STROKE: 2,
|
@@ -115,13 +81,13 @@ var TextRenderingMode = {
|
|
115
81
|
ADD_TO_PATH_FLAG: 4
|
116
82
|
};
|
117
83
|
exports.TextRenderingMode = TextRenderingMode;
|
118
|
-
|
84
|
+
const ImageKind = {
|
119
85
|
GRAYSCALE_1BPP: 1,
|
120
86
|
RGB_24BPP: 2,
|
121
87
|
RGBA_32BPP: 3
|
122
88
|
};
|
123
89
|
exports.ImageKind = ImageKind;
|
124
|
-
|
90
|
+
const AnnotationType = {
|
125
91
|
TEXT: 1,
|
126
92
|
LINK: 2,
|
127
93
|
FREETEXT: 3,
|
@@ -150,7 +116,30 @@ var AnnotationType = {
|
|
150
116
|
REDACT: 26
|
151
117
|
};
|
152
118
|
exports.AnnotationType = AnnotationType;
|
153
|
-
|
119
|
+
const AnnotationStateModelType = {
|
120
|
+
MARKED: "Marked",
|
121
|
+
REVIEW: "Review"
|
122
|
+
};
|
123
|
+
exports.AnnotationStateModelType = AnnotationStateModelType;
|
124
|
+
const AnnotationMarkedState = {
|
125
|
+
MARKED: "Marked",
|
126
|
+
UNMARKED: "Unmarked"
|
127
|
+
};
|
128
|
+
exports.AnnotationMarkedState = AnnotationMarkedState;
|
129
|
+
const AnnotationReviewState = {
|
130
|
+
ACCEPTED: "Accepted",
|
131
|
+
REJECTED: "Rejected",
|
132
|
+
CANCELLED: "Cancelled",
|
133
|
+
COMPLETED: "Completed",
|
134
|
+
NONE: "None"
|
135
|
+
};
|
136
|
+
exports.AnnotationReviewState = AnnotationReviewState;
|
137
|
+
const AnnotationReplyType = {
|
138
|
+
GROUP: "Group",
|
139
|
+
REPLY: "R"
|
140
|
+
};
|
141
|
+
exports.AnnotationReplyType = AnnotationReplyType;
|
142
|
+
const AnnotationFlag = {
|
154
143
|
INVISIBLE: 0x01,
|
155
144
|
HIDDEN: 0x02,
|
156
145
|
PRINT: 0x04,
|
@@ -163,7 +152,7 @@ var AnnotationFlag = {
|
|
163
152
|
LOCKEDCONTENTS: 0x200
|
164
153
|
};
|
165
154
|
exports.AnnotationFlag = AnnotationFlag;
|
166
|
-
|
155
|
+
const AnnotationFieldFlag = {
|
167
156
|
READONLY: 0x0000001,
|
168
157
|
REQUIRED: 0x0000002,
|
169
158
|
NOEXPORT: 0x0000004,
|
@@ -185,7 +174,7 @@ var AnnotationFieldFlag = {
|
|
185
174
|
COMMITONSELCHANGE: 0x4000000
|
186
175
|
};
|
187
176
|
exports.AnnotationFieldFlag = AnnotationFieldFlag;
|
188
|
-
|
177
|
+
const AnnotationBorderStyleType = {
|
189
178
|
SOLID: 1,
|
190
179
|
DASHED: 2,
|
191
180
|
BEVELED: 3,
|
@@ -193,46 +182,46 @@ var AnnotationBorderStyleType = {
|
|
193
182
|
UNDERLINE: 5
|
194
183
|
};
|
195
184
|
exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
|
196
|
-
|
197
|
-
UNKNOWN:
|
198
|
-
FLATE:
|
199
|
-
LZW:
|
200
|
-
DCT:
|
201
|
-
JPX:
|
202
|
-
JBIG:
|
203
|
-
A85:
|
204
|
-
AHX:
|
205
|
-
CCF:
|
206
|
-
|
185
|
+
const StreamType = {
|
186
|
+
UNKNOWN: "UNKNOWN",
|
187
|
+
FLATE: "FLATE",
|
188
|
+
LZW: "LZW",
|
189
|
+
DCT: "DCT",
|
190
|
+
JPX: "JPX",
|
191
|
+
JBIG: "JBIG",
|
192
|
+
A85: "A85",
|
193
|
+
AHX: "AHX",
|
194
|
+
CCF: "CCF",
|
195
|
+
RLX: "RLX"
|
207
196
|
};
|
208
197
|
exports.StreamType = StreamType;
|
209
|
-
|
210
|
-
UNKNOWN:
|
211
|
-
TYPE1:
|
212
|
-
TYPE1C:
|
213
|
-
CIDFONTTYPE0:
|
214
|
-
CIDFONTTYPE0C:
|
215
|
-
TRUETYPE:
|
216
|
-
CIDFONTTYPE2:
|
217
|
-
TYPE3:
|
218
|
-
OPENTYPE:
|
219
|
-
TYPE0:
|
220
|
-
MMTYPE1:
|
198
|
+
const FontType = {
|
199
|
+
UNKNOWN: "UNKNOWN",
|
200
|
+
TYPE1: "TYPE1",
|
201
|
+
TYPE1C: "TYPE1C",
|
202
|
+
CIDFONTTYPE0: "CIDFONTTYPE0",
|
203
|
+
CIDFONTTYPE0C: "CIDFONTTYPE0C",
|
204
|
+
TRUETYPE: "TRUETYPE",
|
205
|
+
CIDFONTTYPE2: "CIDFONTTYPE2",
|
206
|
+
TYPE3: "TYPE3",
|
207
|
+
OPENTYPE: "OPENTYPE",
|
208
|
+
TYPE0: "TYPE0",
|
209
|
+
MMTYPE1: "MMTYPE1"
|
221
210
|
};
|
222
211
|
exports.FontType = FontType;
|
223
|
-
|
212
|
+
const VerbosityLevel = {
|
224
213
|
ERRORS: 0,
|
225
214
|
WARNINGS: 1,
|
226
215
|
INFOS: 5
|
227
216
|
};
|
228
217
|
exports.VerbosityLevel = VerbosityLevel;
|
229
|
-
|
218
|
+
const CMapCompressionType = {
|
230
219
|
NONE: 0,
|
231
220
|
BINARY: 1,
|
232
221
|
STREAM: 2
|
233
222
|
};
|
234
223
|
exports.CMapCompressionType = CMapCompressionType;
|
235
|
-
|
224
|
+
const OPS = {
|
236
225
|
dependency: 1,
|
237
226
|
setLineWidth: 2,
|
238
227
|
setLineCap: 3,
|
@@ -326,21 +315,33 @@ var OPS = {
|
|
326
315
|
constructPath: 91
|
327
316
|
};
|
328
317
|
exports.OPS = OPS;
|
329
|
-
|
330
|
-
unknown:
|
331
|
-
forms:
|
332
|
-
javaScript:
|
333
|
-
smask:
|
334
|
-
shadingPattern:
|
335
|
-
font:
|
318
|
+
const UNSUPPORTED_FEATURES = {
|
319
|
+
unknown: "unknown",
|
320
|
+
forms: "forms",
|
321
|
+
javaScript: "javaScript",
|
322
|
+
smask: "smask",
|
323
|
+
shadingPattern: "shadingPattern",
|
324
|
+
font: "font",
|
325
|
+
errorTilingPattern: "errorTilingPattern",
|
326
|
+
errorExtGState: "errorExtGState",
|
327
|
+
errorXObject: "errorXObject",
|
328
|
+
errorFontLoadType3: "errorFontLoadType3",
|
329
|
+
errorFontState: "errorFontState",
|
330
|
+
errorFontMissing: "errorFontMissing",
|
331
|
+
errorFontTranslate: "errorFontTranslate",
|
332
|
+
errorColorSpace: "errorColorSpace",
|
333
|
+
errorOperatorList: "errorOperatorList",
|
334
|
+
errorFontToUnicode: "errorFontToUnicode",
|
335
|
+
errorFontLoadNative: "errorFontLoadNative",
|
336
|
+
errorFontGetPath: "errorFontGetPath"
|
336
337
|
};
|
337
338
|
exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
|
338
|
-
|
339
|
+
const PasswordResponses = {
|
339
340
|
NEED_PASSWORD: 1,
|
340
341
|
INCORRECT_PASSWORD: 2
|
341
342
|
};
|
342
343
|
exports.PasswordResponses = PasswordResponses;
|
343
|
-
|
344
|
+
let verbosity = VerbosityLevel.WARNINGS;
|
344
345
|
|
345
346
|
function setVerbosityLevel(level) {
|
346
347
|
if (Number.isInteger(level)) {
|
@@ -354,20 +355,16 @@ function getVerbosityLevel() {
|
|
354
355
|
|
355
356
|
function info(msg) {
|
356
357
|
if (verbosity >= VerbosityLevel.INFOS) {
|
357
|
-
console.log(
|
358
|
+
console.log(`Info: ${msg}`);
|
358
359
|
}
|
359
360
|
}
|
360
361
|
|
361
362
|
function warn(msg) {
|
362
363
|
if (verbosity >= VerbosityLevel.WARNINGS) {
|
363
|
-
console.log(
|
364
|
+
console.log(`Warning: ${msg}`);
|
364
365
|
}
|
365
366
|
}
|
366
367
|
|
367
|
-
function deprecated(details) {
|
368
|
-
console.log('Deprecated API usage: ' + details);
|
369
|
-
}
|
370
|
-
|
371
368
|
function unreachable(msg) {
|
372
369
|
throw new Error(msg);
|
373
370
|
}
|
@@ -379,17 +376,19 @@ function assert(cond, msg) {
|
|
379
376
|
}
|
380
377
|
|
381
378
|
function isSameOrigin(baseUrl, otherUrl) {
|
379
|
+
let base;
|
380
|
+
|
382
381
|
try {
|
383
|
-
|
382
|
+
base = new URL(baseUrl);
|
384
383
|
|
385
|
-
if (!base.origin || base.origin ===
|
384
|
+
if (!base.origin || base.origin === "null") {
|
386
385
|
return false;
|
387
386
|
}
|
388
387
|
} catch (e) {
|
389
388
|
return false;
|
390
389
|
}
|
391
390
|
|
392
|
-
|
391
|
+
const other = new URL(otherUrl, base);
|
393
392
|
return base.origin === other.origin;
|
394
393
|
}
|
395
394
|
|
@@ -399,11 +398,11 @@ function _isValidProtocol(url) {
|
|
399
398
|
}
|
400
399
|
|
401
400
|
switch (url.protocol) {
|
402
|
-
case
|
403
|
-
case
|
404
|
-
case
|
405
|
-
case
|
406
|
-
case
|
401
|
+
case "http:":
|
402
|
+
case "https:":
|
403
|
+
case "ftp:":
|
404
|
+
case "mailto:":
|
405
|
+
case "tel:":
|
407
406
|
return true;
|
408
407
|
|
409
408
|
default:
|
@@ -417,7 +416,7 @@ function createValidAbsoluteUrl(url, baseUrl) {
|
|
417
416
|
}
|
418
417
|
|
419
418
|
try {
|
420
|
-
|
419
|
+
const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
|
421
420
|
|
422
421
|
if (_isValidProtocol(absoluteUrl)) {
|
423
422
|
return absoluteUrl;
|
@@ -429,7 +428,7 @@ function createValidAbsoluteUrl(url, baseUrl) {
|
|
429
428
|
|
430
429
|
function shadow(obj, prop, value) {
|
431
430
|
Object.defineProperty(obj, prop, {
|
432
|
-
value
|
431
|
+
value,
|
433
432
|
enumerable: true,
|
434
433
|
configurable: true,
|
435
434
|
writable: false
|
@@ -437,191 +436,106 @@ function shadow(obj, prop, value) {
|
|
437
436
|
return value;
|
438
437
|
}
|
439
438
|
|
440
|
-
function
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
lookup = Object.create(null);
|
445
|
-
initializer(lookup);
|
446
|
-
initializer = null;
|
439
|
+
const BaseException = function BaseExceptionClosure() {
|
440
|
+
function BaseException(message) {
|
441
|
+
if (this.constructor === BaseException) {
|
442
|
+
unreachable("Cannot initialize BaseException.");
|
447
443
|
}
|
448
444
|
|
449
|
-
|
450
|
-
|
451
|
-
}
|
445
|
+
this.message = message;
|
446
|
+
this.name = this.constructor.name;
|
447
|
+
}
|
448
|
+
|
449
|
+
BaseException.prototype = new Error();
|
450
|
+
BaseException.constructor = BaseException;
|
451
|
+
return BaseException;
|
452
|
+
}();
|
453
|
+
|
454
|
+
exports.BaseException = BaseException;
|
452
455
|
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
this.message = msg;
|
456
|
+
class PasswordException extends BaseException {
|
457
|
+
constructor(msg, code) {
|
458
|
+
super(msg);
|
457
459
|
this.code = code;
|
458
460
|
}
|
459
461
|
|
460
|
-
|
461
|
-
PasswordException.constructor = PasswordException;
|
462
|
-
return PasswordException;
|
463
|
-
}();
|
462
|
+
}
|
464
463
|
|
465
464
|
exports.PasswordException = PasswordException;
|
466
465
|
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
this.message = msg;
|
466
|
+
class UnknownErrorException extends BaseException {
|
467
|
+
constructor(msg, details) {
|
468
|
+
super(msg);
|
471
469
|
this.details = details;
|
472
470
|
}
|
473
471
|
|
474
|
-
|
475
|
-
UnknownErrorException.constructor = UnknownErrorException;
|
476
|
-
return UnknownErrorException;
|
477
|
-
}();
|
472
|
+
}
|
478
473
|
|
479
474
|
exports.UnknownErrorException = UnknownErrorException;
|
480
475
|
|
481
|
-
|
482
|
-
function InvalidPDFException(msg) {
|
483
|
-
this.name = 'InvalidPDFException';
|
484
|
-
this.message = msg;
|
485
|
-
}
|
486
|
-
|
487
|
-
InvalidPDFException.prototype = new Error();
|
488
|
-
InvalidPDFException.constructor = InvalidPDFException;
|
489
|
-
return InvalidPDFException;
|
490
|
-
}();
|
476
|
+
class InvalidPDFException extends BaseException {}
|
491
477
|
|
492
478
|
exports.InvalidPDFException = InvalidPDFException;
|
493
479
|
|
494
|
-
|
495
|
-
function MissingPDFException(msg) {
|
496
|
-
this.name = 'MissingPDFException';
|
497
|
-
this.message = msg;
|
498
|
-
}
|
499
|
-
|
500
|
-
MissingPDFException.prototype = new Error();
|
501
|
-
MissingPDFException.constructor = MissingPDFException;
|
502
|
-
return MissingPDFException;
|
503
|
-
}();
|
480
|
+
class MissingPDFException extends BaseException {}
|
504
481
|
|
505
482
|
exports.MissingPDFException = MissingPDFException;
|
506
483
|
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
this.message = msg;
|
484
|
+
class UnexpectedResponseException extends BaseException {
|
485
|
+
constructor(msg, status) {
|
486
|
+
super(msg);
|
511
487
|
this.status = status;
|
512
488
|
}
|
513
489
|
|
514
|
-
|
515
|
-
UnexpectedResponseException.constructor = UnexpectedResponseException;
|
516
|
-
return UnexpectedResponseException;
|
517
|
-
}();
|
490
|
+
}
|
518
491
|
|
519
492
|
exports.UnexpectedResponseException = UnexpectedResponseException;
|
520
493
|
|
521
|
-
|
522
|
-
function MissingDataException(begin, end) {
|
523
|
-
this.begin = begin;
|
524
|
-
this.end = end;
|
525
|
-
this.message = 'Missing data [' + begin + ', ' + end + ')';
|
526
|
-
}
|
527
|
-
|
528
|
-
MissingDataException.prototype = new Error();
|
529
|
-
MissingDataException.prototype.name = 'MissingDataException';
|
530
|
-
MissingDataException.constructor = MissingDataException;
|
531
|
-
return MissingDataException;
|
532
|
-
}();
|
533
|
-
|
534
|
-
exports.MissingDataException = MissingDataException;
|
535
|
-
|
536
|
-
var XRefEntryException = function XRefEntryExceptionClosure() {
|
537
|
-
function XRefEntryException(msg) {
|
538
|
-
this.message = msg;
|
539
|
-
}
|
540
|
-
|
541
|
-
XRefEntryException.prototype = new Error();
|
542
|
-
XRefEntryException.prototype.name = 'XRefEntryException';
|
543
|
-
XRefEntryException.constructor = XRefEntryException;
|
544
|
-
return XRefEntryException;
|
545
|
-
}();
|
546
|
-
|
547
|
-
exports.XRefEntryException = XRefEntryException;
|
548
|
-
|
549
|
-
var XRefParseException = function XRefParseExceptionClosure() {
|
550
|
-
function XRefParseException(msg) {
|
551
|
-
this.message = msg;
|
552
|
-
}
|
553
|
-
|
554
|
-
XRefParseException.prototype = new Error();
|
555
|
-
XRefParseException.prototype.name = 'XRefParseException';
|
556
|
-
XRefParseException.constructor = XRefParseException;
|
557
|
-
return XRefParseException;
|
558
|
-
}();
|
559
|
-
|
560
|
-
exports.XRefParseException = XRefParseException;
|
561
|
-
|
562
|
-
var FormatError = function FormatErrorClosure() {
|
563
|
-
function FormatError(msg) {
|
564
|
-
this.message = msg;
|
565
|
-
}
|
566
|
-
|
567
|
-
FormatError.prototype = new Error();
|
568
|
-
FormatError.prototype.name = 'FormatError';
|
569
|
-
FormatError.constructor = FormatError;
|
570
|
-
return FormatError;
|
571
|
-
}();
|
494
|
+
class FormatError extends BaseException {}
|
572
495
|
|
573
496
|
exports.FormatError = FormatError;
|
574
497
|
|
575
|
-
|
576
|
-
function AbortException(msg) {
|
577
|
-
this.name = 'AbortException';
|
578
|
-
this.message = msg;
|
579
|
-
}
|
580
|
-
|
581
|
-
AbortException.prototype = new Error();
|
582
|
-
AbortException.constructor = AbortException;
|
583
|
-
return AbortException;
|
584
|
-
}();
|
498
|
+
class AbortException extends BaseException {}
|
585
499
|
|
586
500
|
exports.AbortException = AbortException;
|
587
|
-
|
501
|
+
const NullCharactersRegExp = /\x00/g;
|
588
502
|
|
589
503
|
function removeNullCharacters(str) {
|
590
|
-
if (typeof str !==
|
591
|
-
warn(
|
504
|
+
if (typeof str !== "string") {
|
505
|
+
warn("The argument for removeNullCharacters must be a string.");
|
592
506
|
return str;
|
593
507
|
}
|
594
508
|
|
595
|
-
return str.replace(NullCharactersRegExp,
|
509
|
+
return str.replace(NullCharactersRegExp, "");
|
596
510
|
}
|
597
511
|
|
598
512
|
function bytesToString(bytes) {
|
599
|
-
assert(bytes !== null &&
|
600
|
-
|
601
|
-
|
513
|
+
assert(bytes !== null && typeof bytes === "object" && bytes.length !== undefined, "Invalid argument for bytesToString");
|
514
|
+
const length = bytes.length;
|
515
|
+
const MAX_ARGUMENT_COUNT = 8192;
|
602
516
|
|
603
517
|
if (length < MAX_ARGUMENT_COUNT) {
|
604
518
|
return String.fromCharCode.apply(null, bytes);
|
605
519
|
}
|
606
520
|
|
607
|
-
|
521
|
+
const strBuf = [];
|
608
522
|
|
609
|
-
for (
|
610
|
-
|
611
|
-
|
523
|
+
for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
|
524
|
+
const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
|
525
|
+
const chunk = bytes.subarray(i, chunkEnd);
|
612
526
|
strBuf.push(String.fromCharCode.apply(null, chunk));
|
613
527
|
}
|
614
528
|
|
615
|
-
return strBuf.join(
|
529
|
+
return strBuf.join("");
|
616
530
|
}
|
617
531
|
|
618
532
|
function stringToBytes(str) {
|
619
|
-
assert(typeof str ===
|
620
|
-
|
621
|
-
|
533
|
+
assert(typeof str === "string", "Invalid argument for stringToBytes");
|
534
|
+
const length = str.length;
|
535
|
+
const bytes = new Uint8Array(length);
|
622
536
|
|
623
|
-
for (
|
624
|
-
bytes[i] = str.charCodeAt(i) &
|
537
|
+
for (let i = 0; i < length; ++i) {
|
538
|
+
bytes[i] = str.charCodeAt(i) & 0xff;
|
625
539
|
}
|
626
540
|
|
627
541
|
return bytes;
|
@@ -632,41 +546,38 @@ function arrayByteLength(arr) {
|
|
632
546
|
return arr.length;
|
633
547
|
}
|
634
548
|
|
635
|
-
assert(arr.byteLength !== undefined);
|
549
|
+
assert(arr.byteLength !== undefined, "arrayByteLength - invalid argument.");
|
636
550
|
return arr.byteLength;
|
637
551
|
}
|
638
552
|
|
639
553
|
function arraysToBytes(arr) {
|
640
|
-
|
554
|
+
const length = arr.length;
|
555
|
+
|
556
|
+
if (length === 1 && arr[0] instanceof Uint8Array) {
|
641
557
|
return arr[0];
|
642
558
|
}
|
643
559
|
|
644
|
-
|
645
|
-
var i,
|
646
|
-
ii = arr.length;
|
647
|
-
var item, itemLength;
|
560
|
+
let resultLength = 0;
|
648
561
|
|
649
|
-
for (i = 0; i <
|
650
|
-
|
651
|
-
itemLength = arrayByteLength(item);
|
652
|
-
resultLength += itemLength;
|
562
|
+
for (let i = 0; i < length; i++) {
|
563
|
+
resultLength += arrayByteLength(arr[i]);
|
653
564
|
}
|
654
565
|
|
655
|
-
|
656
|
-
|
566
|
+
let pos = 0;
|
567
|
+
const data = new Uint8Array(resultLength);
|
657
568
|
|
658
|
-
for (i = 0; i <
|
659
|
-
item = arr[i];
|
569
|
+
for (let i = 0; i < length; i++) {
|
570
|
+
let item = arr[i];
|
660
571
|
|
661
572
|
if (!(item instanceof Uint8Array)) {
|
662
|
-
if (typeof item ===
|
573
|
+
if (typeof item === "string") {
|
663
574
|
item = stringToBytes(item);
|
664
575
|
} else {
|
665
576
|
item = new Uint8Array(item);
|
666
577
|
}
|
667
578
|
}
|
668
579
|
|
669
|
-
itemLength = item.byteLength;
|
580
|
+
const itemLength = item.byteLength;
|
670
581
|
data.set(item, pos);
|
671
582
|
pos += itemLength;
|
672
583
|
}
|
@@ -678,140 +589,96 @@ function string32(value) {
|
|
678
589
|
return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
|
679
590
|
}
|
680
591
|
|
681
|
-
function log2(x) {
|
682
|
-
if (x <= 0) {
|
683
|
-
return 0;
|
684
|
-
}
|
685
|
-
|
686
|
-
return Math.ceil(Math.log2(x));
|
687
|
-
}
|
688
|
-
|
689
|
-
function readInt8(data, start) {
|
690
|
-
return data[start] << 24 >> 24;
|
691
|
-
}
|
692
|
-
|
693
|
-
function readUint16(data, offset) {
|
694
|
-
return data[offset] << 8 | data[offset + 1];
|
695
|
-
}
|
696
|
-
|
697
|
-
function readUint32(data, offset) {
|
698
|
-
return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
|
699
|
-
}
|
700
|
-
|
701
592
|
function isLittleEndian() {
|
702
|
-
|
593
|
+
const buffer8 = new Uint8Array(4);
|
703
594
|
buffer8[0] = 1;
|
704
|
-
|
595
|
+
const view32 = new Uint32Array(buffer8.buffer, 0, 1);
|
705
596
|
return view32[0] === 1;
|
706
597
|
}
|
707
598
|
|
599
|
+
const IsLittleEndianCached = {
|
600
|
+
get value() {
|
601
|
+
return shadow(this, "value", isLittleEndian());
|
602
|
+
}
|
603
|
+
|
604
|
+
};
|
605
|
+
exports.IsLittleEndianCached = IsLittleEndianCached;
|
606
|
+
|
708
607
|
function isEvalSupported() {
|
709
608
|
try {
|
710
|
-
new Function(
|
609
|
+
new Function("");
|
711
610
|
return true;
|
712
611
|
} catch (e) {
|
713
612
|
return false;
|
714
613
|
}
|
715
614
|
}
|
716
615
|
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
_ref$getArray = _ref.getArray,
|
721
|
-
getArray = _ref$getArray === void 0 ? false : _ref$getArray,
|
722
|
-
_ref$stopWhenFound = _ref.stopWhenFound,
|
723
|
-
stopWhenFound = _ref$stopWhenFound === void 0 ? true : _ref$stopWhenFound;
|
724
|
-
var LOOP_LIMIT = 100;
|
725
|
-
var loopCount = 0;
|
726
|
-
var values;
|
727
|
-
|
728
|
-
while (dict) {
|
729
|
-
var value = getArray ? dict.getArray(key) : dict.get(key);
|
730
|
-
|
731
|
-
if (value !== undefined) {
|
732
|
-
if (stopWhenFound) {
|
733
|
-
return value;
|
734
|
-
}
|
735
|
-
|
736
|
-
if (!values) {
|
737
|
-
values = [];
|
738
|
-
}
|
739
|
-
|
740
|
-
values.push(value);
|
741
|
-
}
|
742
|
-
|
743
|
-
if (++loopCount > LOOP_LIMIT) {
|
744
|
-
warn("getInheritableProperty: maximum loop count exceeded for \"".concat(key, "\""));
|
745
|
-
break;
|
746
|
-
}
|
747
|
-
|
748
|
-
dict = dict.get('Parent');
|
616
|
+
const IsEvalSupportedCached = {
|
617
|
+
get value() {
|
618
|
+
return shadow(this, "value", isEvalSupported());
|
749
619
|
}
|
750
620
|
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
var Util = function UtilClosure() {
|
755
|
-
function Util() {}
|
756
|
-
|
757
|
-
var rgbBuf = ['rgb(', 0, ',', 0, ',', 0, ')'];
|
621
|
+
};
|
622
|
+
exports.IsEvalSupportedCached = IsEvalSupportedCached;
|
623
|
+
const rgbBuf = ["rgb(", 0, ",", 0, ",", 0, ")"];
|
758
624
|
|
759
|
-
|
625
|
+
class Util {
|
626
|
+
static makeCssRgb(r, g, b) {
|
760
627
|
rgbBuf[1] = r;
|
761
628
|
rgbBuf[3] = g;
|
762
629
|
rgbBuf[5] = b;
|
763
|
-
return rgbBuf.join(
|
764
|
-
}
|
630
|
+
return rgbBuf.join("");
|
631
|
+
}
|
765
632
|
|
766
|
-
|
633
|
+
static transform(m1, m2) {
|
767
634
|
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]];
|
768
|
-
}
|
635
|
+
}
|
769
636
|
|
770
|
-
|
771
|
-
|
772
|
-
|
637
|
+
static applyTransform(p, m) {
|
638
|
+
const xt = p[0] * m[0] + p[1] * m[2] + m[4];
|
639
|
+
const yt = p[0] * m[1] + p[1] * m[3] + m[5];
|
773
640
|
return [xt, yt];
|
774
|
-
}
|
641
|
+
}
|
775
642
|
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
643
|
+
static applyInverseTransform(p, m) {
|
644
|
+
const d = m[0] * m[3] - m[1] * m[2];
|
645
|
+
const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
|
646
|
+
const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
|
780
647
|
return [xt, yt];
|
781
|
-
}
|
648
|
+
}
|
782
649
|
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
650
|
+
static getAxialAlignedBoundingBox(r, m) {
|
651
|
+
const p1 = Util.applyTransform(r, m);
|
652
|
+
const p2 = Util.applyTransform(r.slice(2, 4), m);
|
653
|
+
const p3 = Util.applyTransform([r[0], r[3]], m);
|
654
|
+
const p4 = Util.applyTransform([r[2], r[1]], m);
|
788
655
|
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])];
|
789
|
-
}
|
656
|
+
}
|
790
657
|
|
791
|
-
|
792
|
-
|
658
|
+
static inverseTransform(m) {
|
659
|
+
const d = m[0] * m[3] - m[1] * m[2];
|
793
660
|
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];
|
794
|
-
}
|
661
|
+
}
|
795
662
|
|
796
|
-
|
663
|
+
static apply3dTransform(m, v) {
|
797
664
|
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]];
|
798
|
-
}
|
665
|
+
}
|
799
666
|
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
667
|
+
static singularValueDecompose2dScale(m) {
|
668
|
+
const transpose = [m[0], m[2], m[1], m[3]];
|
669
|
+
const a = m[0] * transpose[0] + m[1] * transpose[2];
|
670
|
+
const b = m[0] * transpose[1] + m[1] * transpose[3];
|
671
|
+
const c = m[2] * transpose[0] + m[3] * transpose[2];
|
672
|
+
const d = m[2] * transpose[1] + m[3] * transpose[3];
|
673
|
+
const first = (a + d) / 2;
|
674
|
+
const second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;
|
675
|
+
const sx = first + second || 1;
|
676
|
+
const sy = first - second || 1;
|
810
677
|
return [Math.sqrt(sx), Math.sqrt(sy)];
|
811
|
-
}
|
678
|
+
}
|
812
679
|
|
813
|
-
|
814
|
-
|
680
|
+
static normalizeRect(rect) {
|
681
|
+
const r = rect.slice(0);
|
815
682
|
|
816
683
|
if (rect[0] > rect[2]) {
|
817
684
|
r[0] = rect[2];
|
@@ -824,16 +691,16 @@ var Util = function UtilClosure() {
|
|
824
691
|
}
|
825
692
|
|
826
693
|
return r;
|
827
|
-
}
|
694
|
+
}
|
828
695
|
|
829
|
-
|
696
|
+
static intersect(rect1, rect2) {
|
830
697
|
function compare(a, b) {
|
831
698
|
return a - b;
|
832
699
|
}
|
833
700
|
|
834
|
-
|
835
|
-
|
836
|
-
|
701
|
+
const orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);
|
702
|
+
const orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare);
|
703
|
+
const result = [];
|
837
704
|
rect1 = Util.normalizeRect(rect1);
|
838
705
|
rect2 = Util.normalizeRect(rect2);
|
839
706
|
|
@@ -841,66 +708,44 @@ var Util = function UtilClosure() {
|
|
841
708
|
result[0] = orderedX[1];
|
842
709
|
result[2] = orderedX[2];
|
843
710
|
} else {
|
844
|
-
return
|
711
|
+
return null;
|
845
712
|
}
|
846
713
|
|
847
714
|
if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
|
848
715
|
result[1] = orderedY[1];
|
849
716
|
result[3] = orderedY[2];
|
850
717
|
} else {
|
851
|
-
return
|
718
|
+
return null;
|
852
719
|
}
|
853
720
|
|
854
721
|
return result;
|
855
|
-
};
|
856
|
-
|
857
|
-
return Util;
|
858
|
-
}();
|
859
|
-
|
860
|
-
exports.Util = Util;
|
861
|
-
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'];
|
862
|
-
|
863
|
-
function toRomanNumerals(number) {
|
864
|
-
var lowerCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
865
|
-
assert(Number.isInteger(number) && number > 0, 'The number should be a positive integer.');
|
866
|
-
var pos,
|
867
|
-
romanBuf = [];
|
868
|
-
|
869
|
-
while (number >= 1000) {
|
870
|
-
number -= 1000;
|
871
|
-
romanBuf.push('M');
|
872
722
|
}
|
873
723
|
|
874
|
-
pos = number / 100 | 0;
|
875
|
-
number %= 100;
|
876
|
-
romanBuf.push(ROMAN_NUMBER_MAP[pos]);
|
877
|
-
pos = number / 10 | 0;
|
878
|
-
number %= 10;
|
879
|
-
romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
|
880
|
-
romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
|
881
|
-
var romanStr = romanBuf.join('');
|
882
|
-
return lowerCase ? romanStr.toLowerCase() : romanStr;
|
883
724
|
}
|
884
725
|
|
885
|
-
|
726
|
+
exports.Util = Util;
|
727
|
+
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];
|
886
728
|
|
887
729
|
function stringToPDFString(str) {
|
888
|
-
|
889
|
-
|
890
|
-
strBuf = [];
|
730
|
+
const length = str.length,
|
731
|
+
strBuf = [];
|
891
732
|
|
892
|
-
if (str[0] ===
|
893
|
-
for (i = 2; i <
|
733
|
+
if (str[0] === "\xFE" && str[1] === "\xFF") {
|
734
|
+
for (let i = 2; i < length; i += 2) {
|
894
735
|
strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
|
895
736
|
}
|
737
|
+
} else if (str[0] === "\xFF" && str[1] === "\xFE") {
|
738
|
+
for (let i = 2; i < length; i += 2) {
|
739
|
+
strBuf.push(String.fromCharCode(str.charCodeAt(i + 1) << 8 | str.charCodeAt(i)));
|
740
|
+
}
|
896
741
|
} else {
|
897
|
-
for (i = 0; i <
|
898
|
-
|
742
|
+
for (let i = 0; i < length; ++i) {
|
743
|
+
const code = PDFStringTranslateTable[str.charCodeAt(i)];
|
899
744
|
strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
|
900
745
|
}
|
901
746
|
}
|
902
747
|
|
903
|
-
return strBuf.join(
|
748
|
+
return strBuf.join("");
|
904
749
|
}
|
905
750
|
|
906
751
|
function stringToUTF8String(str) {
|
@@ -912,7 +757,7 @@ function utf8StringToString(str) {
|
|
912
757
|
}
|
913
758
|
|
914
759
|
function isEmptyObj(obj) {
|
915
|
-
for (
|
760
|
+
for (const key in obj) {
|
916
761
|
return false;
|
917
762
|
}
|
918
763
|
|
@@ -920,32 +765,39 @@ function isEmptyObj(obj) {
|
|
920
765
|
}
|
921
766
|
|
922
767
|
function isBool(v) {
|
923
|
-
return typeof v ===
|
768
|
+
return typeof v === "boolean";
|
924
769
|
}
|
925
770
|
|
926
771
|
function isNum(v) {
|
927
|
-
return typeof v ===
|
772
|
+
return typeof v === "number";
|
928
773
|
}
|
929
774
|
|
930
775
|
function isString(v) {
|
931
|
-
return typeof v ===
|
776
|
+
return typeof v === "string";
|
932
777
|
}
|
933
778
|
|
934
779
|
function isArrayBuffer(v) {
|
935
|
-
return
|
780
|
+
return typeof v === "object" && v !== null && v.byteLength !== undefined;
|
936
781
|
}
|
937
782
|
|
938
|
-
function
|
939
|
-
|
783
|
+
function isArrayEqual(arr1, arr2) {
|
784
|
+
if (arr1.length !== arr2.length) {
|
785
|
+
return false;
|
786
|
+
}
|
787
|
+
|
788
|
+
return arr1.every(function (element, index) {
|
789
|
+
return element === arr2[index];
|
790
|
+
});
|
940
791
|
}
|
941
792
|
|
942
793
|
function createPromiseCapability() {
|
943
|
-
|
944
|
-
|
945
|
-
Object.defineProperty(capability,
|
946
|
-
get
|
794
|
+
const capability = Object.create(null);
|
795
|
+
let isSettled = false;
|
796
|
+
Object.defineProperty(capability, "settled", {
|
797
|
+
get() {
|
947
798
|
return isSettled;
|
948
799
|
}
|
800
|
+
|
949
801
|
});
|
950
802
|
capability.promise = new Promise(function (resolve, reject) {
|
951
803
|
capability.resolve = function (data) {
|
@@ -961,28 +813,26 @@ function createPromiseCapability() {
|
|
961
813
|
return capability;
|
962
814
|
}
|
963
815
|
|
964
|
-
|
965
|
-
|
966
|
-
return function createObjectURL(data, contentType) {
|
967
|
-
|
968
|
-
|
969
|
-
if (!forceDataSchema && _url_polyfill.URL.createObjectURL) {
|
970
|
-
var blob = new Blob([data], {
|
816
|
+
const createObjectURL = function createObjectURLClosure() {
|
817
|
+
const digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
818
|
+
return function createObjectURL(data, contentType, forceDataSchema = false) {
|
819
|
+
if (!forceDataSchema && URL.createObjectURL) {
|
820
|
+
const blob = new Blob([data], {
|
971
821
|
type: contentType
|
972
822
|
});
|
973
|
-
return
|
823
|
+
return URL.createObjectURL(blob);
|
974
824
|
}
|
975
825
|
|
976
|
-
|
826
|
+
let buffer = `data:${contentType};base64,`;
|
977
827
|
|
978
|
-
for (
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
828
|
+
for (let i = 0, ii = data.length; i < ii; i += 3) {
|
829
|
+
const b1 = data[i] & 0xff;
|
830
|
+
const b2 = data[i + 1] & 0xff;
|
831
|
+
const b3 = data[i + 2] & 0xff;
|
832
|
+
const d1 = b1 >> 2,
|
833
|
+
d2 = (b1 & 3) << 4 | b2 >> 4;
|
834
|
+
const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64;
|
835
|
+
const d4 = i + 2 < ii ? b3 & 0x3f : 64;
|
986
836
|
buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
|
987
837
|
}
|
988
838
|
|