pdfjs-dist 2.0.487 → 2.1.266
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/bower.json +1 -1
- package/build/pdf.js +15564 -9476
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +1 -1
- package/build/pdf.worker.js +46644 -36309
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +1 -1
- package/external/url/url-lib.js +627 -0
- package/image_decoders/pdf.image_decoders.js +11430 -0
- package/image_decoders/pdf.image_decoders.js.map +1 -0
- package/image_decoders/pdf.image_decoders.min.js +1 -0
- package/lib/core/annotation.js +406 -131
- package/lib/core/arithmetic_decoder.js +275 -245
- package/lib/core/bidi.js +65 -6
- package/lib/core/ccitt.js +173 -18
- package/lib/core/ccitt_stream.js +15 -6
- package/lib/core/cff_parser.js +376 -53
- package/lib/core/charsets.js +5 -4
- package/lib/core/chunked_stream.js +387 -149
- package/lib/core/cmap.js +310 -75
- package/lib/core/colorspace.js +874 -594
- package/lib/core/crypto.js +290 -45
- package/lib/core/document.js +545 -260
- package/lib/core/encodings.js +19 -10
- package/lib/core/evaluator.js +725 -147
- package/lib/core/font_renderer.js +360 -91
- package/lib/core/fonts.js +791 -186
- package/lib/core/function.js +284 -71
- package/lib/core/glyphlist.js +3 -2
- package/lib/core/image.js +168 -61
- package/lib/core/jbig2.js +479 -66
- package/lib/core/jbig2_stream.js +19 -8
- package/lib/core/jpeg_stream.js +38 -13
- package/lib/core/jpg.js +252 -29
- package/lib/core/jpx.js +396 -6
- package/lib/core/jpx_stream.js +18 -6
- package/lib/core/metrics.js +4 -4
- package/lib/core/murmurhash3.js +24 -6
- package/lib/core/obj.js +1137 -475
- package/lib/core/operator_list.js +108 -6
- package/lib/core/parser.js +321 -68
- package/lib/core/pattern.js +145 -13
- package/lib/core/pdf_manager.js +321 -133
- package/lib/core/primitives.js +75 -22
- package/lib/core/ps_parser.js +134 -45
- package/lib/core/standard_fonts.js +10 -10
- package/lib/core/stream.js +313 -34
- package/lib/core/type1_parser.js +143 -13
- package/lib/core/unicode.js +31 -4
- package/lib/core/worker.js +210 -66
- package/lib/display/annotation_layer.js +361 -123
- package/lib/display/api.js +1454 -729
- package/lib/display/api_compatibility.js +11 -13
- package/lib/display/canvas.js +324 -29
- package/lib/display/content_disposition.js +83 -32
- package/lib/display/dom_utils.js +226 -41
- package/lib/display/fetch_stream.js +208 -84
- package/lib/display/font_loader.js +465 -236
- package/lib/display/metadata.js +38 -16
- package/lib/display/network.js +216 -51
- package/lib/display/network_utils.js +32 -19
- package/lib/display/node_stream.js +352 -169
- package/lib/display/pattern_helper.js +58 -7
- package/lib/display/svg.js +242 -29
- package/lib/display/text_layer.js +132 -18
- package/lib/display/transport_stream.js +171 -42
- package/lib/display/webgl.js +64 -18
- package/lib/display/worker_options.js +5 -4
- package/lib/display/xml_parser.js +166 -53
- package/lib/examples/node/domstubs.js +57 -4
- package/lib/pdf.js +21 -4
- package/lib/pdf.worker.js +5 -3
- package/lib/shared/compatibility.js +158 -564
- package/lib/shared/global_scope.js +2 -2
- package/lib/shared/is_node.js +4 -4
- package/lib/shared/message_handler.js +521 -0
- package/lib/shared/streams_polyfill.js +21 -17
- package/lib/shared/url_polyfill.js +56 -0
- package/lib/shared/util.js +295 -650
- package/lib/test/unit/annotation_spec.js +629 -345
- package/lib/test/unit/api_spec.js +555 -253
- package/lib/test/unit/bidi_spec.js +7 -7
- package/lib/test/unit/cff_parser_spec.js +40 -11
- package/lib/test/unit/clitests_helper.js +9 -7
- package/lib/test/unit/cmap_spec.js +80 -26
- package/lib/test/unit/colorspace_spec.js +99 -52
- package/lib/test/unit/crypto_spec.js +17 -5
- package/lib/test/unit/custom_spec.js +41 -53
- package/lib/test/unit/display_svg_spec.js +33 -17
- package/lib/test/unit/document_spec.js +3 -3
- package/lib/test/unit/dom_utils_spec.js +9 -9
- package/lib/test/unit/encodings_spec.js +25 -45
- package/lib/test/unit/evaluator_spec.js +34 -9
- package/lib/test/unit/function_spec.js +17 -5
- package/lib/test/unit/jasmine-boot.js +31 -18
- package/lib/test/unit/{util_stream_spec.js → message_handler_spec.js} +41 -69
- package/lib/test/unit/metadata_spec.js +71 -11
- package/lib/test/unit/murmurhash3_spec.js +3 -3
- package/lib/test/unit/network_spec.js +20 -5
- package/lib/test/unit/network_utils_spec.js +41 -14
- package/lib/test/unit/node_stream_spec.js +51 -27
- package/lib/test/unit/parser_spec.js +35 -8
- package/lib/test/unit/pdf_find_controller_spec.js +230 -0
- package/lib/test/unit/pdf_find_utils_spec.js +63 -0
- package/lib/test/unit/pdf_history_spec.js +21 -9
- package/lib/test/unit/primitives_spec.js +24 -4
- package/lib/test/unit/stream_spec.js +12 -4
- package/lib/test/unit/test_utils.js +90 -27
- package/lib/test/unit/testreporter.js +21 -3
- package/lib/test/unit/type1_parser_spec.js +8 -6
- package/lib/test/unit/ui_utils_spec.js +452 -14
- package/lib/test/unit/unicode_spec.js +14 -11
- package/lib/test/unit/util_spec.js +131 -9
- package/lib/web/annotation_layer_builder.js +39 -22
- package/lib/web/app.js +1240 -582
- package/lib/web/app_options.js +71 -41
- package/lib/web/base_viewer.js +508 -179
- package/lib/web/chromecom.js +261 -117
- package/lib/web/debugger.js +166 -22
- package/lib/web/download_manager.js +31 -13
- package/lib/web/firefox_print_service.js +17 -9
- package/lib/web/firefoxcom.js +283 -79
- package/lib/web/genericcom.js +89 -30
- package/lib/web/genericl10n.js +142 -30
- package/lib/web/grab_to_pan.js +26 -4
- package/lib/web/interfaces.js +170 -47
- package/lib/web/overlay_manager.js +235 -85
- package/lib/web/password_prompt.js +21 -13
- package/lib/web/pdf_attachment_viewer.js +38 -18
- package/lib/web/pdf_cursor_tools.js +39 -16
- package/lib/web/pdf_document_properties.js +80 -30
- package/lib/web/pdf_find_bar.js +84 -40
- package/lib/web/pdf_find_controller.js +495 -184
- package/lib/web/pdf_find_utils.js +111 -0
- package/lib/web/pdf_history.js +190 -53
- package/lib/web/pdf_link_service.js +137 -76
- package/lib/web/pdf_outline_viewer.js +73 -22
- package/lib/web/pdf_page_view.js +196 -63
- package/lib/web/pdf_presentation_mode.js +99 -34
- package/lib/web/pdf_print_service.js +57 -11
- package/lib/web/pdf_rendering_queue.js +27 -5
- package/lib/web/pdf_sidebar.js +120 -67
- package/lib/web/pdf_sidebar_resizer.js +42 -16
- package/lib/web/pdf_single_page_viewer.js +74 -66
- package/lib/web/pdf_thumbnail_view.js +103 -32
- package/lib/web/pdf_thumbnail_viewer.js +64 -24
- package/lib/web/pdf_viewer.component.js +112 -32
- package/lib/web/pdf_viewer.js +91 -52
- package/lib/web/preferences.js +275 -80
- package/lib/web/secondary_toolbar.js +165 -40
- package/lib/web/text_layer_builder.js +162 -65
- package/lib/web/toolbar.js +78 -43
- package/lib/web/ui_utils.js +462 -136
- package/lib/web/view_history.js +215 -67
- package/lib/web/viewer_compatibility.js +4 -13
- package/package.json +5 -4
- package/web/pdf_viewer.css +58 -1
- package/web/pdf_viewer.js +6346 -3919
- package/web/pdf_viewer.js.map +1 -1
- package/lib/test/unit/fonts_spec.js +0 -81
- package/lib/web/dom_events.js +0 -137
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 2018 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,25 +19,89 @@
|
|
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.
|
27
|
+
exports.toRomanNumerals = toRomanNumerals;
|
28
|
+
exports.arrayByteLength = arrayByteLength;
|
29
|
+
exports.arraysToBytes = arraysToBytes;
|
30
|
+
exports.assert = assert;
|
31
|
+
exports.bytesToString = bytesToString;
|
32
|
+
exports.createPromiseCapability = createPromiseCapability;
|
33
|
+
exports.deprecated = deprecated;
|
34
|
+
exports.getInheritableProperty = getInheritableProperty;
|
35
|
+
exports.getLookupTableFactory = getLookupTableFactory;
|
36
|
+
exports.getVerbosityLevel = getVerbosityLevel;
|
37
|
+
exports.info = info;
|
38
|
+
exports.isArrayBuffer = isArrayBuffer;
|
39
|
+
exports.isBool = isBool;
|
40
|
+
exports.isEmptyObj = isEmptyObj;
|
41
|
+
exports.isNum = isNum;
|
42
|
+
exports.isString = isString;
|
43
|
+
exports.isSpace = isSpace;
|
44
|
+
exports.isSameOrigin = isSameOrigin;
|
45
|
+
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
|
+
exports.removeNullCharacters = removeNullCharacters;
|
53
|
+
exports.setVerbosityLevel = setVerbosityLevel;
|
54
|
+
exports.shadow = shadow;
|
55
|
+
exports.string32 = string32;
|
56
|
+
exports.stringToBytes = stringToBytes;
|
57
|
+
exports.stringToPDFString = stringToPDFString;
|
58
|
+
exports.stringToUTF8String = stringToUTF8String;
|
59
|
+
exports.utf8StringToString = utf8StringToString;
|
60
|
+
exports.warn = warn;
|
61
|
+
exports.unreachable = unreachable;
|
62
|
+
Object.defineProperty(exports, "ReadableStream", {
|
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;
|
75
|
+
|
76
|
+
require("./compatibility");
|
28
77
|
|
29
|
-
var
|
78
|
+
var _streams_polyfill = require("./streams_polyfill");
|
30
79
|
|
31
|
-
require(
|
80
|
+
var _url_polyfill = require("./url_polyfill");
|
32
81
|
|
33
|
-
|
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); }
|
34
83
|
|
84
|
+
var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
|
85
|
+
exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
|
35
86
|
var FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
|
87
|
+
exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
|
36
88
|
var NativeImageDecoding = {
|
37
89
|
NONE: 'none',
|
38
90
|
DECODE: 'decode',
|
39
91
|
DISPLAY: 'display'
|
40
92
|
};
|
93
|
+
exports.NativeImageDecoding = NativeImageDecoding;
|
94
|
+
var PermissionFlag = {
|
95
|
+
PRINT: 0x04,
|
96
|
+
MODIFY_CONTENTS: 0x08,
|
97
|
+
COPY: 0x10,
|
98
|
+
MODIFY_ANNOTATIONS: 0x20,
|
99
|
+
FILL_INTERACTIVE_FORMS: 0x100,
|
100
|
+
COPY_FOR_ACCESSIBILITY: 0x200,
|
101
|
+
ASSEMBLE: 0x400,
|
102
|
+
PRINT_HIGH_QUALITY: 0x800
|
103
|
+
};
|
104
|
+
exports.PermissionFlag = PermissionFlag;
|
41
105
|
var TextRenderingMode = {
|
42
106
|
FILL: 0,
|
43
107
|
STROKE: 1,
|
@@ -50,11 +114,13 @@ var TextRenderingMode = {
|
|
50
114
|
FILL_STROKE_MASK: 3,
|
51
115
|
ADD_TO_PATH_FLAG: 4
|
52
116
|
};
|
117
|
+
exports.TextRenderingMode = TextRenderingMode;
|
53
118
|
var ImageKind = {
|
54
119
|
GRAYSCALE_1BPP: 1,
|
55
120
|
RGB_24BPP: 2,
|
56
121
|
RGBA_32BPP: 3
|
57
122
|
};
|
123
|
+
exports.ImageKind = ImageKind;
|
58
124
|
var AnnotationType = {
|
59
125
|
TEXT: 1,
|
60
126
|
LINK: 2,
|
@@ -83,6 +149,7 @@ var AnnotationType = {
|
|
83
149
|
THREED: 25,
|
84
150
|
REDACT: 26
|
85
151
|
};
|
152
|
+
exports.AnnotationType = AnnotationType;
|
86
153
|
var AnnotationFlag = {
|
87
154
|
INVISIBLE: 0x01,
|
88
155
|
HIDDEN: 0x02,
|
@@ -95,6 +162,7 @@ var AnnotationFlag = {
|
|
95
162
|
TOGGLENOVIEW: 0x100,
|
96
163
|
LOCKEDCONTENTS: 0x200
|
97
164
|
};
|
165
|
+
exports.AnnotationFlag = AnnotationFlag;
|
98
166
|
var AnnotationFieldFlag = {
|
99
167
|
READONLY: 0x0000001,
|
100
168
|
REQUIRED: 0x0000002,
|
@@ -116,6 +184,7 @@ var AnnotationFieldFlag = {
|
|
116
184
|
RADIOSINUNISON: 0x2000000,
|
117
185
|
COMMITONSELCHANGE: 0x4000000
|
118
186
|
};
|
187
|
+
exports.AnnotationFieldFlag = AnnotationFieldFlag;
|
119
188
|
var AnnotationBorderStyleType = {
|
120
189
|
SOLID: 1,
|
121
190
|
DASHED: 2,
|
@@ -123,6 +192,7 @@ var AnnotationBorderStyleType = {
|
|
123
192
|
INSET: 4,
|
124
193
|
UNDERLINE: 5
|
125
194
|
};
|
195
|
+
exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
|
126
196
|
var StreamType = {
|
127
197
|
UNKNOWN: 0,
|
128
198
|
FLATE: 1,
|
@@ -135,6 +205,7 @@ var StreamType = {
|
|
135
205
|
CCF: 8,
|
136
206
|
RL: 9
|
137
207
|
};
|
208
|
+
exports.StreamType = StreamType;
|
138
209
|
var FontType = {
|
139
210
|
UNKNOWN: 0,
|
140
211
|
TYPE1: 1,
|
@@ -148,16 +219,19 @@ var FontType = {
|
|
148
219
|
TYPE0: 9,
|
149
220
|
MMTYPE1: 10
|
150
221
|
};
|
222
|
+
exports.FontType = FontType;
|
151
223
|
var VerbosityLevel = {
|
152
224
|
ERRORS: 0,
|
153
225
|
WARNINGS: 1,
|
154
226
|
INFOS: 5
|
155
227
|
};
|
228
|
+
exports.VerbosityLevel = VerbosityLevel;
|
156
229
|
var CMapCompressionType = {
|
157
230
|
NONE: 0,
|
158
231
|
BINARY: 1,
|
159
232
|
STREAM: 2
|
160
233
|
};
|
234
|
+
exports.CMapCompressionType = CMapCompressionType;
|
161
235
|
var OPS = {
|
162
236
|
dependency: 1,
|
163
237
|
setLineWidth: 2,
|
@@ -251,60 +325,79 @@ var OPS = {
|
|
251
325
|
paintSolidColorImageMask: 90,
|
252
326
|
constructPath: 91
|
253
327
|
};
|
328
|
+
exports.OPS = OPS;
|
329
|
+
var UNSUPPORTED_FEATURES = {
|
330
|
+
unknown: 'unknown',
|
331
|
+
forms: 'forms',
|
332
|
+
javaScript: 'javaScript',
|
333
|
+
smask: 'smask',
|
334
|
+
shadingPattern: 'shadingPattern',
|
335
|
+
font: 'font'
|
336
|
+
};
|
337
|
+
exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
|
338
|
+
var PasswordResponses = {
|
339
|
+
NEED_PASSWORD: 1,
|
340
|
+
INCORRECT_PASSWORD: 2
|
341
|
+
};
|
342
|
+
exports.PasswordResponses = PasswordResponses;
|
254
343
|
var verbosity = VerbosityLevel.WARNINGS;
|
344
|
+
|
255
345
|
function setVerbosityLevel(level) {
|
256
346
|
if (Number.isInteger(level)) {
|
257
347
|
verbosity = level;
|
258
348
|
}
|
259
349
|
}
|
350
|
+
|
260
351
|
function getVerbosityLevel() {
|
261
352
|
return verbosity;
|
262
353
|
}
|
354
|
+
|
263
355
|
function info(msg) {
|
264
356
|
if (verbosity >= VerbosityLevel.INFOS) {
|
265
357
|
console.log('Info: ' + msg);
|
266
358
|
}
|
267
359
|
}
|
360
|
+
|
268
361
|
function warn(msg) {
|
269
362
|
if (verbosity >= VerbosityLevel.WARNINGS) {
|
270
363
|
console.log('Warning: ' + msg);
|
271
364
|
}
|
272
365
|
}
|
366
|
+
|
273
367
|
function deprecated(details) {
|
274
368
|
console.log('Deprecated API usage: ' + details);
|
275
369
|
}
|
370
|
+
|
276
371
|
function unreachable(msg) {
|
277
372
|
throw new Error(msg);
|
278
373
|
}
|
374
|
+
|
279
375
|
function assert(cond, msg) {
|
280
376
|
if (!cond) {
|
281
377
|
unreachable(msg);
|
282
378
|
}
|
283
379
|
}
|
284
|
-
|
285
|
-
unknown: 'unknown',
|
286
|
-
forms: 'forms',
|
287
|
-
javaScript: 'javaScript',
|
288
|
-
smask: 'smask',
|
289
|
-
shadingPattern: 'shadingPattern',
|
290
|
-
font: 'font'
|
291
|
-
};
|
380
|
+
|
292
381
|
function isSameOrigin(baseUrl, otherUrl) {
|
293
382
|
try {
|
294
|
-
var base = new URL(baseUrl);
|
383
|
+
var base = new _url_polyfill.URL(baseUrl);
|
384
|
+
|
295
385
|
if (!base.origin || base.origin === 'null') {
|
296
386
|
return false;
|
297
387
|
}
|
298
388
|
} catch (e) {
|
299
389
|
return false;
|
300
390
|
}
|
301
|
-
|
391
|
+
|
392
|
+
var other = new _url_polyfill.URL(otherUrl, base);
|
302
393
|
return base.origin === other.origin;
|
303
394
|
}
|
304
|
-
|
395
|
+
|
396
|
+
function _isValidProtocol(url) {
|
305
397
|
if (!url) {
|
306
398
|
return false;
|
307
399
|
}
|
400
|
+
|
308
401
|
switch (url.protocol) {
|
309
402
|
case 'http:':
|
310
403
|
case 'https:':
|
@@ -312,22 +405,28 @@ function isValidProtocol(url) {
|
|
312
405
|
case 'mailto:':
|
313
406
|
case 'tel:':
|
314
407
|
return true;
|
408
|
+
|
315
409
|
default:
|
316
410
|
return false;
|
317
411
|
}
|
318
412
|
}
|
413
|
+
|
319
414
|
function createValidAbsoluteUrl(url, baseUrl) {
|
320
415
|
if (!url) {
|
321
416
|
return null;
|
322
417
|
}
|
418
|
+
|
323
419
|
try {
|
324
|
-
var absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
|
325
|
-
|
420
|
+
var absoluteUrl = baseUrl ? new _url_polyfill.URL(url, baseUrl) : new _url_polyfill.URL(url);
|
421
|
+
|
422
|
+
if (_isValidProtocol(absoluteUrl)) {
|
326
423
|
return absoluteUrl;
|
327
424
|
}
|
328
425
|
} catch (ex) {}
|
426
|
+
|
329
427
|
return null;
|
330
428
|
}
|
429
|
+
|
331
430
|
function shadow(obj, prop, value) {
|
332
431
|
Object.defineProperty(obj, prop, {
|
333
432
|
value: value,
|
@@ -337,6 +436,7 @@ function shadow(obj, prop, value) {
|
|
337
436
|
});
|
338
437
|
return value;
|
339
438
|
}
|
439
|
+
|
340
440
|
function getLookupTableFactory(initializer) {
|
341
441
|
var lookup;
|
342
442
|
return function () {
|
@@ -345,164 +445,219 @@ function getLookupTableFactory(initializer) {
|
|
345
445
|
initializer(lookup);
|
346
446
|
initializer = null;
|
347
447
|
}
|
448
|
+
|
348
449
|
return lookup;
|
349
450
|
};
|
350
451
|
}
|
351
|
-
|
352
|
-
NEED_PASSWORD: 1,
|
353
|
-
INCORRECT_PASSWORD: 2
|
354
|
-
};
|
452
|
+
|
355
453
|
var PasswordException = function PasswordExceptionClosure() {
|
356
454
|
function PasswordException(msg, code) {
|
357
455
|
this.name = 'PasswordException';
|
358
456
|
this.message = msg;
|
359
457
|
this.code = code;
|
360
458
|
}
|
459
|
+
|
361
460
|
PasswordException.prototype = new Error();
|
362
461
|
PasswordException.constructor = PasswordException;
|
363
462
|
return PasswordException;
|
364
463
|
}();
|
464
|
+
|
465
|
+
exports.PasswordException = PasswordException;
|
466
|
+
|
365
467
|
var UnknownErrorException = function UnknownErrorExceptionClosure() {
|
366
468
|
function UnknownErrorException(msg, details) {
|
367
469
|
this.name = 'UnknownErrorException';
|
368
470
|
this.message = msg;
|
369
471
|
this.details = details;
|
370
472
|
}
|
473
|
+
|
371
474
|
UnknownErrorException.prototype = new Error();
|
372
475
|
UnknownErrorException.constructor = UnknownErrorException;
|
373
476
|
return UnknownErrorException;
|
374
477
|
}();
|
478
|
+
|
479
|
+
exports.UnknownErrorException = UnknownErrorException;
|
480
|
+
|
375
481
|
var InvalidPDFException = function InvalidPDFExceptionClosure() {
|
376
482
|
function InvalidPDFException(msg) {
|
377
483
|
this.name = 'InvalidPDFException';
|
378
484
|
this.message = msg;
|
379
485
|
}
|
486
|
+
|
380
487
|
InvalidPDFException.prototype = new Error();
|
381
488
|
InvalidPDFException.constructor = InvalidPDFException;
|
382
489
|
return InvalidPDFException;
|
383
490
|
}();
|
491
|
+
|
492
|
+
exports.InvalidPDFException = InvalidPDFException;
|
493
|
+
|
384
494
|
var MissingPDFException = function MissingPDFExceptionClosure() {
|
385
495
|
function MissingPDFException(msg) {
|
386
496
|
this.name = 'MissingPDFException';
|
387
497
|
this.message = msg;
|
388
498
|
}
|
499
|
+
|
389
500
|
MissingPDFException.prototype = new Error();
|
390
501
|
MissingPDFException.constructor = MissingPDFException;
|
391
502
|
return MissingPDFException;
|
392
503
|
}();
|
504
|
+
|
505
|
+
exports.MissingPDFException = MissingPDFException;
|
506
|
+
|
393
507
|
var UnexpectedResponseException = function UnexpectedResponseExceptionClosure() {
|
394
508
|
function UnexpectedResponseException(msg, status) {
|
395
509
|
this.name = 'UnexpectedResponseException';
|
396
510
|
this.message = msg;
|
397
511
|
this.status = status;
|
398
512
|
}
|
513
|
+
|
399
514
|
UnexpectedResponseException.prototype = new Error();
|
400
515
|
UnexpectedResponseException.constructor = UnexpectedResponseException;
|
401
516
|
return UnexpectedResponseException;
|
402
517
|
}();
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
}
|
407
|
-
NotImplementedException.prototype = new Error();
|
408
|
-
NotImplementedException.prototype.name = 'NotImplementedException';
|
409
|
-
NotImplementedException.constructor = NotImplementedException;
|
410
|
-
return NotImplementedException;
|
411
|
-
}();
|
518
|
+
|
519
|
+
exports.UnexpectedResponseException = UnexpectedResponseException;
|
520
|
+
|
412
521
|
var MissingDataException = function MissingDataExceptionClosure() {
|
413
522
|
function MissingDataException(begin, end) {
|
414
523
|
this.begin = begin;
|
415
524
|
this.end = end;
|
416
525
|
this.message = 'Missing data [' + begin + ', ' + end + ')';
|
417
526
|
}
|
527
|
+
|
418
528
|
MissingDataException.prototype = new Error();
|
419
529
|
MissingDataException.prototype.name = 'MissingDataException';
|
420
530
|
MissingDataException.constructor = MissingDataException;
|
421
531
|
return MissingDataException;
|
422
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
|
+
|
423
549
|
var XRefParseException = function XRefParseExceptionClosure() {
|
424
550
|
function XRefParseException(msg) {
|
425
551
|
this.message = msg;
|
426
552
|
}
|
553
|
+
|
427
554
|
XRefParseException.prototype = new Error();
|
428
555
|
XRefParseException.prototype.name = 'XRefParseException';
|
429
556
|
XRefParseException.constructor = XRefParseException;
|
430
557
|
return XRefParseException;
|
431
558
|
}();
|
559
|
+
|
560
|
+
exports.XRefParseException = XRefParseException;
|
561
|
+
|
432
562
|
var FormatError = function FormatErrorClosure() {
|
433
563
|
function FormatError(msg) {
|
434
564
|
this.message = msg;
|
435
565
|
}
|
566
|
+
|
436
567
|
FormatError.prototype = new Error();
|
437
568
|
FormatError.prototype.name = 'FormatError';
|
438
569
|
FormatError.constructor = FormatError;
|
439
570
|
return FormatError;
|
440
571
|
}();
|
572
|
+
|
573
|
+
exports.FormatError = FormatError;
|
574
|
+
|
441
575
|
var AbortException = function AbortExceptionClosure() {
|
442
576
|
function AbortException(msg) {
|
443
577
|
this.name = 'AbortException';
|
444
578
|
this.message = msg;
|
445
579
|
}
|
580
|
+
|
446
581
|
AbortException.prototype = new Error();
|
447
582
|
AbortException.constructor = AbortException;
|
448
583
|
return AbortException;
|
449
584
|
}();
|
585
|
+
|
586
|
+
exports.AbortException = AbortException;
|
450
587
|
var NullCharactersRegExp = /\x00/g;
|
588
|
+
|
451
589
|
function removeNullCharacters(str) {
|
452
590
|
if (typeof str !== 'string') {
|
453
591
|
warn('The argument for removeNullCharacters must be a string.');
|
454
592
|
return str;
|
455
593
|
}
|
594
|
+
|
456
595
|
return str.replace(NullCharactersRegExp, '');
|
457
596
|
}
|
597
|
+
|
458
598
|
function bytesToString(bytes) {
|
459
|
-
assert(bytes !== null &&
|
599
|
+
assert(bytes !== null && _typeof(bytes) === 'object' && bytes.length !== undefined, 'Invalid argument for bytesToString');
|
460
600
|
var length = bytes.length;
|
461
601
|
var MAX_ARGUMENT_COUNT = 8192;
|
602
|
+
|
462
603
|
if (length < MAX_ARGUMENT_COUNT) {
|
463
604
|
return String.fromCharCode.apply(null, bytes);
|
464
605
|
}
|
606
|
+
|
465
607
|
var strBuf = [];
|
608
|
+
|
466
609
|
for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
|
467
610
|
var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
|
468
611
|
var chunk = bytes.subarray(i, chunkEnd);
|
469
612
|
strBuf.push(String.fromCharCode.apply(null, chunk));
|
470
613
|
}
|
614
|
+
|
471
615
|
return strBuf.join('');
|
472
616
|
}
|
617
|
+
|
473
618
|
function stringToBytes(str) {
|
474
619
|
assert(typeof str === 'string', 'Invalid argument for stringToBytes');
|
475
620
|
var length = str.length;
|
476
621
|
var bytes = new Uint8Array(length);
|
622
|
+
|
477
623
|
for (var i = 0; i < length; ++i) {
|
478
624
|
bytes[i] = str.charCodeAt(i) & 0xFF;
|
479
625
|
}
|
626
|
+
|
480
627
|
return bytes;
|
481
628
|
}
|
629
|
+
|
482
630
|
function arrayByteLength(arr) {
|
483
631
|
if (arr.length !== undefined) {
|
484
632
|
return arr.length;
|
485
633
|
}
|
634
|
+
|
486
635
|
assert(arr.byteLength !== undefined);
|
487
636
|
return arr.byteLength;
|
488
637
|
}
|
638
|
+
|
489
639
|
function arraysToBytes(arr) {
|
490
640
|
if (arr.length === 1 && arr[0] instanceof Uint8Array) {
|
491
641
|
return arr[0];
|
492
642
|
}
|
643
|
+
|
493
644
|
var resultLength = 0;
|
494
645
|
var i,
|
495
646
|
ii = arr.length;
|
496
647
|
var item, itemLength;
|
648
|
+
|
497
649
|
for (i = 0; i < ii; i++) {
|
498
650
|
item = arr[i];
|
499
651
|
itemLength = arrayByteLength(item);
|
500
652
|
resultLength += itemLength;
|
501
653
|
}
|
654
|
+
|
502
655
|
var pos = 0;
|
503
656
|
var data = new Uint8Array(resultLength);
|
657
|
+
|
504
658
|
for (i = 0; i < ii; i++) {
|
505
659
|
item = arr[i];
|
660
|
+
|
506
661
|
if (!(item instanceof Uint8Array)) {
|
507
662
|
if (typeof item === 'string') {
|
508
663
|
item = stringToBytes(item);
|
@@ -510,36 +665,46 @@ function arraysToBytes(arr) {
|
|
510
665
|
item = new Uint8Array(item);
|
511
666
|
}
|
512
667
|
}
|
668
|
+
|
513
669
|
itemLength = item.byteLength;
|
514
670
|
data.set(item, pos);
|
515
671
|
pos += itemLength;
|
516
672
|
}
|
673
|
+
|
517
674
|
return data;
|
518
675
|
}
|
676
|
+
|
519
677
|
function string32(value) {
|
520
678
|
return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
|
521
679
|
}
|
680
|
+
|
522
681
|
function log2(x) {
|
523
682
|
if (x <= 0) {
|
524
683
|
return 0;
|
525
684
|
}
|
685
|
+
|
526
686
|
return Math.ceil(Math.log2(x));
|
527
687
|
}
|
688
|
+
|
528
689
|
function readInt8(data, start) {
|
529
690
|
return data[start] << 24 >> 24;
|
530
691
|
}
|
692
|
+
|
531
693
|
function readUint16(data, offset) {
|
532
694
|
return data[offset] << 8 | data[offset + 1];
|
533
695
|
}
|
696
|
+
|
534
697
|
function readUint32(data, offset) {
|
535
698
|
return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
|
536
699
|
}
|
700
|
+
|
537
701
|
function isLittleEndian() {
|
538
702
|
var buffer8 = new Uint8Array(4);
|
539
703
|
buffer8[0] = 1;
|
540
704
|
var view32 = new Uint32Array(buffer8.buffer, 0, 1);
|
541
705
|
return view32[0] === 1;
|
542
706
|
}
|
707
|
+
|
543
708
|
function isEvalSupported() {
|
544
709
|
try {
|
545
710
|
new Function('');
|
@@ -548,60 +713,73 @@ function isEvalSupported() {
|
|
548
713
|
return false;
|
549
714
|
}
|
550
715
|
}
|
716
|
+
|
551
717
|
function getInheritableProperty(_ref) {
|
552
718
|
var dict = _ref.dict,
|
553
719
|
key = _ref.key,
|
554
720
|
_ref$getArray = _ref.getArray,
|
555
|
-
getArray = _ref$getArray ===
|
721
|
+
getArray = _ref$getArray === void 0 ? false : _ref$getArray,
|
556
722
|
_ref$stopWhenFound = _ref.stopWhenFound,
|
557
|
-
stopWhenFound = _ref$stopWhenFound ===
|
558
|
-
|
723
|
+
stopWhenFound = _ref$stopWhenFound === void 0 ? true : _ref$stopWhenFound;
|
559
724
|
var LOOP_LIMIT = 100;
|
560
725
|
var loopCount = 0;
|
561
|
-
var values
|
726
|
+
var values;
|
727
|
+
|
562
728
|
while (dict) {
|
563
729
|
var value = getArray ? dict.getArray(key) : dict.get(key);
|
730
|
+
|
564
731
|
if (value !== undefined) {
|
565
732
|
if (stopWhenFound) {
|
566
733
|
return value;
|
567
734
|
}
|
735
|
+
|
568
736
|
if (!values) {
|
569
737
|
values = [];
|
570
738
|
}
|
739
|
+
|
571
740
|
values.push(value);
|
572
741
|
}
|
742
|
+
|
573
743
|
if (++loopCount > LOOP_LIMIT) {
|
574
|
-
warn(
|
744
|
+
warn("getInheritableProperty: maximum loop count exceeded for \"".concat(key, "\""));
|
575
745
|
break;
|
576
746
|
}
|
747
|
+
|
577
748
|
dict = dict.get('Parent');
|
578
749
|
}
|
750
|
+
|
579
751
|
return values;
|
580
752
|
}
|
581
|
-
|
753
|
+
|
582
754
|
var Util = function UtilClosure() {
|
583
755
|
function Util() {}
|
756
|
+
|
584
757
|
var rgbBuf = ['rgb(', 0, ',', 0, ',', 0, ')'];
|
758
|
+
|
585
759
|
Util.makeCssRgb = function Util_makeCssRgb(r, g, b) {
|
586
760
|
rgbBuf[1] = r;
|
587
761
|
rgbBuf[3] = g;
|
588
762
|
rgbBuf[5] = b;
|
589
763
|
return rgbBuf.join('');
|
590
764
|
};
|
765
|
+
|
591
766
|
Util.transform = function Util_transform(m1, m2) {
|
592
767
|
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]];
|
593
768
|
};
|
769
|
+
|
594
770
|
Util.applyTransform = function Util_applyTransform(p, m) {
|
595
771
|
var xt = p[0] * m[0] + p[1] * m[2] + m[4];
|
596
772
|
var yt = p[0] * m[1] + p[1] * m[3] + m[5];
|
597
773
|
return [xt, yt];
|
598
774
|
};
|
775
|
+
|
599
776
|
Util.applyInverseTransform = function Util_applyInverseTransform(p, m) {
|
600
777
|
var d = m[0] * m[3] - m[1] * m[2];
|
601
778
|
var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
|
602
779
|
var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
|
603
780
|
return [xt, yt];
|
604
781
|
};
|
782
|
+
|
605
783
|
Util.getAxialAlignedBoundingBox = function Util_getAxialAlignedBoundingBox(r, m) {
|
606
784
|
var p1 = Util.applyTransform(r, m);
|
607
785
|
var p2 = Util.applyTransform(r.slice(2, 4), m);
|
@@ -609,13 +787,16 @@ var Util = function UtilClosure() {
|
|
609
787
|
var p4 = Util.applyTransform([r[2], r[1]], m);
|
610
788
|
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])];
|
611
789
|
};
|
790
|
+
|
612
791
|
Util.inverseTransform = function Util_inverseTransform(m) {
|
613
792
|
var d = m[0] * m[3] - m[1] * m[2];
|
614
793
|
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];
|
615
794
|
};
|
795
|
+
|
616
796
|
Util.apply3dTransform = function Util_apply3dTransform(m, v) {
|
617
797
|
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]];
|
618
798
|
};
|
799
|
+
|
619
800
|
Util.singularValueDecompose2dScale = function Util_singularValueDecompose2dScale(m) {
|
620
801
|
var transpose = [m[0], m[2], m[1], m[3]];
|
621
802
|
var a = m[0] * transpose[0] + m[1] * transpose[2];
|
@@ -628,180 +809,86 @@ var Util = function UtilClosure() {
|
|
628
809
|
var sy = first - second || 1;
|
629
810
|
return [Math.sqrt(sx), Math.sqrt(sy)];
|
630
811
|
};
|
812
|
+
|
631
813
|
Util.normalizeRect = function Util_normalizeRect(rect) {
|
632
814
|
var r = rect.slice(0);
|
815
|
+
|
633
816
|
if (rect[0] > rect[2]) {
|
634
817
|
r[0] = rect[2];
|
635
818
|
r[2] = rect[0];
|
636
819
|
}
|
820
|
+
|
637
821
|
if (rect[1] > rect[3]) {
|
638
822
|
r[1] = rect[3];
|
639
823
|
r[3] = rect[1];
|
640
824
|
}
|
825
|
+
|
641
826
|
return r;
|
642
827
|
};
|
828
|
+
|
643
829
|
Util.intersect = function Util_intersect(rect1, rect2) {
|
644
830
|
function compare(a, b) {
|
645
831
|
return a - b;
|
646
832
|
}
|
833
|
+
|
647
834
|
var orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare),
|
648
835
|
orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare),
|
649
836
|
result = [];
|
650
837
|
rect1 = Util.normalizeRect(rect1);
|
651
838
|
rect2 = Util.normalizeRect(rect2);
|
839
|
+
|
652
840
|
if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
|
653
841
|
result[0] = orderedX[1];
|
654
842
|
result[2] = orderedX[2];
|
655
843
|
} else {
|
656
844
|
return false;
|
657
845
|
}
|
846
|
+
|
658
847
|
if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
|
659
848
|
result[1] = orderedY[1];
|
660
849
|
result[3] = orderedY[2];
|
661
850
|
} else {
|
662
851
|
return false;
|
663
852
|
}
|
853
|
+
|
664
854
|
return result;
|
665
855
|
};
|
666
|
-
|
667
|
-
Util.toRoman = function Util_toRoman(number, lowerCase) {
|
668
|
-
assert(Number.isInteger(number) && number > 0, 'The number should be a positive integer.');
|
669
|
-
var pos,
|
670
|
-
romanBuf = [];
|
671
|
-
while (number >= 1000) {
|
672
|
-
number -= 1000;
|
673
|
-
romanBuf.push('M');
|
674
|
-
}
|
675
|
-
pos = number / 100 | 0;
|
676
|
-
number %= 100;
|
677
|
-
romanBuf.push(ROMAN_NUMBER_MAP[pos]);
|
678
|
-
pos = number / 10 | 0;
|
679
|
-
number %= 10;
|
680
|
-
romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
|
681
|
-
romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
|
682
|
-
var romanStr = romanBuf.join('');
|
683
|
-
return lowerCase ? romanStr.toLowerCase() : romanStr;
|
684
|
-
};
|
685
|
-
Util.appendToArray = function Util_appendToArray(arr1, arr2) {
|
686
|
-
Array.prototype.push.apply(arr1, arr2);
|
687
|
-
};
|
688
|
-
Util.prependToArray = function Util_prependToArray(arr1, arr2) {
|
689
|
-
Array.prototype.unshift.apply(arr1, arr2);
|
690
|
-
};
|
691
|
-
Util.extendObj = function extendObj(obj1, obj2) {
|
692
|
-
for (var key in obj2) {
|
693
|
-
obj1[key] = obj2[key];
|
694
|
-
}
|
695
|
-
};
|
696
|
-
Util.inherit = function Util_inherit(sub, base, prototype) {
|
697
|
-
sub.prototype = Object.create(base.prototype);
|
698
|
-
sub.prototype.constructor = sub;
|
699
|
-
for (var prop in prototype) {
|
700
|
-
sub.prototype[prop] = prototype[prop];
|
701
|
-
}
|
702
|
-
};
|
703
|
-
Util.loadScript = function Util_loadScript(src, callback) {
|
704
|
-
var script = document.createElement('script');
|
705
|
-
var loaded = false;
|
706
|
-
script.setAttribute('src', src);
|
707
|
-
if (callback) {
|
708
|
-
script.onload = function () {
|
709
|
-
if (!loaded) {
|
710
|
-
callback();
|
711
|
-
}
|
712
|
-
loaded = true;
|
713
|
-
};
|
714
|
-
}
|
715
|
-
document.getElementsByTagName('head')[0].appendChild(script);
|
716
|
-
};
|
856
|
+
|
717
857
|
return Util;
|
718
858
|
}();
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
case 180:
|
733
|
-
rotateA = -1;
|
734
|
-
rotateB = 0;
|
735
|
-
rotateC = 0;
|
736
|
-
rotateD = 1;
|
737
|
-
break;
|
738
|
-
case 90:
|
739
|
-
rotateA = 0;
|
740
|
-
rotateB = 1;
|
741
|
-
rotateC = 1;
|
742
|
-
rotateD = 0;
|
743
|
-
break;
|
744
|
-
case 270:
|
745
|
-
rotateA = 0;
|
746
|
-
rotateB = -1;
|
747
|
-
rotateC = -1;
|
748
|
-
rotateD = 0;
|
749
|
-
break;
|
750
|
-
default:
|
751
|
-
rotateA = 1;
|
752
|
-
rotateB = 0;
|
753
|
-
rotateC = 0;
|
754
|
-
rotateD = -1;
|
755
|
-
break;
|
756
|
-
}
|
757
|
-
if (dontFlip) {
|
758
|
-
rotateC = -rotateC;
|
759
|
-
rotateD = -rotateD;
|
760
|
-
}
|
761
|
-
var offsetCanvasX, offsetCanvasY;
|
762
|
-
var width, height;
|
763
|
-
if (rotateA === 0) {
|
764
|
-
offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX;
|
765
|
-
offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY;
|
766
|
-
width = Math.abs(viewBox[3] - viewBox[1]) * scale;
|
767
|
-
height = Math.abs(viewBox[2] - viewBox[0]) * scale;
|
768
|
-
} else {
|
769
|
-
offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX;
|
770
|
-
offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY;
|
771
|
-
width = Math.abs(viewBox[2] - viewBox[0]) * scale;
|
772
|
-
height = Math.abs(viewBox[3] - viewBox[1]) * scale;
|
773
|
-
}
|
774
|
-
this.transform = [rotateA * scale, rotateB * scale, rotateC * scale, rotateD * scale, offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY, offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY];
|
775
|
-
this.width = width;
|
776
|
-
this.height = height;
|
777
|
-
this.fontScale = scale;
|
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');
|
778
872
|
}
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
var br = Util.applyTransform([rect[2], rect[3]], this.transform);
|
792
|
-
return [tl[0], tl[1], br[0], br[1]];
|
793
|
-
},
|
794
|
-
convertToPdfPoint: function PageViewport_convertToPdfPoint(x, y) {
|
795
|
-
return Util.applyInverseTransform([x, y], this.transform);
|
796
|
-
}
|
797
|
-
};
|
798
|
-
return PageViewport;
|
799
|
-
}();
|
873
|
+
|
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
|
+
}
|
884
|
+
|
800
885
|
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];
|
886
|
+
|
801
887
|
function stringToPDFString(str) {
|
802
888
|
var i,
|
803
889
|
n = str.length,
|
804
890
|
strBuf = [];
|
891
|
+
|
805
892
|
if (str[0] === '\xFE' && str[1] === '\xFF') {
|
806
893
|
for (i = 2; i < n; i += 2) {
|
807
894
|
strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
|
@@ -812,59 +899,82 @@ function stringToPDFString(str) {
|
|
812
899
|
strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
|
813
900
|
}
|
814
901
|
}
|
902
|
+
|
815
903
|
return strBuf.join('');
|
816
904
|
}
|
905
|
+
|
817
906
|
function stringToUTF8String(str) {
|
818
907
|
return decodeURIComponent(escape(str));
|
819
908
|
}
|
909
|
+
|
820
910
|
function utf8StringToString(str) {
|
821
911
|
return unescape(encodeURIComponent(str));
|
822
912
|
}
|
913
|
+
|
823
914
|
function isEmptyObj(obj) {
|
824
915
|
for (var key in obj) {
|
825
916
|
return false;
|
826
917
|
}
|
918
|
+
|
827
919
|
return true;
|
828
920
|
}
|
921
|
+
|
829
922
|
function isBool(v) {
|
830
923
|
return typeof v === 'boolean';
|
831
924
|
}
|
925
|
+
|
832
926
|
function isNum(v) {
|
833
927
|
return typeof v === 'number';
|
834
928
|
}
|
929
|
+
|
835
930
|
function isString(v) {
|
836
931
|
return typeof v === 'string';
|
837
932
|
}
|
933
|
+
|
838
934
|
function isArrayBuffer(v) {
|
839
|
-
return
|
935
|
+
return _typeof(v) === 'object' && v !== null && v.byteLength !== undefined;
|
840
936
|
}
|
937
|
+
|
841
938
|
function isSpace(ch) {
|
842
939
|
return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A;
|
843
940
|
}
|
941
|
+
|
844
942
|
function createPromiseCapability() {
|
845
|
-
var capability =
|
943
|
+
var capability = Object.create(null);
|
944
|
+
var isSettled = false;
|
945
|
+
Object.defineProperty(capability, 'settled', {
|
946
|
+
get: function get() {
|
947
|
+
return isSettled;
|
948
|
+
}
|
949
|
+
});
|
846
950
|
capability.promise = new Promise(function (resolve, reject) {
|
847
|
-
capability.resolve =
|
848
|
-
|
951
|
+
capability.resolve = function (data) {
|
952
|
+
isSettled = true;
|
953
|
+
resolve(data);
|
954
|
+
};
|
955
|
+
|
956
|
+
capability.reject = function (reason) {
|
957
|
+
isSettled = true;
|
958
|
+
reject(reason);
|
959
|
+
};
|
849
960
|
});
|
850
961
|
return capability;
|
851
962
|
}
|
852
|
-
|
853
|
-
if (typeof Blob !== 'undefined') {
|
854
|
-
return new Blob([data], { type: contentType });
|
855
|
-
}
|
856
|
-
throw new Error('The "Blob" constructor is not supported.');
|
857
|
-
};
|
963
|
+
|
858
964
|
var createObjectURL = function createObjectURLClosure() {
|
859
965
|
var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
860
966
|
return function createObjectURL(data, contentType) {
|
861
967
|
var forceDataSchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
862
968
|
|
863
|
-
if (!forceDataSchema && URL.createObjectURL) {
|
864
|
-
var blob =
|
865
|
-
|
969
|
+
if (!forceDataSchema && _url_polyfill.URL.createObjectURL) {
|
970
|
+
var blob = new Blob([data], {
|
971
|
+
type: contentType
|
972
|
+
});
|
973
|
+
return _url_polyfill.URL.createObjectURL(blob);
|
866
974
|
}
|
975
|
+
|
867
976
|
var buffer = 'data:' + contentType + ';base64,';
|
977
|
+
|
868
978
|
for (var i = 0, ii = data.length; i < ii; i += 3) {
|
869
979
|
var b1 = data[i] & 0xFF;
|
870
980
|
var b2 = data[i + 1] & 0xFF;
|
@@ -875,474 +985,9 @@ var createObjectURL = function createObjectURLClosure() {
|
|
875
985
|
var d4 = i + 2 < ii ? b3 & 0x3F : 64;
|
876
986
|
buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
|
877
987
|
}
|
988
|
+
|
878
989
|
return buffer;
|
879
990
|
};
|
880
991
|
}();
|
881
|
-
function resolveCall(fn, args) {
|
882
|
-
var thisArg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
883
992
|
|
884
|
-
|
885
|
-
return Promise.resolve(undefined);
|
886
|
-
}
|
887
|
-
return new Promise(function (resolve, reject) {
|
888
|
-
resolve(fn.apply(thisArg, args));
|
889
|
-
});
|
890
|
-
}
|
891
|
-
function wrapReason(reason) {
|
892
|
-
if ((typeof reason === 'undefined' ? 'undefined' : _typeof(reason)) !== 'object') {
|
893
|
-
return reason;
|
894
|
-
}
|
895
|
-
switch (reason.name) {
|
896
|
-
case 'AbortException':
|
897
|
-
return new AbortException(reason.message);
|
898
|
-
case 'MissingPDFException':
|
899
|
-
return new MissingPDFException(reason.message);
|
900
|
-
case 'UnexpectedResponseException':
|
901
|
-
return new UnexpectedResponseException(reason.message, reason.status);
|
902
|
-
default:
|
903
|
-
return new UnknownErrorException(reason.message, reason.details);
|
904
|
-
}
|
905
|
-
}
|
906
|
-
function makeReasonSerializable(reason) {
|
907
|
-
if (!(reason instanceof Error) || reason instanceof AbortException || reason instanceof MissingPDFException || reason instanceof UnexpectedResponseException || reason instanceof UnknownErrorException) {
|
908
|
-
return reason;
|
909
|
-
}
|
910
|
-
return new UnknownErrorException(reason.message, reason.toString());
|
911
|
-
}
|
912
|
-
function resolveOrReject(capability, success, reason) {
|
913
|
-
if (success) {
|
914
|
-
capability.resolve();
|
915
|
-
} else {
|
916
|
-
capability.reject(reason);
|
917
|
-
}
|
918
|
-
}
|
919
|
-
function finalize(promise) {
|
920
|
-
return Promise.resolve(promise).catch(function () {});
|
921
|
-
}
|
922
|
-
function MessageHandler(sourceName, targetName, comObj) {
|
923
|
-
var _this = this;
|
924
|
-
|
925
|
-
this.sourceName = sourceName;
|
926
|
-
this.targetName = targetName;
|
927
|
-
this.comObj = comObj;
|
928
|
-
this.callbackId = 1;
|
929
|
-
this.streamId = 1;
|
930
|
-
this.postMessageTransfers = true;
|
931
|
-
this.streamSinks = Object.create(null);
|
932
|
-
this.streamControllers = Object.create(null);
|
933
|
-
var callbacksCapabilities = this.callbacksCapabilities = Object.create(null);
|
934
|
-
var ah = this.actionHandler = Object.create(null);
|
935
|
-
this._onComObjOnMessage = function (event) {
|
936
|
-
var data = event.data;
|
937
|
-
if (data.targetName !== _this.sourceName) {
|
938
|
-
return;
|
939
|
-
}
|
940
|
-
if (data.stream) {
|
941
|
-
_this._processStreamMessage(data);
|
942
|
-
} else if (data.isReply) {
|
943
|
-
var callbackId = data.callbackId;
|
944
|
-
if (data.callbackId in callbacksCapabilities) {
|
945
|
-
var callback = callbacksCapabilities[callbackId];
|
946
|
-
delete callbacksCapabilities[callbackId];
|
947
|
-
if ('error' in data) {
|
948
|
-
callback.reject(wrapReason(data.error));
|
949
|
-
} else {
|
950
|
-
callback.resolve(data.data);
|
951
|
-
}
|
952
|
-
} else {
|
953
|
-
throw new Error('Cannot resolve callback ' + callbackId);
|
954
|
-
}
|
955
|
-
} else if (data.action in ah) {
|
956
|
-
var action = ah[data.action];
|
957
|
-
if (data.callbackId) {
|
958
|
-
var _sourceName = _this.sourceName;
|
959
|
-
var _targetName = data.sourceName;
|
960
|
-
Promise.resolve().then(function () {
|
961
|
-
return action[0].call(action[1], data.data);
|
962
|
-
}).then(function (result) {
|
963
|
-
comObj.postMessage({
|
964
|
-
sourceName: _sourceName,
|
965
|
-
targetName: _targetName,
|
966
|
-
isReply: true,
|
967
|
-
callbackId: data.callbackId,
|
968
|
-
data: result
|
969
|
-
});
|
970
|
-
}, function (reason) {
|
971
|
-
comObj.postMessage({
|
972
|
-
sourceName: _sourceName,
|
973
|
-
targetName: _targetName,
|
974
|
-
isReply: true,
|
975
|
-
callbackId: data.callbackId,
|
976
|
-
error: makeReasonSerializable(reason)
|
977
|
-
});
|
978
|
-
});
|
979
|
-
} else if (data.streamId) {
|
980
|
-
_this._createStreamSink(data);
|
981
|
-
} else {
|
982
|
-
action[0].call(action[1], data.data);
|
983
|
-
}
|
984
|
-
} else {
|
985
|
-
throw new Error('Unknown action from worker: ' + data.action);
|
986
|
-
}
|
987
|
-
};
|
988
|
-
comObj.addEventListener('message', this._onComObjOnMessage);
|
989
|
-
}
|
990
|
-
MessageHandler.prototype = {
|
991
|
-
on: function on(actionName, handler, scope) {
|
992
|
-
var ah = this.actionHandler;
|
993
|
-
if (ah[actionName]) {
|
994
|
-
throw new Error('There is already an actionName called "' + actionName + '"');
|
995
|
-
}
|
996
|
-
ah[actionName] = [handler, scope];
|
997
|
-
},
|
998
|
-
send: function send(actionName, data, transfers) {
|
999
|
-
var message = {
|
1000
|
-
sourceName: this.sourceName,
|
1001
|
-
targetName: this.targetName,
|
1002
|
-
action: actionName,
|
1003
|
-
data: data
|
1004
|
-
};
|
1005
|
-
this.postMessage(message, transfers);
|
1006
|
-
},
|
1007
|
-
sendWithPromise: function sendWithPromise(actionName, data, transfers) {
|
1008
|
-
var callbackId = this.callbackId++;
|
1009
|
-
var message = {
|
1010
|
-
sourceName: this.sourceName,
|
1011
|
-
targetName: this.targetName,
|
1012
|
-
action: actionName,
|
1013
|
-
data: data,
|
1014
|
-
callbackId: callbackId
|
1015
|
-
};
|
1016
|
-
var capability = createPromiseCapability();
|
1017
|
-
this.callbacksCapabilities[callbackId] = capability;
|
1018
|
-
try {
|
1019
|
-
this.postMessage(message, transfers);
|
1020
|
-
} catch (e) {
|
1021
|
-
capability.reject(e);
|
1022
|
-
}
|
1023
|
-
return capability.promise;
|
1024
|
-
},
|
1025
|
-
sendWithStream: function sendWithStream(actionName, data, queueingStrategy, transfers) {
|
1026
|
-
var _this2 = this;
|
1027
|
-
|
1028
|
-
var streamId = this.streamId++;
|
1029
|
-
var sourceName = this.sourceName;
|
1030
|
-
var targetName = this.targetName;
|
1031
|
-
return new _streams_polyfill.ReadableStream({
|
1032
|
-
start: function start(controller) {
|
1033
|
-
var startCapability = createPromiseCapability();
|
1034
|
-
_this2.streamControllers[streamId] = {
|
1035
|
-
controller: controller,
|
1036
|
-
startCall: startCapability,
|
1037
|
-
isClosed: false
|
1038
|
-
};
|
1039
|
-
_this2.postMessage({
|
1040
|
-
sourceName: sourceName,
|
1041
|
-
targetName: targetName,
|
1042
|
-
action: actionName,
|
1043
|
-
streamId: streamId,
|
1044
|
-
data: data,
|
1045
|
-
desiredSize: controller.desiredSize
|
1046
|
-
});
|
1047
|
-
return startCapability.promise;
|
1048
|
-
},
|
1049
|
-
pull: function pull(controller) {
|
1050
|
-
var pullCapability = createPromiseCapability();
|
1051
|
-
_this2.streamControllers[streamId].pullCall = pullCapability;
|
1052
|
-
_this2.postMessage({
|
1053
|
-
sourceName: sourceName,
|
1054
|
-
targetName: targetName,
|
1055
|
-
stream: 'pull',
|
1056
|
-
streamId: streamId,
|
1057
|
-
desiredSize: controller.desiredSize
|
1058
|
-
});
|
1059
|
-
return pullCapability.promise;
|
1060
|
-
},
|
1061
|
-
cancel: function cancel(reason) {
|
1062
|
-
var cancelCapability = createPromiseCapability();
|
1063
|
-
_this2.streamControllers[streamId].cancelCall = cancelCapability;
|
1064
|
-
_this2.streamControllers[streamId].isClosed = true;
|
1065
|
-
_this2.postMessage({
|
1066
|
-
sourceName: sourceName,
|
1067
|
-
targetName: targetName,
|
1068
|
-
stream: 'cancel',
|
1069
|
-
reason: reason,
|
1070
|
-
streamId: streamId
|
1071
|
-
});
|
1072
|
-
return cancelCapability.promise;
|
1073
|
-
}
|
1074
|
-
}, queueingStrategy);
|
1075
|
-
},
|
1076
|
-
_createStreamSink: function _createStreamSink(data) {
|
1077
|
-
var _this3 = this;
|
1078
|
-
|
1079
|
-
var self = this;
|
1080
|
-
var action = this.actionHandler[data.action];
|
1081
|
-
var streamId = data.streamId;
|
1082
|
-
var desiredSize = data.desiredSize;
|
1083
|
-
var sourceName = this.sourceName;
|
1084
|
-
var targetName = data.sourceName;
|
1085
|
-
var capability = createPromiseCapability();
|
1086
|
-
var sendStreamRequest = function sendStreamRequest(_ref2) {
|
1087
|
-
var stream = _ref2.stream,
|
1088
|
-
chunk = _ref2.chunk,
|
1089
|
-
transfers = _ref2.transfers,
|
1090
|
-
success = _ref2.success,
|
1091
|
-
reason = _ref2.reason;
|
1092
|
-
|
1093
|
-
_this3.postMessage({
|
1094
|
-
sourceName: sourceName,
|
1095
|
-
targetName: targetName,
|
1096
|
-
stream: stream,
|
1097
|
-
streamId: streamId,
|
1098
|
-
chunk: chunk,
|
1099
|
-
success: success,
|
1100
|
-
reason: reason
|
1101
|
-
}, transfers);
|
1102
|
-
};
|
1103
|
-
var streamSink = {
|
1104
|
-
enqueue: function enqueue(chunk) {
|
1105
|
-
var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
1106
|
-
var transfers = arguments[2];
|
1107
|
-
|
1108
|
-
if (this.isCancelled) {
|
1109
|
-
return;
|
1110
|
-
}
|
1111
|
-
var lastDesiredSize = this.desiredSize;
|
1112
|
-
this.desiredSize -= size;
|
1113
|
-
if (lastDesiredSize > 0 && this.desiredSize <= 0) {
|
1114
|
-
this.sinkCapability = createPromiseCapability();
|
1115
|
-
this.ready = this.sinkCapability.promise;
|
1116
|
-
}
|
1117
|
-
sendStreamRequest({
|
1118
|
-
stream: 'enqueue',
|
1119
|
-
chunk: chunk,
|
1120
|
-
transfers: transfers
|
1121
|
-
});
|
1122
|
-
},
|
1123
|
-
close: function close() {
|
1124
|
-
if (this.isCancelled) {
|
1125
|
-
return;
|
1126
|
-
}
|
1127
|
-
this.isCancelled = true;
|
1128
|
-
sendStreamRequest({ stream: 'close' });
|
1129
|
-
delete self.streamSinks[streamId];
|
1130
|
-
},
|
1131
|
-
error: function error(reason) {
|
1132
|
-
if (this.isCancelled) {
|
1133
|
-
return;
|
1134
|
-
}
|
1135
|
-
this.isCancelled = true;
|
1136
|
-
sendStreamRequest({
|
1137
|
-
stream: 'error',
|
1138
|
-
reason: reason
|
1139
|
-
});
|
1140
|
-
},
|
1141
|
-
|
1142
|
-
sinkCapability: capability,
|
1143
|
-
onPull: null,
|
1144
|
-
onCancel: null,
|
1145
|
-
isCancelled: false,
|
1146
|
-
desiredSize: desiredSize,
|
1147
|
-
ready: null
|
1148
|
-
};
|
1149
|
-
streamSink.sinkCapability.resolve();
|
1150
|
-
streamSink.ready = streamSink.sinkCapability.promise;
|
1151
|
-
this.streamSinks[streamId] = streamSink;
|
1152
|
-
resolveCall(action[0], [data.data, streamSink], action[1]).then(function () {
|
1153
|
-
sendStreamRequest({
|
1154
|
-
stream: 'start_complete',
|
1155
|
-
success: true
|
1156
|
-
});
|
1157
|
-
}, function (reason) {
|
1158
|
-
sendStreamRequest({
|
1159
|
-
stream: 'start_complete',
|
1160
|
-
success: false,
|
1161
|
-
reason: reason
|
1162
|
-
});
|
1163
|
-
});
|
1164
|
-
},
|
1165
|
-
_processStreamMessage: function _processStreamMessage(data) {
|
1166
|
-
var _this4 = this;
|
1167
|
-
|
1168
|
-
var sourceName = this.sourceName;
|
1169
|
-
var targetName = data.sourceName;
|
1170
|
-
var streamId = data.streamId;
|
1171
|
-
var sendStreamResponse = function sendStreamResponse(_ref3) {
|
1172
|
-
var stream = _ref3.stream,
|
1173
|
-
success = _ref3.success,
|
1174
|
-
reason = _ref3.reason;
|
1175
|
-
|
1176
|
-
_this4.comObj.postMessage({
|
1177
|
-
sourceName: sourceName,
|
1178
|
-
targetName: targetName,
|
1179
|
-
stream: stream,
|
1180
|
-
success: success,
|
1181
|
-
streamId: streamId,
|
1182
|
-
reason: reason
|
1183
|
-
});
|
1184
|
-
};
|
1185
|
-
var deleteStreamController = function deleteStreamController() {
|
1186
|
-
Promise.all([_this4.streamControllers[data.streamId].startCall, _this4.streamControllers[data.streamId].pullCall, _this4.streamControllers[data.streamId].cancelCall].map(function (capability) {
|
1187
|
-
return capability && finalize(capability.promise);
|
1188
|
-
})).then(function () {
|
1189
|
-
delete _this4.streamControllers[data.streamId];
|
1190
|
-
});
|
1191
|
-
};
|
1192
|
-
switch (data.stream) {
|
1193
|
-
case 'start_complete':
|
1194
|
-
resolveOrReject(this.streamControllers[data.streamId].startCall, data.success, wrapReason(data.reason));
|
1195
|
-
break;
|
1196
|
-
case 'pull_complete':
|
1197
|
-
resolveOrReject(this.streamControllers[data.streamId].pullCall, data.success, wrapReason(data.reason));
|
1198
|
-
break;
|
1199
|
-
case 'pull':
|
1200
|
-
if (!this.streamSinks[data.streamId]) {
|
1201
|
-
sendStreamResponse({
|
1202
|
-
stream: 'pull_complete',
|
1203
|
-
success: true
|
1204
|
-
});
|
1205
|
-
break;
|
1206
|
-
}
|
1207
|
-
if (this.streamSinks[data.streamId].desiredSize <= 0 && data.desiredSize > 0) {
|
1208
|
-
this.streamSinks[data.streamId].sinkCapability.resolve();
|
1209
|
-
}
|
1210
|
-
this.streamSinks[data.streamId].desiredSize = data.desiredSize;
|
1211
|
-
resolveCall(this.streamSinks[data.streamId].onPull).then(function () {
|
1212
|
-
sendStreamResponse({
|
1213
|
-
stream: 'pull_complete',
|
1214
|
-
success: true
|
1215
|
-
});
|
1216
|
-
}, function (reason) {
|
1217
|
-
sendStreamResponse({
|
1218
|
-
stream: 'pull_complete',
|
1219
|
-
success: false,
|
1220
|
-
reason: reason
|
1221
|
-
});
|
1222
|
-
});
|
1223
|
-
break;
|
1224
|
-
case 'enqueue':
|
1225
|
-
assert(this.streamControllers[data.streamId], 'enqueue should have stream controller');
|
1226
|
-
if (!this.streamControllers[data.streamId].isClosed) {
|
1227
|
-
this.streamControllers[data.streamId].controller.enqueue(data.chunk);
|
1228
|
-
}
|
1229
|
-
break;
|
1230
|
-
case 'close':
|
1231
|
-
assert(this.streamControllers[data.streamId], 'close should have stream controller');
|
1232
|
-
if (this.streamControllers[data.streamId].isClosed) {
|
1233
|
-
break;
|
1234
|
-
}
|
1235
|
-
this.streamControllers[data.streamId].isClosed = true;
|
1236
|
-
this.streamControllers[data.streamId].controller.close();
|
1237
|
-
deleteStreamController();
|
1238
|
-
break;
|
1239
|
-
case 'error':
|
1240
|
-
assert(this.streamControllers[data.streamId], 'error should have stream controller');
|
1241
|
-
this.streamControllers[data.streamId].controller.error(wrapReason(data.reason));
|
1242
|
-
deleteStreamController();
|
1243
|
-
break;
|
1244
|
-
case 'cancel_complete':
|
1245
|
-
resolveOrReject(this.streamControllers[data.streamId].cancelCall, data.success, wrapReason(data.reason));
|
1246
|
-
deleteStreamController();
|
1247
|
-
break;
|
1248
|
-
case 'cancel':
|
1249
|
-
if (!this.streamSinks[data.streamId]) {
|
1250
|
-
break;
|
1251
|
-
}
|
1252
|
-
resolveCall(this.streamSinks[data.streamId].onCancel, [wrapReason(data.reason)]).then(function () {
|
1253
|
-
sendStreamResponse({
|
1254
|
-
stream: 'cancel_complete',
|
1255
|
-
success: true
|
1256
|
-
});
|
1257
|
-
}, function (reason) {
|
1258
|
-
sendStreamResponse({
|
1259
|
-
stream: 'cancel_complete',
|
1260
|
-
success: false,
|
1261
|
-
reason: reason
|
1262
|
-
});
|
1263
|
-
});
|
1264
|
-
this.streamSinks[data.streamId].sinkCapability.reject(wrapReason(data.reason));
|
1265
|
-
this.streamSinks[data.streamId].isCancelled = true;
|
1266
|
-
delete this.streamSinks[data.streamId];
|
1267
|
-
break;
|
1268
|
-
default:
|
1269
|
-
throw new Error('Unexpected stream case');
|
1270
|
-
}
|
1271
|
-
},
|
1272
|
-
postMessage: function postMessage(message, transfers) {
|
1273
|
-
if (transfers && this.postMessageTransfers) {
|
1274
|
-
this.comObj.postMessage(message, transfers);
|
1275
|
-
} else {
|
1276
|
-
this.comObj.postMessage(message);
|
1277
|
-
}
|
1278
|
-
},
|
1279
|
-
destroy: function destroy() {
|
1280
|
-
this.comObj.removeEventListener('message', this._onComObjOnMessage);
|
1281
|
-
}
|
1282
|
-
};
|
1283
|
-
exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
|
1284
|
-
exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
|
1285
|
-
exports.OPS = OPS;
|
1286
|
-
exports.VerbosityLevel = VerbosityLevel;
|
1287
|
-
exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
|
1288
|
-
exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
|
1289
|
-
exports.AnnotationFieldFlag = AnnotationFieldFlag;
|
1290
|
-
exports.AnnotationFlag = AnnotationFlag;
|
1291
|
-
exports.AnnotationType = AnnotationType;
|
1292
|
-
exports.FontType = FontType;
|
1293
|
-
exports.ImageKind = ImageKind;
|
1294
|
-
exports.CMapCompressionType = CMapCompressionType;
|
1295
|
-
exports.AbortException = AbortException;
|
1296
|
-
exports.InvalidPDFException = InvalidPDFException;
|
1297
|
-
exports.MessageHandler = MessageHandler;
|
1298
|
-
exports.MissingDataException = MissingDataException;
|
1299
|
-
exports.MissingPDFException = MissingPDFException;
|
1300
|
-
exports.NativeImageDecoding = NativeImageDecoding;
|
1301
|
-
exports.NotImplementedException = NotImplementedException;
|
1302
|
-
exports.PageViewport = PageViewport;
|
1303
|
-
exports.PasswordException = PasswordException;
|
1304
|
-
exports.PasswordResponses = PasswordResponses;
|
1305
|
-
exports.StreamType = StreamType;
|
1306
|
-
exports.TextRenderingMode = TextRenderingMode;
|
1307
|
-
exports.UnexpectedResponseException = UnexpectedResponseException;
|
1308
|
-
exports.UnknownErrorException = UnknownErrorException;
|
1309
|
-
exports.Util = Util;
|
1310
|
-
exports.XRefParseException = XRefParseException;
|
1311
|
-
exports.FormatError = FormatError;
|
1312
|
-
exports.arrayByteLength = arrayByteLength;
|
1313
|
-
exports.arraysToBytes = arraysToBytes;
|
1314
|
-
exports.assert = assert;
|
1315
|
-
exports.bytesToString = bytesToString;
|
1316
|
-
exports.createBlob = createBlob;
|
1317
|
-
exports.createPromiseCapability = createPromiseCapability;
|
1318
|
-
exports.createObjectURL = createObjectURL;
|
1319
|
-
exports.deprecated = deprecated;
|
1320
|
-
exports.getInheritableProperty = getInheritableProperty;
|
1321
|
-
exports.getLookupTableFactory = getLookupTableFactory;
|
1322
|
-
exports.getVerbosityLevel = getVerbosityLevel;
|
1323
|
-
exports.info = info;
|
1324
|
-
exports.isArrayBuffer = isArrayBuffer;
|
1325
|
-
exports.isBool = isBool;
|
1326
|
-
exports.isEmptyObj = isEmptyObj;
|
1327
|
-
exports.isNum = isNum;
|
1328
|
-
exports.isString = isString;
|
1329
|
-
exports.isSpace = isSpace;
|
1330
|
-
exports.isSameOrigin = isSameOrigin;
|
1331
|
-
exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
|
1332
|
-
exports.isLittleEndian = isLittleEndian;
|
1333
|
-
exports.isEvalSupported = isEvalSupported;
|
1334
|
-
exports.log2 = log2;
|
1335
|
-
exports.readInt8 = readInt8;
|
1336
|
-
exports.readUint16 = readUint16;
|
1337
|
-
exports.readUint32 = readUint32;
|
1338
|
-
exports.removeNullCharacters = removeNullCharacters;
|
1339
|
-
exports.ReadableStream = _streams_polyfill.ReadableStream;
|
1340
|
-
exports.setVerbosityLevel = setVerbosityLevel;
|
1341
|
-
exports.shadow = shadow;
|
1342
|
-
exports.string32 = string32;
|
1343
|
-
exports.stringToBytes = stringToBytes;
|
1344
|
-
exports.stringToPDFString = stringToPDFString;
|
1345
|
-
exports.stringToUTF8String = stringToUTF8String;
|
1346
|
-
exports.utf8StringToString = utf8StringToString;
|
1347
|
-
exports.warn = warn;
|
1348
|
-
exports.unreachable = unreachable;
|
993
|
+
exports.createObjectURL = createObjectURL;
|