pdfjs-dist 2.3.200 → 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/README.md +4 -0
- package/bower.json +1 -1
- package/build/pdf.js +6499 -17971
- 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 +19303 -29896
- 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 +1333 -4839
- 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 +683 -1066
- 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 +196 -193
- package/lib/core/charsets.js +4 -4
- package/lib/core/chunked_stream.js +441 -569
- package/lib/core/cmap.js +220 -279
- package/lib/core/colorspace.js +699 -863
- package/lib/core/core_utils.js +59 -80
- package/lib/core/crypto.js +379 -437
- package/lib/core/document.js +564 -673
- package/lib/core/encodings.js +15 -15
- package/lib/core/evaluator.js +983 -889
- package/lib/core/font_renderer.js +128 -171
- package/lib/core/fonts.js +451 -400
- package/lib/core/function.js +289 -285
- package/lib/core/glyphlist.js +4527 -4527
- package/lib/core/image.js +138 -117
- package/lib/core/image_utils.js +46 -63
- package/lib/core/jbig2.js +324 -332
- package/lib/core/jbig2_stream.js +18 -17
- package/lib/core/jpeg_stream.js +133 -24
- package/lib/core/jpg.js +238 -210
- package/lib/core/jpx.js +158 -157
- 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 +1111 -1302
- package/lib/core/operator_list.js +55 -42
- package/lib/core/parser.js +956 -987
- package/lib/core/pattern.js +69 -69
- package/lib/core/pdf_manager.js +149 -316
- package/lib/core/primitives.js +45 -77
- package/lib/core/ps_parser.js +175 -214
- package/lib/core/standard_fonts.js +237 -236
- package/lib/core/stream.js +83 -77
- package/lib/core/type1_parser.js +78 -68
- package/lib/core/unicode.js +1654 -1654
- package/lib/core/worker.js +148 -196
- package/lib/core/worker_stream.js +101 -210
- package/lib/display/annotation_layer.js +733 -1155
- package/lib/display/api.js +1539 -1928
- package/lib/display/api_compatibility.js +10 -8
- package/lib/display/canvas.js +159 -158
- package/lib/display/content_disposition.js +36 -55
- package/lib/display/display_utils.js +298 -551
- package/lib/display/fetch_stream.js +181 -305
- package/lib/display/font_loader.js +273 -416
- package/lib/display/metadata.js +86 -98
- package/lib/display/network.js +376 -511
- package/lib/display/network_utils.js +20 -19
- package/lib/display/node_stream.js +276 -460
- package/lib/display/pattern_helper.js +76 -44
- package/lib/display/svg.js +1137 -1405
- package/lib/display/text_layer.js +75 -82
- package/lib/display/transport_stream.js +236 -374
- 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 +22 -21
- package/lib/pdf.worker.js +5 -5
- package/lib/shared/compatibility.js +2 -251
- package/lib/shared/is_node.js +7 -6
- package/lib/shared/message_handler.js +222 -194
- package/lib/shared/util.js +269 -405
- package/lib/test/unit/annotation_spec.js +1089 -1014
- package/lib/test/unit/api_spec.js +617 -544
- package/lib/test/unit/bidi_spec.js +7 -7
- package/lib/test/unit/cff_parser_spec.js +63 -62
- package/lib/test/unit/clitests_helper.js +7 -9
- package/lib/test/unit/cmap_spec.js +84 -86
- package/lib/test/unit/colorspace_spec.js +154 -154
- package/lib/test/unit/core_utils_spec.js +125 -105
- package/lib/test/unit/crypto_spec.js +181 -181
- package/lib/test/unit/custom_spec.js +22 -24
- package/lib/test/unit/display_svg_spec.js +35 -36
- package/lib/test/unit/display_utils_spec.js +139 -149
- package/lib/test/unit/document_spec.js +16 -16
- package/lib/test/unit/encodings_spec.js +12 -34
- package/lib/test/unit/evaluator_spec.js +81 -95
- package/lib/test/unit/fetch_stream_spec.js +30 -30
- 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 +172 -162
- 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 +12 -12
- package/lib/test/unit/network_utils_spec.js +152 -152
- package/lib/test/unit/node_stream_spec.js +74 -90
- package/lib/test/unit/parser_spec.js +107 -113
- 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 +117 -115
- package/lib/test/unit/stream_spec.js +16 -14
- package/lib/test/unit/test_utils.js +119 -285
- package/lib/test/unit/testreporter.js +19 -19
- package/lib/test/unit/type1_parser_spec.js +41 -41
- package/lib/test/unit/ui_utils_spec.js +318 -426
- package/lib/test/unit/unicode_spec.js +42 -42
- package/lib/test/unit/util_spec.js +122 -143
- package/lib/web/annotation_layer_builder.js +66 -103
- package/lib/web/app.js +1166 -1196
- package/lib/web/app_options.js +61 -77
- package/lib/web/base_viewer.js +804 -850
- package/lib/web/chromecom.js +164 -249
- package/lib/web/debugger.js +149 -205
- package/lib/web/download_manager.js +38 -57
- package/lib/web/firefox_print_service.js +35 -30
- package/lib/web/firefoxcom.js +175 -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 -258
- package/lib/web/overlay_manager.js +70 -246
- package/lib/web/password_prompt.js +38 -64
- package/lib/web/pdf_attachment_viewer.js +105 -130
- package/lib/web/pdf_cursor_tools.js +75 -102
- package/lib/web/pdf_document_properties.js +227 -376
- package/lib/web/pdf_find_bar.js +137 -171
- package/lib/web/pdf_find_controller.js +492 -549
- package/lib/web/pdf_find_utils.js +13 -13
- package/lib/web/pdf_history.js +395 -406
- package/lib/web/pdf_link_service.js +302 -349
- package/lib/web/pdf_outline_viewer.js +148 -209
- package/lib/web/pdf_page_view.js +449 -507
- package/lib/web/pdf_presentation_mode.js +304 -357
- package/lib/web/pdf_print_service.js +90 -104
- package/lib/web/pdf_rendering_queue.js +87 -108
- package/lib/web/pdf_sidebar.js +264 -304
- 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 +66 -273
- package/lib/web/secondary_toolbar.js +164 -196
- package/lib/web/text_layer_builder.js +284 -317
- package/lib/web/toolbar.js +216 -211
- package/lib/web/ui_utils.js +303 -404
- package/lib/web/view_history.js +49 -222
- package/lib/web/viewer_compatibility.js +7 -5
- package/package.json +2 -9
- package/web/pdf_viewer.css +25 -18
- package/web/pdf_viewer.js +3481 -4764
- package/web/pdf_viewer.js.map +1 -1
- package/webpack.js +14 -5
- package/lib/shared/streams_polyfill.js +0 -43
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.
|
@@ -37,15 +37,8 @@ exports.isBool = isBool;
|
|
37
37
|
exports.isEmptyObj = isEmptyObj;
|
38
38
|
exports.isNum = isNum;
|
39
39
|
exports.isString = isString;
|
40
|
-
exports.isSpace = isSpace;
|
41
40
|
exports.isSameOrigin = isSameOrigin;
|
42
41
|
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
42
|
exports.removeNullCharacters = removeNullCharacters;
|
50
43
|
exports.setVerbosityLevel = setVerbosityLevel;
|
51
44
|
exports.shadow = shadow;
|
@@ -56,47 +49,21 @@ exports.stringToUTF8String = stringToUTF8String;
|
|
56
49
|
exports.utf8StringToString = utf8StringToString;
|
57
50
|
exports.warn = warn;
|
58
51
|
exports.unreachable = unreachable;
|
59
|
-
|
60
|
-
enumerable: true,
|
61
|
-
get: function () {
|
62
|
-
return _streams_polyfill.ReadableStream;
|
63
|
-
}
|
64
|
-
});
|
65
|
-
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;
|
66
|
-
|
67
|
-
require("./compatibility");
|
68
|
-
|
69
|
-
var _streams_polyfill = require("./streams_polyfill");
|
70
|
-
|
71
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
72
|
-
|
73
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
74
|
-
|
75
|
-
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); }
|
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;
|
76
53
|
|
77
|
-
|
54
|
+
require("./compatibility.js");
|
78
55
|
|
79
|
-
|
80
|
-
|
81
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
82
|
-
|
83
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
84
|
-
|
85
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
86
|
-
|
87
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
88
|
-
|
89
|
-
var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
|
56
|
+
const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
|
90
57
|
exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
|
91
|
-
|
58
|
+
const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
|
92
59
|
exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
|
93
|
-
|
94
|
-
NONE:
|
95
|
-
DECODE:
|
96
|
-
DISPLAY:
|
60
|
+
const NativeImageDecoding = {
|
61
|
+
NONE: "none",
|
62
|
+
DECODE: "decode",
|
63
|
+
DISPLAY: "display"
|
97
64
|
};
|
98
65
|
exports.NativeImageDecoding = NativeImageDecoding;
|
99
|
-
|
66
|
+
const PermissionFlag = {
|
100
67
|
PRINT: 0x04,
|
101
68
|
MODIFY_CONTENTS: 0x08,
|
102
69
|
COPY: 0x10,
|
@@ -107,7 +74,7 @@ var PermissionFlag = {
|
|
107
74
|
PRINT_HIGH_QUALITY: 0x800
|
108
75
|
};
|
109
76
|
exports.PermissionFlag = PermissionFlag;
|
110
|
-
|
77
|
+
const TextRenderingMode = {
|
111
78
|
FILL: 0,
|
112
79
|
STROKE: 1,
|
113
80
|
FILL_STROKE: 2,
|
@@ -120,13 +87,13 @@ var TextRenderingMode = {
|
|
120
87
|
ADD_TO_PATH_FLAG: 4
|
121
88
|
};
|
122
89
|
exports.TextRenderingMode = TextRenderingMode;
|
123
|
-
|
90
|
+
const ImageKind = {
|
124
91
|
GRAYSCALE_1BPP: 1,
|
125
92
|
RGB_24BPP: 2,
|
126
93
|
RGBA_32BPP: 3
|
127
94
|
};
|
128
95
|
exports.ImageKind = ImageKind;
|
129
|
-
|
96
|
+
const AnnotationType = {
|
130
97
|
TEXT: 1,
|
131
98
|
LINK: 2,
|
132
99
|
FREETEXT: 3,
|
@@ -155,30 +122,30 @@ var AnnotationType = {
|
|
155
122
|
REDACT: 26
|
156
123
|
};
|
157
124
|
exports.AnnotationType = AnnotationType;
|
158
|
-
|
159
|
-
MARKED:
|
160
|
-
REVIEW:
|
125
|
+
const AnnotationStateModelType = {
|
126
|
+
MARKED: "Marked",
|
127
|
+
REVIEW: "Review"
|
161
128
|
};
|
162
129
|
exports.AnnotationStateModelType = AnnotationStateModelType;
|
163
|
-
|
164
|
-
MARKED:
|
165
|
-
UNMARKED:
|
130
|
+
const AnnotationMarkedState = {
|
131
|
+
MARKED: "Marked",
|
132
|
+
UNMARKED: "Unmarked"
|
166
133
|
};
|
167
134
|
exports.AnnotationMarkedState = AnnotationMarkedState;
|
168
|
-
|
169
|
-
ACCEPTED:
|
170
|
-
REJECTED:
|
171
|
-
CANCELLED:
|
172
|
-
COMPLETED:
|
173
|
-
NONE:
|
135
|
+
const AnnotationReviewState = {
|
136
|
+
ACCEPTED: "Accepted",
|
137
|
+
REJECTED: "Rejected",
|
138
|
+
CANCELLED: "Cancelled",
|
139
|
+
COMPLETED: "Completed",
|
140
|
+
NONE: "None"
|
174
141
|
};
|
175
142
|
exports.AnnotationReviewState = AnnotationReviewState;
|
176
|
-
|
177
|
-
GROUP:
|
178
|
-
REPLY:
|
143
|
+
const AnnotationReplyType = {
|
144
|
+
GROUP: "Group",
|
145
|
+
REPLY: "R"
|
179
146
|
};
|
180
147
|
exports.AnnotationReplyType = AnnotationReplyType;
|
181
|
-
|
148
|
+
const AnnotationFlag = {
|
182
149
|
INVISIBLE: 0x01,
|
183
150
|
HIDDEN: 0x02,
|
184
151
|
PRINT: 0x04,
|
@@ -191,7 +158,7 @@ var AnnotationFlag = {
|
|
191
158
|
LOCKEDCONTENTS: 0x200
|
192
159
|
};
|
193
160
|
exports.AnnotationFlag = AnnotationFlag;
|
194
|
-
|
161
|
+
const AnnotationFieldFlag = {
|
195
162
|
READONLY: 0x0000001,
|
196
163
|
REQUIRED: 0x0000002,
|
197
164
|
NOEXPORT: 0x0000004,
|
@@ -213,7 +180,7 @@ var AnnotationFieldFlag = {
|
|
213
180
|
COMMITONSELCHANGE: 0x4000000
|
214
181
|
};
|
215
182
|
exports.AnnotationFieldFlag = AnnotationFieldFlag;
|
216
|
-
|
183
|
+
const AnnotationBorderStyleType = {
|
217
184
|
SOLID: 1,
|
218
185
|
DASHED: 2,
|
219
186
|
BEVELED: 3,
|
@@ -221,46 +188,46 @@ var AnnotationBorderStyleType = {
|
|
221
188
|
UNDERLINE: 5
|
222
189
|
};
|
223
190
|
exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
|
224
|
-
|
225
|
-
UNKNOWN:
|
226
|
-
FLATE:
|
227
|
-
LZW:
|
228
|
-
DCT:
|
229
|
-
JPX:
|
230
|
-
JBIG:
|
231
|
-
A85:
|
232
|
-
AHX:
|
233
|
-
CCF:
|
234
|
-
RLX:
|
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"
|
235
202
|
};
|
236
203
|
exports.StreamType = StreamType;
|
237
|
-
|
238
|
-
UNKNOWN:
|
239
|
-
TYPE1:
|
240
|
-
TYPE1C:
|
241
|
-
CIDFONTTYPE0:
|
242
|
-
CIDFONTTYPE0C:
|
243
|
-
TRUETYPE:
|
244
|
-
CIDFONTTYPE2:
|
245
|
-
TYPE3:
|
246
|
-
OPENTYPE:
|
247
|
-
TYPE0:
|
248
|
-
MMTYPE1:
|
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"
|
249
216
|
};
|
250
217
|
exports.FontType = FontType;
|
251
|
-
|
218
|
+
const VerbosityLevel = {
|
252
219
|
ERRORS: 0,
|
253
220
|
WARNINGS: 1,
|
254
221
|
INFOS: 5
|
255
222
|
};
|
256
223
|
exports.VerbosityLevel = VerbosityLevel;
|
257
|
-
|
224
|
+
const CMapCompressionType = {
|
258
225
|
NONE: 0,
|
259
226
|
BINARY: 1,
|
260
227
|
STREAM: 2
|
261
228
|
};
|
262
229
|
exports.CMapCompressionType = CMapCompressionType;
|
263
|
-
|
230
|
+
const OPS = {
|
264
231
|
dependency: 1,
|
265
232
|
setLineWidth: 2,
|
266
233
|
setLineCap: 3,
|
@@ -354,21 +321,21 @@ var OPS = {
|
|
354
321
|
constructPath: 91
|
355
322
|
};
|
356
323
|
exports.OPS = OPS;
|
357
|
-
|
358
|
-
unknown:
|
359
|
-
forms:
|
360
|
-
javaScript:
|
361
|
-
smask:
|
362
|
-
shadingPattern:
|
363
|
-
font:
|
324
|
+
const UNSUPPORTED_FEATURES = {
|
325
|
+
unknown: "unknown",
|
326
|
+
forms: "forms",
|
327
|
+
javaScript: "javaScript",
|
328
|
+
smask: "smask",
|
329
|
+
shadingPattern: "shadingPattern",
|
330
|
+
font: "font"
|
364
331
|
};
|
365
332
|
exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
|
366
|
-
|
333
|
+
const PasswordResponses = {
|
367
334
|
NEED_PASSWORD: 1,
|
368
335
|
INCORRECT_PASSWORD: 2
|
369
336
|
};
|
370
337
|
exports.PasswordResponses = PasswordResponses;
|
371
|
-
|
338
|
+
let verbosity = VerbosityLevel.WARNINGS;
|
372
339
|
|
373
340
|
function setVerbosityLevel(level) {
|
374
341
|
if (Number.isInteger(level)) {
|
@@ -382,13 +349,13 @@ function getVerbosityLevel() {
|
|
382
349
|
|
383
350
|
function info(msg) {
|
384
351
|
if (verbosity >= VerbosityLevel.INFOS) {
|
385
|
-
console.log(
|
352
|
+
console.log(`Info: ${msg}`);
|
386
353
|
}
|
387
354
|
}
|
388
355
|
|
389
356
|
function warn(msg) {
|
390
357
|
if (verbosity >= VerbosityLevel.WARNINGS) {
|
391
|
-
console.log(
|
358
|
+
console.log(`Warning: ${msg}`);
|
392
359
|
}
|
393
360
|
}
|
394
361
|
|
@@ -403,19 +370,19 @@ function assert(cond, msg) {
|
|
403
370
|
}
|
404
371
|
|
405
372
|
function isSameOrigin(baseUrl, otherUrl) {
|
406
|
-
|
373
|
+
let base;
|
407
374
|
|
408
375
|
try {
|
409
376
|
base = new URL(baseUrl);
|
410
377
|
|
411
|
-
if (!base.origin || base.origin ===
|
378
|
+
if (!base.origin || base.origin === "null") {
|
412
379
|
return false;
|
413
380
|
}
|
414
381
|
} catch (e) {
|
415
382
|
return false;
|
416
383
|
}
|
417
384
|
|
418
|
-
|
385
|
+
const other = new URL(otherUrl, base);
|
419
386
|
return base.origin === other.origin;
|
420
387
|
}
|
421
388
|
|
@@ -425,11 +392,11 @@ function _isValidProtocol(url) {
|
|
425
392
|
}
|
426
393
|
|
427
394
|
switch (url.protocol) {
|
428
|
-
case
|
429
|
-
case
|
430
|
-
case
|
431
|
-
case
|
432
|
-
case
|
395
|
+
case "http:":
|
396
|
+
case "https:":
|
397
|
+
case "ftp:":
|
398
|
+
case "mailto:":
|
399
|
+
case "tel:":
|
433
400
|
return true;
|
434
401
|
|
435
402
|
default:
|
@@ -443,7 +410,7 @@ function createValidAbsoluteUrl(url, baseUrl) {
|
|
443
410
|
}
|
444
411
|
|
445
412
|
try {
|
446
|
-
|
413
|
+
const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
|
447
414
|
|
448
415
|
if (_isValidProtocol(absoluteUrl)) {
|
449
416
|
return absoluteUrl;
|
@@ -455,7 +422,7 @@ function createValidAbsoluteUrl(url, baseUrl) {
|
|
455
422
|
|
456
423
|
function shadow(obj, prop, value) {
|
457
424
|
Object.defineProperty(obj, prop, {
|
458
|
-
value
|
425
|
+
value,
|
459
426
|
enumerable: true,
|
460
427
|
configurable: true,
|
461
428
|
writable: false
|
@@ -463,10 +430,10 @@ function shadow(obj, prop, value) {
|
|
463
430
|
return value;
|
464
431
|
}
|
465
432
|
|
466
|
-
|
433
|
+
const BaseException = function BaseExceptionClosure() {
|
467
434
|
function BaseException(message) {
|
468
435
|
if (this.constructor === BaseException) {
|
469
|
-
unreachable(
|
436
|
+
unreachable("Cannot initialize BaseException.");
|
470
437
|
}
|
471
438
|
|
472
439
|
this.message = message;
|
@@ -480,167 +447,89 @@ var BaseException = function BaseExceptionClosure() {
|
|
480
447
|
|
481
448
|
exports.BaseException = BaseException;
|
482
449
|
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
function PasswordException(msg, code) {
|
489
|
-
var _this;
|
490
|
-
|
491
|
-
_classCallCheck(this, PasswordException);
|
492
|
-
|
493
|
-
_this = _possibleConstructorReturn(this, _getPrototypeOf(PasswordException).call(this, msg));
|
494
|
-
_this.code = code;
|
495
|
-
return _this;
|
450
|
+
class PasswordException extends BaseException {
|
451
|
+
constructor(msg, code) {
|
452
|
+
super(msg);
|
453
|
+
this.code = code;
|
496
454
|
}
|
497
455
|
|
498
|
-
|
499
|
-
}(BaseException);
|
456
|
+
}
|
500
457
|
|
501
458
|
exports.PasswordException = PasswordException;
|
502
459
|
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
function UnknownErrorException(msg, details) {
|
509
|
-
var _this2;
|
510
|
-
|
511
|
-
_classCallCheck(this, UnknownErrorException);
|
512
|
-
|
513
|
-
_this2 = _possibleConstructorReturn(this, _getPrototypeOf(UnknownErrorException).call(this, msg));
|
514
|
-
_this2.details = details;
|
515
|
-
return _this2;
|
460
|
+
class UnknownErrorException extends BaseException {
|
461
|
+
constructor(msg, details) {
|
462
|
+
super(msg);
|
463
|
+
this.details = details;
|
516
464
|
}
|
517
465
|
|
518
|
-
|
519
|
-
}(BaseException);
|
466
|
+
}
|
520
467
|
|
521
468
|
exports.UnknownErrorException = UnknownErrorException;
|
522
469
|
|
523
|
-
|
524
|
-
/*#__PURE__*/
|
525
|
-
function (_BaseException3) {
|
526
|
-
_inherits(InvalidPDFException, _BaseException3);
|
527
|
-
|
528
|
-
function InvalidPDFException() {
|
529
|
-
_classCallCheck(this, InvalidPDFException);
|
530
|
-
|
531
|
-
return _possibleConstructorReturn(this, _getPrototypeOf(InvalidPDFException).apply(this, arguments));
|
532
|
-
}
|
533
|
-
|
534
|
-
return InvalidPDFException;
|
535
|
-
}(BaseException);
|
470
|
+
class InvalidPDFException extends BaseException {}
|
536
471
|
|
537
472
|
exports.InvalidPDFException = InvalidPDFException;
|
538
473
|
|
539
|
-
|
540
|
-
/*#__PURE__*/
|
541
|
-
function (_BaseException4) {
|
542
|
-
_inherits(MissingPDFException, _BaseException4);
|
543
|
-
|
544
|
-
function MissingPDFException() {
|
545
|
-
_classCallCheck(this, MissingPDFException);
|
546
|
-
|
547
|
-
return _possibleConstructorReturn(this, _getPrototypeOf(MissingPDFException).apply(this, arguments));
|
548
|
-
}
|
549
|
-
|
550
|
-
return MissingPDFException;
|
551
|
-
}(BaseException);
|
474
|
+
class MissingPDFException extends BaseException {}
|
552
475
|
|
553
476
|
exports.MissingPDFException = MissingPDFException;
|
554
477
|
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
function UnexpectedResponseException(msg, status) {
|
561
|
-
var _this3;
|
562
|
-
|
563
|
-
_classCallCheck(this, UnexpectedResponseException);
|
564
|
-
|
565
|
-
_this3 = _possibleConstructorReturn(this, _getPrototypeOf(UnexpectedResponseException).call(this, msg));
|
566
|
-
_this3.status = status;
|
567
|
-
return _this3;
|
478
|
+
class UnexpectedResponseException extends BaseException {
|
479
|
+
constructor(msg, status) {
|
480
|
+
super(msg);
|
481
|
+
this.status = status;
|
568
482
|
}
|
569
483
|
|
570
|
-
|
571
|
-
}(BaseException);
|
484
|
+
}
|
572
485
|
|
573
486
|
exports.UnexpectedResponseException = UnexpectedResponseException;
|
574
487
|
|
575
|
-
|
576
|
-
/*#__PURE__*/
|
577
|
-
function (_BaseException6) {
|
578
|
-
_inherits(FormatError, _BaseException6);
|
579
|
-
|
580
|
-
function FormatError() {
|
581
|
-
_classCallCheck(this, FormatError);
|
582
|
-
|
583
|
-
return _possibleConstructorReturn(this, _getPrototypeOf(FormatError).apply(this, arguments));
|
584
|
-
}
|
585
|
-
|
586
|
-
return FormatError;
|
587
|
-
}(BaseException);
|
488
|
+
class FormatError extends BaseException {}
|
588
489
|
|
589
490
|
exports.FormatError = FormatError;
|
590
491
|
|
591
|
-
|
592
|
-
/*#__PURE__*/
|
593
|
-
function (_BaseException7) {
|
594
|
-
_inherits(AbortException, _BaseException7);
|
595
|
-
|
596
|
-
function AbortException() {
|
597
|
-
_classCallCheck(this, AbortException);
|
598
|
-
|
599
|
-
return _possibleConstructorReturn(this, _getPrototypeOf(AbortException).apply(this, arguments));
|
600
|
-
}
|
601
|
-
|
602
|
-
return AbortException;
|
603
|
-
}(BaseException);
|
492
|
+
class AbortException extends BaseException {}
|
604
493
|
|
605
494
|
exports.AbortException = AbortException;
|
606
|
-
|
495
|
+
const NullCharactersRegExp = /\x00/g;
|
607
496
|
|
608
497
|
function removeNullCharacters(str) {
|
609
|
-
if (typeof str !==
|
610
|
-
warn(
|
498
|
+
if (typeof str !== "string") {
|
499
|
+
warn("The argument for removeNullCharacters must be a string.");
|
611
500
|
return str;
|
612
501
|
}
|
613
502
|
|
614
|
-
return str.replace(NullCharactersRegExp,
|
503
|
+
return str.replace(NullCharactersRegExp, "");
|
615
504
|
}
|
616
505
|
|
617
506
|
function bytesToString(bytes) {
|
618
|
-
assert(bytes !== null &&
|
619
|
-
|
620
|
-
|
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;
|
621
510
|
|
622
511
|
if (length < MAX_ARGUMENT_COUNT) {
|
623
512
|
return String.fromCharCode.apply(null, bytes);
|
624
513
|
}
|
625
514
|
|
626
|
-
|
515
|
+
const strBuf = [];
|
627
516
|
|
628
|
-
for (
|
629
|
-
|
630
|
-
|
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);
|
631
520
|
strBuf.push(String.fromCharCode.apply(null, chunk));
|
632
521
|
}
|
633
522
|
|
634
|
-
return strBuf.join(
|
523
|
+
return strBuf.join("");
|
635
524
|
}
|
636
525
|
|
637
526
|
function stringToBytes(str) {
|
638
|
-
assert(typeof str ===
|
639
|
-
|
640
|
-
|
527
|
+
assert(typeof str === "string", "Invalid argument for stringToBytes");
|
528
|
+
const length = str.length;
|
529
|
+
const bytes = new Uint8Array(length);
|
641
530
|
|
642
|
-
for (
|
643
|
-
bytes[i] = str.charCodeAt(i) &
|
531
|
+
for (let i = 0; i < length; ++i) {
|
532
|
+
bytes[i] = str.charCodeAt(i) & 0xff;
|
644
533
|
}
|
645
534
|
|
646
535
|
return bytes;
|
@@ -656,33 +545,33 @@ function arrayByteLength(arr) {
|
|
656
545
|
}
|
657
546
|
|
658
547
|
function arraysToBytes(arr) {
|
659
|
-
|
548
|
+
const length = arr.length;
|
660
549
|
|
661
550
|
if (length === 1 && arr[0] instanceof Uint8Array) {
|
662
551
|
return arr[0];
|
663
552
|
}
|
664
553
|
|
665
|
-
|
554
|
+
let resultLength = 0;
|
666
555
|
|
667
|
-
for (
|
556
|
+
for (let i = 0; i < length; i++) {
|
668
557
|
resultLength += arrayByteLength(arr[i]);
|
669
558
|
}
|
670
559
|
|
671
|
-
|
672
|
-
|
560
|
+
let pos = 0;
|
561
|
+
const data = new Uint8Array(resultLength);
|
673
562
|
|
674
|
-
for (
|
675
|
-
|
563
|
+
for (let i = 0; i < length; i++) {
|
564
|
+
let item = arr[i];
|
676
565
|
|
677
566
|
if (!(item instanceof Uint8Array)) {
|
678
|
-
if (typeof item ===
|
567
|
+
if (typeof item === "string") {
|
679
568
|
item = stringToBytes(item);
|
680
569
|
} else {
|
681
570
|
item = new Uint8Array(item);
|
682
571
|
}
|
683
572
|
}
|
684
573
|
|
685
|
-
|
574
|
+
const itemLength = item.byteLength;
|
686
575
|
data.set(item, pos);
|
687
576
|
pos += itemLength;
|
688
577
|
}
|
@@ -694,183 +583,163 @@ function string32(value) {
|
|
694
583
|
return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
|
695
584
|
}
|
696
585
|
|
697
|
-
function log2(x) {
|
698
|
-
if (x <= 0) {
|
699
|
-
return 0;
|
700
|
-
}
|
701
|
-
|
702
|
-
return Math.ceil(Math.log2(x));
|
703
|
-
}
|
704
|
-
|
705
|
-
function readInt8(data, start) {
|
706
|
-
return data[start] << 24 >> 24;
|
707
|
-
}
|
708
|
-
|
709
|
-
function readUint16(data, offset) {
|
710
|
-
return data[offset] << 8 | data[offset + 1];
|
711
|
-
}
|
712
|
-
|
713
|
-
function readUint32(data, offset) {
|
714
|
-
return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
|
715
|
-
}
|
716
|
-
|
717
586
|
function isLittleEndian() {
|
718
|
-
|
587
|
+
const buffer8 = new Uint8Array(4);
|
719
588
|
buffer8[0] = 1;
|
720
|
-
|
589
|
+
const view32 = new Uint32Array(buffer8.buffer, 0, 1);
|
721
590
|
return view32[0] === 1;
|
722
591
|
}
|
723
592
|
|
593
|
+
const IsLittleEndianCached = {
|
594
|
+
get value() {
|
595
|
+
return shadow(this, "value", isLittleEndian());
|
596
|
+
}
|
597
|
+
|
598
|
+
};
|
599
|
+
exports.IsLittleEndianCached = IsLittleEndianCached;
|
600
|
+
|
724
601
|
function isEvalSupported() {
|
725
602
|
try {
|
726
|
-
new Function(
|
603
|
+
new Function("");
|
727
604
|
return true;
|
728
605
|
} catch (e) {
|
729
606
|
return false;
|
730
607
|
}
|
731
608
|
}
|
732
609
|
|
733
|
-
|
610
|
+
const IsEvalSupportedCached = {
|
611
|
+
get value() {
|
612
|
+
return shadow(this, "value", isEvalSupported());
|
613
|
+
}
|
734
614
|
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
615
|
+
};
|
616
|
+
exports.IsEvalSupportedCached = IsEvalSupportedCached;
|
617
|
+
const rgbBuf = ["rgb(", 0, ",", 0, ",", 0, ")"];
|
618
|
+
|
619
|
+
class Util {
|
620
|
+
static makeCssRgb(r, g, b) {
|
621
|
+
rgbBuf[1] = r;
|
622
|
+
rgbBuf[3] = g;
|
623
|
+
rgbBuf[5] = b;
|
624
|
+
return rgbBuf.join("");
|
740
625
|
}
|
741
626
|
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
rgbBuf[1] = r;
|
746
|
-
rgbBuf[3] = g;
|
747
|
-
rgbBuf[5] = b;
|
748
|
-
return rgbBuf.join('');
|
749
|
-
}
|
750
|
-
}, {
|
751
|
-
key: "transform",
|
752
|
-
value: function transform(m1, m2) {
|
753
|
-
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]];
|
754
|
-
}
|
755
|
-
}, {
|
756
|
-
key: "applyTransform",
|
757
|
-
value: function applyTransform(p, m) {
|
758
|
-
var xt = p[0] * m[0] + p[1] * m[2] + m[4];
|
759
|
-
var yt = p[0] * m[1] + p[1] * m[3] + m[5];
|
760
|
-
return [xt, yt];
|
761
|
-
}
|
762
|
-
}, {
|
763
|
-
key: "applyInverseTransform",
|
764
|
-
value: function applyInverseTransform(p, m) {
|
765
|
-
var d = m[0] * m[3] - m[1] * m[2];
|
766
|
-
var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
|
767
|
-
var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
|
768
|
-
return [xt, yt];
|
769
|
-
}
|
770
|
-
}, {
|
771
|
-
key: "getAxialAlignedBoundingBox",
|
772
|
-
value: function getAxialAlignedBoundingBox(r, m) {
|
773
|
-
var p1 = Util.applyTransform(r, m);
|
774
|
-
var p2 = Util.applyTransform(r.slice(2, 4), m);
|
775
|
-
var p3 = Util.applyTransform([r[0], r[3]], m);
|
776
|
-
var p4 = Util.applyTransform([r[2], r[1]], m);
|
777
|
-
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])];
|
778
|
-
}
|
779
|
-
}, {
|
780
|
-
key: "inverseTransform",
|
781
|
-
value: function inverseTransform(m) {
|
782
|
-
var d = m[0] * m[3] - m[1] * m[2];
|
783
|
-
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];
|
784
|
-
}
|
785
|
-
}, {
|
786
|
-
key: "apply3dTransform",
|
787
|
-
value: function apply3dTransform(m, v) {
|
788
|
-
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]];
|
789
|
-
}
|
790
|
-
}, {
|
791
|
-
key: "singularValueDecompose2dScale",
|
792
|
-
value: function singularValueDecompose2dScale(m) {
|
793
|
-
var transpose = [m[0], m[2], m[1], m[3]];
|
794
|
-
var a = m[0] * transpose[0] + m[1] * transpose[2];
|
795
|
-
var b = m[0] * transpose[1] + m[1] * transpose[3];
|
796
|
-
var c = m[2] * transpose[0] + m[3] * transpose[2];
|
797
|
-
var d = m[2] * transpose[1] + m[3] * transpose[3];
|
798
|
-
var first = (a + d) / 2;
|
799
|
-
var second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2;
|
800
|
-
var sx = first + second || 1;
|
801
|
-
var sy = first - second || 1;
|
802
|
-
return [Math.sqrt(sx), Math.sqrt(sy)];
|
803
|
-
}
|
804
|
-
}, {
|
805
|
-
key: "normalizeRect",
|
806
|
-
value: function normalizeRect(rect) {
|
807
|
-
var r = rect.slice(0);
|
808
|
-
|
809
|
-
if (rect[0] > rect[2]) {
|
810
|
-
r[0] = rect[2];
|
811
|
-
r[2] = rect[0];
|
812
|
-
}
|
627
|
+
static transform(m1, m2) {
|
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]];
|
629
|
+
}
|
813
630
|
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
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];
|
634
|
+
return [xt, yt];
|
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;
|
641
|
+
return [xt, yt];
|
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);
|
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])];
|
650
|
+
}
|
651
|
+
|
652
|
+
static inverseTransform(m) {
|
653
|
+
const d = m[0] * m[3] - m[1] * m[2];
|
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];
|
655
|
+
}
|
818
656
|
|
819
|
-
|
657
|
+
static apply3dTransform(m, v) {
|
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]];
|
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;
|
671
|
+
return [Math.sqrt(sx), Math.sqrt(sy)];
|
672
|
+
}
|
673
|
+
|
674
|
+
static normalizeRect(rect) {
|
675
|
+
const r = rect.slice(0);
|
676
|
+
|
677
|
+
if (rect[0] > rect[2]) {
|
678
|
+
r[0] = rect[2];
|
679
|
+
r[2] = rect[0];
|
820
680
|
}
|
821
|
-
}, {
|
822
|
-
key: "intersect",
|
823
|
-
value: function intersect(rect1, rect2) {
|
824
|
-
function compare(a, b) {
|
825
|
-
return a - b;
|
826
|
-
}
|
827
681
|
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
rect2 = Util.normalizeRect(rect2);
|
682
|
+
if (rect[1] > rect[3]) {
|
683
|
+
r[1] = rect[3];
|
684
|
+
r[3] = rect[1];
|
685
|
+
}
|
833
686
|
|
834
|
-
|
835
|
-
|
836
|
-
result[2] = orderedX[2];
|
837
|
-
} else {
|
838
|
-
return null;
|
839
|
-
}
|
687
|
+
return r;
|
688
|
+
}
|
840
689
|
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
return null;
|
846
|
-
}
|
690
|
+
static intersect(rect1, rect2) {
|
691
|
+
function compare(a, b) {
|
692
|
+
return a - b;
|
693
|
+
}
|
847
694
|
|
848
|
-
|
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 = [];
|
698
|
+
rect1 = Util.normalizeRect(rect1);
|
699
|
+
rect2 = Util.normalizeRect(rect2);
|
700
|
+
|
701
|
+
if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
|
702
|
+
result[0] = orderedX[1];
|
703
|
+
result[2] = orderedX[2];
|
704
|
+
} else {
|
705
|
+
return null;
|
849
706
|
}
|
850
|
-
}]);
|
851
707
|
|
852
|
-
|
853
|
-
|
708
|
+
if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
|
709
|
+
result[1] = orderedY[1];
|
710
|
+
result[3] = orderedY[2];
|
711
|
+
} else {
|
712
|
+
return null;
|
713
|
+
}
|
714
|
+
|
715
|
+
return result;
|
716
|
+
}
|
717
|
+
|
718
|
+
}
|
854
719
|
|
855
720
|
exports.Util = Util;
|
856
|
-
|
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];
|
857
722
|
|
858
723
|
function stringToPDFString(str) {
|
859
|
-
|
860
|
-
|
724
|
+
const length = str.length,
|
725
|
+
strBuf = [];
|
861
726
|
|
862
|
-
if (str[0] ===
|
863
|
-
for (
|
727
|
+
if (str[0] === "\xFE" && str[1] === "\xFF") {
|
728
|
+
for (let i = 2; i < length; i += 2) {
|
864
729
|
strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
|
865
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
|
+
}
|
866
735
|
} else {
|
867
|
-
for (
|
868
|
-
|
869
|
-
strBuf.push(code ? String.fromCharCode(code) : str.charAt(
|
736
|
+
for (let i = 0; i < length; ++i) {
|
737
|
+
const code = PDFStringTranslateTable[str.charCodeAt(i)];
|
738
|
+
strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
|
870
739
|
}
|
871
740
|
}
|
872
741
|
|
873
|
-
return strBuf.join(
|
742
|
+
return strBuf.join("");
|
874
743
|
}
|
875
744
|
|
876
745
|
function stringToUTF8String(str) {
|
@@ -882,7 +751,7 @@ function utf8StringToString(str) {
|
|
882
751
|
}
|
883
752
|
|
884
753
|
function isEmptyObj(obj) {
|
885
|
-
for (
|
754
|
+
for (const key in obj) {
|
886
755
|
return false;
|
887
756
|
}
|
888
757
|
|
@@ -890,19 +759,19 @@ function isEmptyObj(obj) {
|
|
890
759
|
}
|
891
760
|
|
892
761
|
function isBool(v) {
|
893
|
-
return typeof v ===
|
762
|
+
return typeof v === "boolean";
|
894
763
|
}
|
895
764
|
|
896
765
|
function isNum(v) {
|
897
|
-
return typeof v ===
|
766
|
+
return typeof v === "number";
|
898
767
|
}
|
899
768
|
|
900
769
|
function isString(v) {
|
901
|
-
return typeof v ===
|
770
|
+
return typeof v === "string";
|
902
771
|
}
|
903
772
|
|
904
773
|
function isArrayBuffer(v) {
|
905
|
-
return
|
774
|
+
return typeof v === "object" && v !== null && v.byteLength !== undefined;
|
906
775
|
}
|
907
776
|
|
908
777
|
function isArrayEqual(arr1, arr2) {
|
@@ -915,17 +784,14 @@ function isArrayEqual(arr1, arr2) {
|
|
915
784
|
});
|
916
785
|
}
|
917
786
|
|
918
|
-
function isSpace(ch) {
|
919
|
-
return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A;
|
920
|
-
}
|
921
|
-
|
922
787
|
function createPromiseCapability() {
|
923
|
-
|
924
|
-
|
925
|
-
Object.defineProperty(capability,
|
926
|
-
get
|
788
|
+
const capability = Object.create(null);
|
789
|
+
let isSettled = false;
|
790
|
+
Object.defineProperty(capability, "settled", {
|
791
|
+
get() {
|
927
792
|
return isSettled;
|
928
793
|
}
|
794
|
+
|
929
795
|
});
|
930
796
|
capability.promise = new Promise(function (resolve, reject) {
|
931
797
|
capability.resolve = function (data) {
|
@@ -941,28 +807,26 @@ function createPromiseCapability() {
|
|
941
807
|
return capability;
|
942
808
|
}
|
943
809
|
|
944
|
-
|
945
|
-
|
946
|
-
return function createObjectURL(data, contentType) {
|
947
|
-
var forceDataSchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
948
|
-
|
810
|
+
const createObjectURL = function createObjectURLClosure() {
|
811
|
+
const digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
812
|
+
return function createObjectURL(data, contentType, forceDataSchema = false) {
|
949
813
|
if (!forceDataSchema && URL.createObjectURL) {
|
950
|
-
|
814
|
+
const blob = new Blob([data], {
|
951
815
|
type: contentType
|
952
816
|
});
|
953
817
|
return URL.createObjectURL(blob);
|
954
818
|
}
|
955
819
|
|
956
|
-
|
820
|
+
let buffer = `data:${contentType};base64,`;
|
957
821
|
|
958
|
-
for (
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
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;
|
966
830
|
buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
|
967
831
|
}
|
968
832
|
|