@chialab/pdfjs-lib 1.0.0-alpha.3 → 1.0.0-alpha.30
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.
- package/README.md +15 -7
- package/dist/browser/{FoxitDingbats-SB6TO3S5.js → FoxitDingbats-XZTZYAP6.js} +1 -1
- package/dist/browser/{FoxitFixed-UIGSMBQB.js → FoxitFixed-DRWD6QNM.js} +1 -1
- package/dist/browser/{FoxitFixedBold-2PAEIZAT.js → FoxitFixedBold-A3IBPIFC.js} +1 -1
- package/dist/browser/{FoxitFixedBoldItalic-OSQUQDEE.js → FoxitFixedBoldItalic-V4ORMFGL.js} +1 -1
- package/dist/browser/{FoxitFixedItalic-W73RDK22.js → FoxitFixedItalic-Z7BSNTJA.js} +1 -1
- package/dist/browser/{FoxitSerif-3HH3SOZF.js → FoxitSerif-Y34FHWHO.js} +1 -1
- package/dist/browser/{FoxitSerifBold-HXP2QOO7.js → FoxitSerifBold-NCWBT4GX.js} +1 -1
- package/dist/browser/{FoxitSerifBoldItalic-FZXLNWD7.js → FoxitSerifBoldItalic-YTEOG5ZU.js} +1 -1
- package/dist/browser/{FoxitSerifItalic-WQFHUBI2.js → FoxitSerifItalic-3H547RIJ.js} +1 -1
- package/dist/browser/{FoxitSymbol-OVWU7LKS.js → FoxitSymbol-EMTQEYPB.js} +1 -1
- package/dist/browser/{LiberationSans-Bold-GSJN42N5.js → LiberationSans-Bold-MGX34QV4.js} +1 -1
- package/dist/browser/LiberationSans-Bold-PQY5JZAT.js +9 -0
- package/dist/browser/LiberationSans-BoldItalic-PBNZJX4S.js +9 -0
- package/dist/browser/{LiberationSans-BoldItalic-UCPQJ3L2.js → LiberationSans-BoldItalic-WSEQ5LH5.js} +1 -1
- package/dist/browser/{LiberationSans-Italic-6CIHEALY.js → LiberationSans-Italic-E4SLDR4M.js} +1 -1
- package/dist/browser/LiberationSans-Italic-NAYVQTNG.js +9 -0
- package/dist/browser/{LiberationSans-Regular-KIF3IRJY.js → LiberationSans-Regular-3SH5NGZO.js} +1 -1
- package/dist/browser/LiberationSans-Regular-FMNBW2LE.js +9 -0
- package/dist/browser/NodeUtilsStabs-AQQCOPNR.js +19 -0
- package/dist/browser/chunk-3ZTAZS2X.js +25 -0
- package/dist/browser/{chunk-O4UKW7AD.js → chunk-7YYVRRNF.js} +5 -0
- package/dist/browser/{chunk-DYHYQ33L.js → chunk-R7G44NYV.js} +834 -84
- package/dist/browser/index.js +21400 -4931
- package/dist/browser/openjpeg-Q27OVS4T.js +9 -0
- package/dist/browser/qcms_bg-BCJEADMU.js +9 -0
- package/dist/browser/worker.js +8311 -7089
- package/dist/index.d.ts +11 -1
- package/dist/lib/AnnotationData.d.ts +8 -8
- package/dist/lib/AnnotationOperatorsList.d.ts +21 -0
- package/dist/lib/Canvas.d.ts +0 -5
- package/dist/lib/CanvasGraphics.d.ts +1 -0
- package/dist/lib/NodeCanvasFactory.d.ts +9 -0
- package/dist/lib/NodeFilterFactory.d.ts +10 -0
- package/dist/lib/NodeUtils.d.ts +24 -0
- package/dist/lib/Path2D.d.ts +9 -49
- package/dist/lib/StandardFontDataFactory.d.ts +2 -2
- package/dist/lib/StructTreePage.d.ts +5 -0
- package/dist/lib/Svg.d.ts +144 -0
- package/dist/lib/SvgCanvasContext.d.ts +36 -22
- package/dist/lib/TextLayer.d.ts +48 -10
- package/dist/lib/TextLayer_v2.d.ts +8 -0
- package/dist/lib/WasmFactory.d.ts +5 -0
- package/dist/lib/utils.d.ts +29 -3
- package/dist/node/{FoxitDingbats-65AZ2Z2V.js → FoxitDingbats-UZC34T4F.js} +1 -1
- package/dist/node/{FoxitFixed-OZGLVVOQ.js → FoxitFixed-DSJVG3IJ.js} +1 -1
- package/dist/node/{FoxitFixedBold-37OOYMV7.js → FoxitFixedBold-YSX4X5NA.js} +1 -1
- package/dist/node/{FoxitFixedBoldItalic-XYFHEG2V.js → FoxitFixedBoldItalic-IFYYA6RR.js} +1 -1
- package/dist/node/{FoxitFixedItalic-MM7OSGS6.js → FoxitFixedItalic-4PEFPCQV.js} +1 -1
- package/dist/node/{FoxitSerif-MLMJQPRP.js → FoxitSerif-7SSP2H2U.js} +1 -1
- package/dist/node/{FoxitSerifBold-AC7RJQWJ.js → FoxitSerifBold-KLMURJ6N.js} +1 -1
- package/dist/node/{FoxitSerifBoldItalic-YCQ4CLKE.js → FoxitSerifBoldItalic-VSYHWLRM.js} +1 -1
- package/dist/node/{FoxitSerifItalic-CXVTCST4.js → FoxitSerifItalic-NTOPMQDD.js} +1 -1
- package/dist/node/{FoxitSymbol-VUGMZN5C.js → FoxitSymbol-QPUM74UN.js} +1 -1
- package/dist/node/{LiberationSans-Bold-XSHQQBWB.js → LiberationSans-Bold-BXFYN4PV.js} +1 -1
- package/dist/node/LiberationSans-Bold-VIZ4XT4N.js +9 -0
- package/dist/node/{LiberationSans-BoldItalic-CTAZRFRL.js → LiberationSans-BoldItalic-DQQC5TNJ.js} +1 -1
- package/dist/node/LiberationSans-BoldItalic-WXMOSICD.js +9 -0
- package/dist/node/LiberationSans-Italic-34IBVQZ4.js +9 -0
- package/dist/node/{LiberationSans-Italic-WIOTUKLC.js → LiberationSans-Italic-Z4MFN6PY.js} +1 -1
- package/dist/node/LiberationSans-Regular-JOSGNSW5.js +9 -0
- package/dist/node/{LiberationSans-Regular-CDMMZL5S.js → LiberationSans-Regular-MACKS2VL.js} +1 -1
- package/dist/node/NodeUtils-PVXQMWFJ.js +20 -0
- package/dist/node/chunk-4Y7OZIIX.js +1319 -0
- package/dist/node/chunk-O74KGUUC.js +2093 -0
- package/dist/node/chunk-T2JWSGAF.js +1225 -0
- package/dist/node/chunk-ZFIGV5OT.js +63 -0
- package/dist/node/index.js +23520 -8727
- package/dist/node/openjpeg-QFJSFVSJ.js +9 -0
- package/dist/node/qcms_bg-PRPVJQFC.js +9 -0
- package/dist/node/worker.js +8320 -7096
- package/dist/pdf.js/external/openjpeg/openjpeg.d.ts +2 -0
- package/dist/pdf.js/external/qcms/qcms.d.ts +92 -0
- package/dist/pdf.js/external/qcms/qcms_utils.d.ts +14 -0
- package/dist/pdf.js/src/core/arithmetic_decoder.d.ts +21 -0
- package/dist/pdf.js/src/core/ascii_85_stream.d.ts +8 -0
- package/dist/pdf.js/src/core/ascii_hex_stream.d.ts +8 -0
- package/dist/pdf.js/src/core/base_stream.d.ts +32 -0
- package/dist/pdf.js/src/core/binary_cmap.d.ts +3 -0
- package/dist/pdf.js/src/core/ccitt.d.ts +72 -0
- package/dist/pdf.js/src/core/ccitt_stream.d.ts +9 -0
- package/dist/pdf.js/src/core/cff_font.d.ts +15 -0
- package/dist/pdf.js/src/core/cff_parser.d.ts +166 -0
- package/dist/pdf.js/src/core/charsets.d.ts +3 -0
- package/dist/pdf.js/src/core/cmap.d.ts +37 -0
- package/dist/pdf.js/src/core/colorspace.d.ts +177 -0
- package/dist/pdf.js/src/core/colorspace_utils.d.ts +21 -0
- package/dist/pdf.js/src/core/core_utils.d.ts +140 -0
- package/dist/pdf.js/src/core/decode_stream.d.ts +25 -0
- package/dist/pdf.js/src/core/encodings.d.ts +7 -0
- package/dist/pdf.js/src/core/flate_stream.d.ts +15 -0
- package/dist/pdf.js/src/core/font_renderer.d.ts +34 -0
- package/dist/pdf.js/src/core/fonts.d.ts +98 -0
- package/dist/pdf.js/src/core/fonts_utils.d.ts +32 -0
- package/dist/pdf.js/src/core/glyf.d.ts +44 -0
- package/dist/pdf.js/src/core/glyphlist.d.ts +2 -0
- package/dist/pdf.js/src/core/icc_colorspace.d.ts +22 -0
- package/dist/pdf.js/src/core/jbig2.d.ts +12 -0
- package/dist/pdf.js/src/core/jbig2_stream.d.ts +17 -0
- package/dist/pdf.js/src/core/jpeg_stream.d.ts +25 -0
- package/dist/pdf.js/src/core/jpg.d.ts +62 -0
- package/dist/pdf.js/src/core/jpx.d.ts +35 -0
- package/dist/pdf.js/src/core/jpx_stream.d.ts +17 -0
- package/dist/pdf.js/src/core/lzw_stream.d.ts +21 -0
- package/dist/pdf.js/src/core/metrics.d.ts +2 -0
- package/dist/pdf.js/src/core/name_number_tree.d.ts +21 -0
- package/dist/pdf.js/src/core/opentype_file_builder.d.ts +12 -0
- package/dist/pdf.js/src/core/parser.d.ts +81 -0
- package/dist/pdf.js/src/core/predictor_stream.d.ts +15 -0
- package/dist/pdf.js/src/core/primitives.d.ts +78 -0
- package/dist/pdf.js/src/core/run_length_stream.d.ts +7 -0
- package/dist/pdf.js/src/core/standard_fonts.d.ts +18 -0
- package/dist/pdf.js/src/core/stream.d.ts +21 -0
- package/dist/pdf.js/src/core/struct_tree.d.ts +92 -0
- package/dist/pdf.js/src/core/to_unicode_map.d.ts +21 -0
- package/dist/pdf.js/src/core/type1_font.d.ts +17 -0
- package/dist/pdf.js/src/core/type1_parser.d.ts +29 -0
- package/dist/pdf.js/src/core/unicode.d.ts +5 -0
- package/dist/pdf.js/src/display/annotation_layer.d.ts +35 -5
- package/dist/pdf.js/src/display/annotation_storage.d.ts +3 -8
- package/dist/pdf.js/src/display/api.d.ts +86 -77
- package/dist/pdf.js/src/display/api_utils.d.ts +13 -0
- package/dist/pdf.js/src/display/canvas.d.ts +88 -94
- package/dist/pdf.js/src/display/canvas_dependency_tracker.d.ts +160 -0
- package/dist/pdf.js/src/display/display_utils.d.ts +34 -1
- package/dist/pdf.js/src/display/draw_layer.d.ts +2 -2
- package/dist/pdf.js/src/display/editor/alt_text.d.ts +1 -1
- package/dist/pdf.js/src/display/editor/annotation_editor_layer.d.ts +10 -8
- package/dist/pdf.js/src/display/editor/color_picker.d.ts +20 -1
- package/dist/pdf.js/src/display/editor/comment.d.ts +47 -0
- package/dist/pdf.js/src/display/editor/draw.d.ts +8 -8
- package/dist/pdf.js/src/display/editor/drawers/freedraw.d.ts +4 -3
- package/dist/pdf.js/src/display/editor/drawers/highlight.d.ts +2 -1
- package/dist/pdf.js/src/display/editor/drawers/signaturedraw.d.ts +13 -13
- package/dist/pdf.js/src/display/editor/editor.d.ts +117 -16
- package/dist/pdf.js/src/display/editor/freetext.d.ts +11 -7
- package/dist/pdf.js/src/display/editor/highlight.d.ts +9 -3
- package/dist/pdf.js/src/display/editor/ink.d.ts +6 -0
- package/dist/pdf.js/src/display/editor/signature.d.ts +3 -5
- package/dist/pdf.js/src/display/editor/stamp.d.ts +4 -3
- package/dist/pdf.js/src/display/editor/toolbar.d.ts +8 -3
- package/dist/pdf.js/src/display/editor/tools.d.ts +36 -12
- package/dist/pdf.js/src/display/font_loader.d.ts +27 -1
- package/dist/pdf.js/src/display/metadata.d.ts +1 -2
- package/dist/pdf.js/src/display/optional_content_config.d.ts +1 -1
- package/dist/pdf.js/src/display/pattern_helper.d.ts +6 -4
- package/dist/pdf.js/src/display/pdf_objects.d.ts +40 -0
- package/dist/pdf.js/src/display/text_layer.d.ts +9 -9
- package/dist/pdf.js/src/display/touch_manager.d.ts +5 -1
- package/dist/pdf.js/src/display/worker_options.d.ts +2 -2
- package/dist/pdf.js/src/pdf.d.ts +9 -1
- package/dist/pdf.js/src/shared/obj-bin-transform.d.ts +64 -0
- package/dist/pdf.js/src/shared/scripting_utils.d.ts +2 -0
- package/dist/pdf.js/src/shared/util.d.ts +129 -102
- package/dist/pdf.js/web/comment_manager.d.ts +20 -0
- package/dist/pdf.js/web/interfaces.d.ts +7 -0
- package/dist/pdf.js/web/text_accessibility.d.ts +1 -1
- package/package.json +16 -4
- package/dist/node/chunk-7MW5RQZ5.js +0 -30
- package/dist/node/chunk-KTTVPO2G.js +0 -1775
- package/dist/pdf.js/src/display/node_utils.d.ts +0 -32
|
@@ -2,8 +2,9 @@ import {
|
|
|
2
2
|
__privateAdd,
|
|
3
3
|
__privateGet,
|
|
4
4
|
__privateMethod,
|
|
5
|
-
__privateSet
|
|
6
|
-
|
|
5
|
+
__privateSet,
|
|
6
|
+
__publicField
|
|
7
|
+
} from "./chunk-7YYVRRNF.js";
|
|
7
8
|
|
|
8
9
|
// src/lib/polyfills.ts
|
|
9
10
|
if (!Array.prototype.at) {
|
|
@@ -48,7 +49,6 @@ if (!("try" in Promise)) {
|
|
|
48
49
|
|
|
49
50
|
// src/pdf.js/src/shared/util.js
|
|
50
51
|
var isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
|
|
51
|
-
var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
|
|
52
52
|
var FONT_IDENTITY_MATRIX = [1e-3, 0, 0, 1e-3, 0, 0];
|
|
53
53
|
var LINE_FACTOR = 1.35;
|
|
54
54
|
var LINE_DESCENT_FACTOR = 0.35;
|
|
@@ -78,7 +78,9 @@ var AnnotationEditorType = {
|
|
|
78
78
|
HIGHLIGHT: 9,
|
|
79
79
|
STAMP: 13,
|
|
80
80
|
INK: 15,
|
|
81
|
-
|
|
81
|
+
POPUP: 16,
|
|
82
|
+
SIGNATURE: 101,
|
|
83
|
+
COMMENT: 102
|
|
82
84
|
};
|
|
83
85
|
var AnnotationEditorParamsType = {
|
|
84
86
|
RESIZE: 1,
|
|
@@ -90,10 +92,9 @@ var AnnotationEditorParamsType = {
|
|
|
90
92
|
INK_THICKNESS: 22,
|
|
91
93
|
INK_OPACITY: 23,
|
|
92
94
|
HIGHLIGHT_COLOR: 31,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
HIGHLIGHT_SHOW_ALL: 35,
|
|
95
|
+
HIGHLIGHT_THICKNESS: 32,
|
|
96
|
+
HIGHLIGHT_FREE: 33,
|
|
97
|
+
HIGHLIGHT_SHOW_ALL: 34,
|
|
97
98
|
DRAW_STEP: 41
|
|
98
99
|
};
|
|
99
100
|
var PermissionFlag = {
|
|
@@ -324,7 +325,14 @@ var OPS = {
|
|
|
324
325
|
paintSolidColorImageMask: 90,
|
|
325
326
|
constructPath: 91,
|
|
326
327
|
setStrokeTransparent: 92,
|
|
327
|
-
setFillTransparent: 93
|
|
328
|
+
setFillTransparent: 93,
|
|
329
|
+
rawFillPath: 94
|
|
330
|
+
};
|
|
331
|
+
var DrawOPS = {
|
|
332
|
+
moveTo: 0,
|
|
333
|
+
lineTo: 1,
|
|
334
|
+
curveTo: 2,
|
|
335
|
+
closePath: 3
|
|
328
336
|
};
|
|
329
337
|
var PasswordResponses = {
|
|
330
338
|
NEED_PASSWORD: 1,
|
|
@@ -341,12 +349,12 @@ function getVerbosityLevel() {
|
|
|
341
349
|
}
|
|
342
350
|
function info(msg) {
|
|
343
351
|
if (verbosity >= VerbosityLevel.INFOS) {
|
|
344
|
-
console.
|
|
352
|
+
console.info(`Info: ${msg}`);
|
|
345
353
|
}
|
|
346
354
|
}
|
|
347
355
|
function warn(msg) {
|
|
348
356
|
if (verbosity >= VerbosityLevel.WARNINGS) {
|
|
349
|
-
console.
|
|
357
|
+
console.warn(`Warning: ${msg}`);
|
|
350
358
|
}
|
|
351
359
|
}
|
|
352
360
|
function unreachable(msg) {
|
|
@@ -390,6 +398,17 @@ function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
|
|
|
390
398
|
const absoluteUrl = baseUrl ? URL.parse(url, baseUrl) : URL.parse(url);
|
|
391
399
|
return _isValidProtocol(absoluteUrl) ? absoluteUrl : null;
|
|
392
400
|
}
|
|
401
|
+
function updateUrlHash(url, hash, allowRel = false) {
|
|
402
|
+
const res = URL.parse(url);
|
|
403
|
+
if (res) {
|
|
404
|
+
res.hash = hash;
|
|
405
|
+
return res.href;
|
|
406
|
+
}
|
|
407
|
+
if (allowRel && createValidAbsoluteUrl(url, "http://example.com")) {
|
|
408
|
+
return url.split("#", 1)[0] + `${hash ? `#${hash}` : ""}`;
|
|
409
|
+
}
|
|
410
|
+
return "";
|
|
411
|
+
}
|
|
393
412
|
function shadow(obj, prop, value, nonSerializable = false) {
|
|
394
413
|
if (false) {
|
|
395
414
|
assert(
|
|
@@ -405,7 +424,7 @@ function shadow(obj, prop, value, nonSerializable = false) {
|
|
|
405
424
|
});
|
|
406
425
|
return value;
|
|
407
426
|
}
|
|
408
|
-
var BaseException = function BaseExceptionClosure() {
|
|
427
|
+
var BaseException = (function BaseExceptionClosure() {
|
|
409
428
|
function BaseException2(message, name) {
|
|
410
429
|
if (false) {
|
|
411
430
|
unreachable("Cannot initialize BaseException.");
|
|
@@ -416,7 +435,7 @@ var BaseException = function BaseExceptionClosure() {
|
|
|
416
435
|
BaseException2.prototype = new Error();
|
|
417
436
|
BaseException2.constructor = BaseException2;
|
|
418
437
|
return BaseException2;
|
|
419
|
-
}();
|
|
438
|
+
})();
|
|
420
439
|
var PasswordException = class extends BaseException {
|
|
421
440
|
constructor(msg, code) {
|
|
422
441
|
super(msg, "PasswordException");
|
|
@@ -496,13 +515,6 @@ function string32(value) {
|
|
|
496
515
|
function objectSize(obj) {
|
|
497
516
|
return Object.keys(obj).length;
|
|
498
517
|
}
|
|
499
|
-
function objectFromMap(map) {
|
|
500
|
-
const obj = /* @__PURE__ */ Object.create(null);
|
|
501
|
-
for (const [key, value] of map) {
|
|
502
|
-
obj[key] = value;
|
|
503
|
-
}
|
|
504
|
-
return obj;
|
|
505
|
-
}
|
|
506
518
|
function isLittleEndian() {
|
|
507
519
|
const buffer8 = new Uint8Array(4);
|
|
508
520
|
buffer8[0] = 1;
|
|
@@ -539,22 +551,13 @@ var FeatureTest = class {
|
|
|
539
551
|
);
|
|
540
552
|
}
|
|
541
553
|
static get platform() {
|
|
542
|
-
|
|
543
|
-
const { platform, userAgent } = navigator;
|
|
544
|
-
return shadow(this, "platform", {
|
|
545
|
-
isAndroid: userAgent.includes("Android"),
|
|
546
|
-
isLinux: platform.includes("Linux"),
|
|
547
|
-
isMac: platform.includes("Mac"),
|
|
548
|
-
isWindows: platform.includes("Win"),
|
|
549
|
-
isFirefox: userAgent.includes("Firefox")
|
|
550
|
-
});
|
|
551
|
-
}
|
|
554
|
+
const { platform, userAgent } = navigator;
|
|
552
555
|
return shadow(this, "platform", {
|
|
553
|
-
isAndroid:
|
|
554
|
-
isLinux:
|
|
555
|
-
isMac:
|
|
556
|
-
isWindows:
|
|
557
|
-
isFirefox:
|
|
556
|
+
isAndroid: userAgent.includes("Android"),
|
|
557
|
+
isLinux: platform.includes("Linux"),
|
|
558
|
+
isMac: platform.includes("Mac"),
|
|
559
|
+
isWindows: platform.includes("Win"),
|
|
560
|
+
isFirefox: userAgent.includes("Firefox")
|
|
558
561
|
});
|
|
559
562
|
}
|
|
560
563
|
static get isCSSRoundSupported() {
|
|
@@ -574,6 +577,9 @@ var Util = class {
|
|
|
574
577
|
static makeHexColor(r, g, b) {
|
|
575
578
|
return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
|
|
576
579
|
}
|
|
580
|
+
static domMatrixToTransform(dm) {
|
|
581
|
+
return [dm.a, dm.b, dm.c, dm.d, dm.e, dm.f];
|
|
582
|
+
}
|
|
577
583
|
// Apply a scaling matrix to some min/max values.
|
|
578
584
|
// If a scaling factor is negative then min and max must be
|
|
579
585
|
// swapped.
|
|
@@ -632,31 +638,84 @@ var Util = class {
|
|
|
632
638
|
m1[1] * m2[4] + m1[3] * m2[5] + m1[5]
|
|
633
639
|
];
|
|
634
640
|
}
|
|
641
|
+
// Multiplies m (an array-based transform) by md (a DOMMatrix transform).
|
|
642
|
+
static multiplyByDOMMatrix(m, md) {
|
|
643
|
+
return [
|
|
644
|
+
m[0] * md.a + m[2] * md.b,
|
|
645
|
+
m[1] * md.a + m[3] * md.b,
|
|
646
|
+
m[0] * md.c + m[2] * md.d,
|
|
647
|
+
m[1] * md.c + m[3] * md.d,
|
|
648
|
+
m[0] * md.e + m[2] * md.f + m[4],
|
|
649
|
+
m[1] * md.e + m[3] * md.f + m[5]
|
|
650
|
+
];
|
|
651
|
+
}
|
|
635
652
|
// For 2d affine transforms
|
|
636
|
-
static applyTransform(p, m) {
|
|
637
|
-
const
|
|
638
|
-
const
|
|
639
|
-
|
|
653
|
+
static applyTransform(p, m, pos = 0) {
|
|
654
|
+
const p0 = p[pos];
|
|
655
|
+
const p1 = p[pos + 1];
|
|
656
|
+
p[pos] = p0 * m[0] + p1 * m[2] + m[4];
|
|
657
|
+
p[pos + 1] = p0 * m[1] + p1 * m[3] + m[5];
|
|
658
|
+
}
|
|
659
|
+
static applyTransformToBezier(p, transform, pos = 0) {
|
|
660
|
+
const m0 = transform[0];
|
|
661
|
+
const m1 = transform[1];
|
|
662
|
+
const m2 = transform[2];
|
|
663
|
+
const m3 = transform[3];
|
|
664
|
+
const m4 = transform[4];
|
|
665
|
+
const m5 = transform[5];
|
|
666
|
+
for (let i = 0; i < 6; i += 2) {
|
|
667
|
+
const pI = p[pos + i];
|
|
668
|
+
const pI1 = p[pos + i + 1];
|
|
669
|
+
p[pos + i] = pI * m0 + pI1 * m2 + m4;
|
|
670
|
+
p[pos + i + 1] = pI * m1 + pI1 * m3 + m5;
|
|
671
|
+
}
|
|
640
672
|
}
|
|
641
673
|
static applyInverseTransform(p, m) {
|
|
674
|
+
const p0 = p[0];
|
|
675
|
+
const p1 = p[1];
|
|
642
676
|
const d = m[0] * m[3] - m[1] * m[2];
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
return [xt, yt];
|
|
677
|
+
p[0] = (p0 * m[3] - p1 * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
|
|
678
|
+
p[1] = (-p0 * m[1] + p1 * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
|
|
646
679
|
}
|
|
647
680
|
// Applies the transform to the rectangle and finds the minimum axially
|
|
648
681
|
// aligned bounding box.
|
|
649
|
-
static
|
|
650
|
-
const
|
|
651
|
-
const
|
|
652
|
-
const
|
|
653
|
-
const
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
];
|
|
682
|
+
static axialAlignedBoundingBox(rect, transform, output) {
|
|
683
|
+
const m0 = transform[0];
|
|
684
|
+
const m1 = transform[1];
|
|
685
|
+
const m2 = transform[2];
|
|
686
|
+
const m3 = transform[3];
|
|
687
|
+
const m4 = transform[4];
|
|
688
|
+
const m5 = transform[5];
|
|
689
|
+
const r0 = rect[0];
|
|
690
|
+
const r1 = rect[1];
|
|
691
|
+
const r2 = rect[2];
|
|
692
|
+
const r3 = rect[3];
|
|
693
|
+
let a0 = m0 * r0 + m4;
|
|
694
|
+
let a2 = a0;
|
|
695
|
+
let a1 = m0 * r2 + m4;
|
|
696
|
+
let a3 = a1;
|
|
697
|
+
let b0 = m3 * r1 + m5;
|
|
698
|
+
let b2 = b0;
|
|
699
|
+
let b1 = m3 * r3 + m5;
|
|
700
|
+
let b3 = b1;
|
|
701
|
+
if (m1 !== 0 || m2 !== 0) {
|
|
702
|
+
const m1r0 = m1 * r0;
|
|
703
|
+
const m1r2 = m1 * r2;
|
|
704
|
+
const m2r1 = m2 * r1;
|
|
705
|
+
const m2r3 = m2 * r3;
|
|
706
|
+
a0 += m2r1;
|
|
707
|
+
a3 += m2r1;
|
|
708
|
+
a1 += m2r3;
|
|
709
|
+
a2 += m2r3;
|
|
710
|
+
b0 += m1r0;
|
|
711
|
+
b3 += m1r0;
|
|
712
|
+
b1 += m1r2;
|
|
713
|
+
b2 += m1r2;
|
|
714
|
+
}
|
|
715
|
+
output[0] = Math.min(output[0], a0, a1, a2, a3);
|
|
716
|
+
output[1] = Math.min(output[1], b0, b1, b2, b3);
|
|
717
|
+
output[2] = Math.max(output[2], a0, a1, a2, a3);
|
|
718
|
+
output[3] = Math.max(output[3], b0, b1, b2, b3);
|
|
660
719
|
}
|
|
661
720
|
static inverseTransform(m) {
|
|
662
721
|
const d = m[0] * m[3] - m[1] * m[2];
|
|
@@ -672,17 +731,18 @@ var Util = class {
|
|
|
672
731
|
// This calculation uses Singular Value Decomposition.
|
|
673
732
|
// The SVD can be represented with formula A = USV. We are interested in the
|
|
674
733
|
// matrix S here because it represents the scale values.
|
|
675
|
-
static singularValueDecompose2dScale(
|
|
676
|
-
const
|
|
677
|
-
const
|
|
678
|
-
const
|
|
679
|
-
const
|
|
680
|
-
const
|
|
681
|
-
const
|
|
682
|
-
const
|
|
683
|
-
const
|
|
684
|
-
const
|
|
685
|
-
|
|
734
|
+
static singularValueDecompose2dScale(matrix, output) {
|
|
735
|
+
const m0 = matrix[0];
|
|
736
|
+
const m1 = matrix[1];
|
|
737
|
+
const m2 = matrix[2];
|
|
738
|
+
const m3 = matrix[3];
|
|
739
|
+
const a = m0 ** 2 + m1 ** 2;
|
|
740
|
+
const b = m0 * m2 + m1 * m3;
|
|
741
|
+
const c = m2 ** 2 + m3 ** 2;
|
|
742
|
+
const first = (a + c) / 2;
|
|
743
|
+
const second = Math.sqrt(first ** 2 - (a * c - b ** 2));
|
|
744
|
+
output[0] = Math.sqrt(first + second || 1);
|
|
745
|
+
output[1] = Math.sqrt(first - second || 1);
|
|
686
746
|
}
|
|
687
747
|
// Normalize rectangle rect=[x1, y1, x2, y2] so that (x1,y1) < (x2,y2)
|
|
688
748
|
// For coordinate systems whose origin lies in the bottom-left, this
|
|
@@ -728,24 +788,26 @@ var Util = class {
|
|
|
728
788
|
}
|
|
729
789
|
return [xLow, yLow, xHigh, yHigh];
|
|
730
790
|
}
|
|
791
|
+
static pointBoundingBox(x, y, minMax) {
|
|
792
|
+
minMax[0] = Math.min(minMax[0], x);
|
|
793
|
+
minMax[1] = Math.min(minMax[1], y);
|
|
794
|
+
minMax[2] = Math.max(minMax[2], x);
|
|
795
|
+
minMax[3] = Math.max(minMax[3], y);
|
|
796
|
+
}
|
|
797
|
+
static rectBoundingBox(x0, y0, x1, y1, minMax) {
|
|
798
|
+
minMax[0] = Math.min(minMax[0], x0, x1);
|
|
799
|
+
minMax[1] = Math.min(minMax[1], y0, y1);
|
|
800
|
+
minMax[2] = Math.max(minMax[2], x0, x1);
|
|
801
|
+
minMax[3] = Math.max(minMax[3], y0, y1);
|
|
802
|
+
}
|
|
731
803
|
// From https://github.com/adobe-webplatform/Snap.svg/blob/b365287722a72526000ac4bfcf0ce4cac2faa015/src/path.js#L852
|
|
732
804
|
static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3, minMax) {
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
minMax[3] = Math.max(minMax[3], y0, y3);
|
|
738
|
-
} else {
|
|
739
|
-
minMax = [
|
|
740
|
-
Math.min(x0, x3),
|
|
741
|
-
Math.min(y0, y3),
|
|
742
|
-
Math.max(x0, x3),
|
|
743
|
-
Math.max(y0, y3)
|
|
744
|
-
];
|
|
745
|
-
}
|
|
805
|
+
minMax[0] = Math.min(minMax[0], x0, x3);
|
|
806
|
+
minMax[1] = Math.min(minMax[1], y0, y3);
|
|
807
|
+
minMax[2] = Math.max(minMax[2], x0, x3);
|
|
808
|
+
minMax[3] = Math.max(minMax[3], y0, y3);
|
|
746
809
|
__privateMethod(this, _Util_static, getExtremum_fn).call(this, x0, x1, x2, x3, y0, y1, y2, y3, 3 * (-x0 + 3 * (x1 - x2) + x3), 6 * (x0 - 2 * x1 + x2), 3 * (x1 - x0), minMax);
|
|
747
810
|
__privateMethod(this, _Util_static, getExtremum_fn).call(this, x0, x1, x2, x3, y0, y1, y2, y3, 3 * (-y0 + 3 * (y1 - y2) + y3), 6 * (y0 - 2 * y1 + y2), 3 * (y1 - y0), minMax);
|
|
748
|
-
return minMax;
|
|
749
811
|
}
|
|
750
812
|
};
|
|
751
813
|
_Util_static = new WeakSet();
|
|
@@ -943,7 +1005,7 @@ var PDFStringTranslateTable = [
|
|
|
943
1005
|
0,
|
|
944
1006
|
8364
|
|
945
1007
|
];
|
|
946
|
-
function stringToPDFString(str) {
|
|
1008
|
+
function stringToPDFString(str, keepEscapeSequence = false) {
|
|
947
1009
|
if (str[0] >= "\xEF") {
|
|
948
1010
|
let encoding;
|
|
949
1011
|
if (str[0] === "\xFE" && str[1] === "\xFF") {
|
|
@@ -964,7 +1026,7 @@ function stringToPDFString(str) {
|
|
|
964
1026
|
const decoder = new TextDecoder(encoding, { fatal: true });
|
|
965
1027
|
const buffer = stringToBytes(str);
|
|
966
1028
|
const decoded = decoder.decode(buffer);
|
|
967
|
-
if (!decoded.includes("\x1B")) {
|
|
1029
|
+
if (keepEscapeSequence || !decoded.includes("\x1B")) {
|
|
968
1030
|
return decoded;
|
|
969
1031
|
}
|
|
970
1032
|
return decoded.replaceAll(/\x1b[^\x1b]*(?:\x1b|$)/g, "");
|
|
@@ -976,7 +1038,7 @@ function stringToPDFString(str) {
|
|
|
976
1038
|
const strBuf = [];
|
|
977
1039
|
for (let i = 0, ii = str.length; i < ii; i++) {
|
|
978
1040
|
const charCode = str.charCodeAt(i);
|
|
979
|
-
if (charCode === 27) {
|
|
1041
|
+
if (!keepEscapeSequence && charCode === 27) {
|
|
980
1042
|
while (++i < ii && str.charCodeAt(i) !== 27) {
|
|
981
1043
|
}
|
|
982
1044
|
continue;
|
|
@@ -1004,6 +1066,9 @@ function isArrayEqual(arr1, arr2) {
|
|
|
1004
1066
|
return true;
|
|
1005
1067
|
}
|
|
1006
1068
|
function getModificationDate(date = /* @__PURE__ */ new Date()) {
|
|
1069
|
+
if (!(date instanceof Date)) {
|
|
1070
|
+
date = new Date(date);
|
|
1071
|
+
}
|
|
1007
1072
|
const buffer = [
|
|
1008
1073
|
date.getUTCFullYear().toString(),
|
|
1009
1074
|
(date.getUTCMonth() + 1).toString().padStart(2, "0"),
|
|
@@ -1035,6 +1100,56 @@ function getUuid() {
|
|
|
1035
1100
|
return bytesToString(buf);
|
|
1036
1101
|
}
|
|
1037
1102
|
var AnnotationPrefix = "pdfjs_internal_id_";
|
|
1103
|
+
function _isValidExplicitDest(validRef, validName, dest) {
|
|
1104
|
+
if (!Array.isArray(dest) || dest.length < 2) {
|
|
1105
|
+
return false;
|
|
1106
|
+
}
|
|
1107
|
+
const [page, zoom, ...args] = dest;
|
|
1108
|
+
if (!validRef(page) && !Number.isInteger(page)) {
|
|
1109
|
+
return false;
|
|
1110
|
+
}
|
|
1111
|
+
if (!validName(zoom)) {
|
|
1112
|
+
return false;
|
|
1113
|
+
}
|
|
1114
|
+
const argsLen = args.length;
|
|
1115
|
+
let allowNull = true;
|
|
1116
|
+
switch (zoom.name) {
|
|
1117
|
+
case "XYZ":
|
|
1118
|
+
if (argsLen < 2 || argsLen > 3) {
|
|
1119
|
+
return false;
|
|
1120
|
+
}
|
|
1121
|
+
break;
|
|
1122
|
+
case "Fit":
|
|
1123
|
+
case "FitB":
|
|
1124
|
+
return argsLen === 0;
|
|
1125
|
+
case "FitH":
|
|
1126
|
+
case "FitBH":
|
|
1127
|
+
case "FitV":
|
|
1128
|
+
case "FitBV":
|
|
1129
|
+
if (argsLen > 1) {
|
|
1130
|
+
return false;
|
|
1131
|
+
}
|
|
1132
|
+
break;
|
|
1133
|
+
case "FitR":
|
|
1134
|
+
if (argsLen !== 4) {
|
|
1135
|
+
return false;
|
|
1136
|
+
}
|
|
1137
|
+
allowNull = false;
|
|
1138
|
+
break;
|
|
1139
|
+
default:
|
|
1140
|
+
return false;
|
|
1141
|
+
}
|
|
1142
|
+
for (const arg of args) {
|
|
1143
|
+
if (typeof arg === "number" || allowNull && arg === null) {
|
|
1144
|
+
continue;
|
|
1145
|
+
}
|
|
1146
|
+
return false;
|
|
1147
|
+
}
|
|
1148
|
+
return true;
|
|
1149
|
+
}
|
|
1150
|
+
function MathClamp(v, min, max) {
|
|
1151
|
+
return Math.min(Math.max(v, min), max);
|
|
1152
|
+
}
|
|
1038
1153
|
function toHexUtil(arr) {
|
|
1039
1154
|
if (Uint8Array.prototype.toHex) {
|
|
1040
1155
|
return arr.toHex();
|
|
@@ -1060,6 +1175,34 @@ if (false) {
|
|
|
1060
1175
|
});
|
|
1061
1176
|
};
|
|
1062
1177
|
}
|
|
1178
|
+
if (typeof Math.sumPrecise !== "function") {
|
|
1179
|
+
Math.sumPrecise = function(numbers) {
|
|
1180
|
+
return numbers.reduce((a, b) => a + b, 0);
|
|
1181
|
+
};
|
|
1182
|
+
}
|
|
1183
|
+
if (false) {
|
|
1184
|
+
AbortSignal.any = function(iterable) {
|
|
1185
|
+
const ac = new AbortController();
|
|
1186
|
+
const { signal } = ac;
|
|
1187
|
+
for (const s of iterable) {
|
|
1188
|
+
if (s.aborted) {
|
|
1189
|
+
ac.abort(s.reason);
|
|
1190
|
+
return signal;
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
for (const s of iterable) {
|
|
1194
|
+
s.addEventListener(
|
|
1195
|
+
"abort",
|
|
1196
|
+
() => {
|
|
1197
|
+
ac.abort(s.reason);
|
|
1198
|
+
},
|
|
1199
|
+
{ signal }
|
|
1200
|
+
// Automatically remove the listener.
|
|
1201
|
+
);
|
|
1202
|
+
}
|
|
1203
|
+
return signal;
|
|
1204
|
+
};
|
|
1205
|
+
}
|
|
1063
1206
|
|
|
1064
1207
|
// src/pdf.js/src/shared/message_handler.js
|
|
1065
1208
|
var CallbackKind = {
|
|
@@ -1516,6 +1659,607 @@ deleteStreamController_fn = async function(streamController, streamId) {
|
|
|
1516
1659
|
delete this.streamControllers[streamId];
|
|
1517
1660
|
};
|
|
1518
1661
|
|
|
1662
|
+
// src/pdf.js/src/shared/obj-bin-transform.js
|
|
1663
|
+
var _buffer, _view, _decoder, _CssFontInfo_instances, readString_fn;
|
|
1664
|
+
var _CssFontInfo = class _CssFontInfo {
|
|
1665
|
+
constructor(buffer) {
|
|
1666
|
+
__privateAdd(this, _CssFontInfo_instances);
|
|
1667
|
+
__privateAdd(this, _buffer);
|
|
1668
|
+
__privateAdd(this, _view);
|
|
1669
|
+
__privateAdd(this, _decoder);
|
|
1670
|
+
__privateSet(this, _buffer, buffer);
|
|
1671
|
+
__privateSet(this, _view, new DataView(__privateGet(this, _buffer)));
|
|
1672
|
+
__privateSet(this, _decoder, new TextDecoder());
|
|
1673
|
+
}
|
|
1674
|
+
static write(info2) {
|
|
1675
|
+
const encoder = new TextEncoder();
|
|
1676
|
+
const encodedStrings = {};
|
|
1677
|
+
let stringsLength = 0;
|
|
1678
|
+
for (const prop of _CssFontInfo.strings) {
|
|
1679
|
+
const encoded = encoder.encode(info2[prop]);
|
|
1680
|
+
encodedStrings[prop] = encoded;
|
|
1681
|
+
stringsLength += 4 + encoded.length;
|
|
1682
|
+
}
|
|
1683
|
+
const buffer = new ArrayBuffer(stringsLength);
|
|
1684
|
+
const data = new Uint8Array(buffer);
|
|
1685
|
+
const view = new DataView(buffer);
|
|
1686
|
+
let offset = 0;
|
|
1687
|
+
for (const prop of _CssFontInfo.strings) {
|
|
1688
|
+
const encoded = encodedStrings[prop];
|
|
1689
|
+
const length = encoded.length;
|
|
1690
|
+
view.setUint32(offset, length);
|
|
1691
|
+
data.set(encoded, offset + 4);
|
|
1692
|
+
offset += 4 + length;
|
|
1693
|
+
}
|
|
1694
|
+
assert(offset === buffer.byteLength, "CssFontInfo.write: Buffer overflow");
|
|
1695
|
+
return buffer;
|
|
1696
|
+
}
|
|
1697
|
+
get fontFamily() {
|
|
1698
|
+
return __privateMethod(this, _CssFontInfo_instances, readString_fn).call(this, 0);
|
|
1699
|
+
}
|
|
1700
|
+
get fontWeight() {
|
|
1701
|
+
return __privateMethod(this, _CssFontInfo_instances, readString_fn).call(this, 1);
|
|
1702
|
+
}
|
|
1703
|
+
get italicAngle() {
|
|
1704
|
+
return __privateMethod(this, _CssFontInfo_instances, readString_fn).call(this, 2);
|
|
1705
|
+
}
|
|
1706
|
+
};
|
|
1707
|
+
_buffer = new WeakMap();
|
|
1708
|
+
_view = new WeakMap();
|
|
1709
|
+
_decoder = new WeakMap();
|
|
1710
|
+
_CssFontInfo_instances = new WeakSet();
|
|
1711
|
+
readString_fn = function(index) {
|
|
1712
|
+
assert(index < _CssFontInfo.strings.length, "Invalid string index");
|
|
1713
|
+
let offset = 0;
|
|
1714
|
+
for (let i = 0; i < index; i++) {
|
|
1715
|
+
offset += __privateGet(this, _view).getUint32(offset) + 4;
|
|
1716
|
+
}
|
|
1717
|
+
const length = __privateGet(this, _view).getUint32(offset);
|
|
1718
|
+
return __privateGet(this, _decoder).decode(
|
|
1719
|
+
new Uint8Array(__privateGet(this, _buffer), offset + 4, length)
|
|
1720
|
+
);
|
|
1721
|
+
};
|
|
1722
|
+
__publicField(_CssFontInfo, "strings", ["fontFamily", "fontWeight", "italicAngle"]);
|
|
1723
|
+
var CssFontInfo = _CssFontInfo;
|
|
1724
|
+
var _buffer2, _view2, _decoder2, _SystemFontInfo_instances, readString_fn2;
|
|
1725
|
+
var _SystemFontInfo = class _SystemFontInfo {
|
|
1726
|
+
constructor(buffer) {
|
|
1727
|
+
__privateAdd(this, _SystemFontInfo_instances);
|
|
1728
|
+
__privateAdd(this, _buffer2);
|
|
1729
|
+
__privateAdd(this, _view2);
|
|
1730
|
+
__privateAdd(this, _decoder2);
|
|
1731
|
+
__privateSet(this, _buffer2, buffer);
|
|
1732
|
+
__privateSet(this, _view2, new DataView(__privateGet(this, _buffer2)));
|
|
1733
|
+
__privateSet(this, _decoder2, new TextDecoder());
|
|
1734
|
+
}
|
|
1735
|
+
static write(info2) {
|
|
1736
|
+
const encoder = new TextEncoder();
|
|
1737
|
+
const encodedStrings = {};
|
|
1738
|
+
let stringsLength = 0;
|
|
1739
|
+
for (const prop of _SystemFontInfo.strings) {
|
|
1740
|
+
const encoded = encoder.encode(info2[prop]);
|
|
1741
|
+
encodedStrings[prop] = encoded;
|
|
1742
|
+
stringsLength += 4 + encoded.length;
|
|
1743
|
+
}
|
|
1744
|
+
stringsLength += 4;
|
|
1745
|
+
let encodedStyleStyle, encodedStyleWeight, lengthEstimate = 1 + stringsLength;
|
|
1746
|
+
if (info2.style) {
|
|
1747
|
+
encodedStyleStyle = encoder.encode(info2.style.style);
|
|
1748
|
+
encodedStyleWeight = encoder.encode(info2.style.weight);
|
|
1749
|
+
lengthEstimate += 4 + encodedStyleStyle.length + 4 + encodedStyleWeight.length;
|
|
1750
|
+
}
|
|
1751
|
+
const buffer = new ArrayBuffer(lengthEstimate);
|
|
1752
|
+
const data = new Uint8Array(buffer);
|
|
1753
|
+
const view = new DataView(buffer);
|
|
1754
|
+
let offset = 0;
|
|
1755
|
+
view.setUint8(offset++, info2.guessFallback ? 1 : 0);
|
|
1756
|
+
view.setUint32(offset, 0);
|
|
1757
|
+
offset += 4;
|
|
1758
|
+
stringsLength = 0;
|
|
1759
|
+
for (const prop of _SystemFontInfo.strings) {
|
|
1760
|
+
const encoded = encodedStrings[prop];
|
|
1761
|
+
const length = encoded.length;
|
|
1762
|
+
stringsLength += 4 + length;
|
|
1763
|
+
view.setUint32(offset, length);
|
|
1764
|
+
data.set(encoded, offset + 4);
|
|
1765
|
+
offset += 4 + length;
|
|
1766
|
+
}
|
|
1767
|
+
view.setUint32(offset - stringsLength - 4, stringsLength);
|
|
1768
|
+
if (info2.style) {
|
|
1769
|
+
view.setUint32(offset, encodedStyleStyle.length);
|
|
1770
|
+
data.set(encodedStyleStyle, offset + 4);
|
|
1771
|
+
offset += 4 + encodedStyleStyle.length;
|
|
1772
|
+
view.setUint32(offset, encodedStyleWeight.length);
|
|
1773
|
+
data.set(encodedStyleWeight, offset + 4);
|
|
1774
|
+
offset += 4 + encodedStyleWeight.length;
|
|
1775
|
+
}
|
|
1776
|
+
assert(
|
|
1777
|
+
offset <= buffer.byteLength,
|
|
1778
|
+
"SubstitionInfo.write: Buffer overflow"
|
|
1779
|
+
);
|
|
1780
|
+
return buffer.transferToFixedLength(offset);
|
|
1781
|
+
}
|
|
1782
|
+
get guessFallback() {
|
|
1783
|
+
return __privateGet(this, _view2).getUint8(0) !== 0;
|
|
1784
|
+
}
|
|
1785
|
+
get css() {
|
|
1786
|
+
return __privateMethod(this, _SystemFontInfo_instances, readString_fn2).call(this, 0);
|
|
1787
|
+
}
|
|
1788
|
+
get loadedName() {
|
|
1789
|
+
return __privateMethod(this, _SystemFontInfo_instances, readString_fn2).call(this, 1);
|
|
1790
|
+
}
|
|
1791
|
+
get baseFontName() {
|
|
1792
|
+
return __privateMethod(this, _SystemFontInfo_instances, readString_fn2).call(this, 2);
|
|
1793
|
+
}
|
|
1794
|
+
get src() {
|
|
1795
|
+
return __privateMethod(this, _SystemFontInfo_instances, readString_fn2).call(this, 3);
|
|
1796
|
+
}
|
|
1797
|
+
get style() {
|
|
1798
|
+
let offset = 1;
|
|
1799
|
+
offset += 4 + __privateGet(this, _view2).getUint32(offset);
|
|
1800
|
+
const styleLength = __privateGet(this, _view2).getUint32(offset);
|
|
1801
|
+
const style = __privateGet(this, _decoder2).decode(
|
|
1802
|
+
new Uint8Array(__privateGet(this, _buffer2), offset + 4, styleLength)
|
|
1803
|
+
);
|
|
1804
|
+
offset += 4 + styleLength;
|
|
1805
|
+
const weightLength = __privateGet(this, _view2).getUint32(offset);
|
|
1806
|
+
const weight = __privateGet(this, _decoder2).decode(
|
|
1807
|
+
new Uint8Array(__privateGet(this, _buffer2), offset + 4, weightLength)
|
|
1808
|
+
);
|
|
1809
|
+
return { style, weight };
|
|
1810
|
+
}
|
|
1811
|
+
};
|
|
1812
|
+
_buffer2 = new WeakMap();
|
|
1813
|
+
_view2 = new WeakMap();
|
|
1814
|
+
_decoder2 = new WeakMap();
|
|
1815
|
+
_SystemFontInfo_instances = new WeakSet();
|
|
1816
|
+
readString_fn2 = function(index) {
|
|
1817
|
+
assert(index < _SystemFontInfo.strings.length, "Invalid string index");
|
|
1818
|
+
let offset = 5;
|
|
1819
|
+
for (let i = 0; i < index; i++) {
|
|
1820
|
+
offset += __privateGet(this, _view2).getUint32(offset) + 4;
|
|
1821
|
+
}
|
|
1822
|
+
const length = __privateGet(this, _view2).getUint32(offset);
|
|
1823
|
+
return __privateGet(this, _decoder2).decode(
|
|
1824
|
+
new Uint8Array(__privateGet(this, _buffer2), offset + 4, length)
|
|
1825
|
+
);
|
|
1826
|
+
};
|
|
1827
|
+
__publicField(_SystemFontInfo, "strings", ["css", "loadedName", "baseFontName", "src"]);
|
|
1828
|
+
var SystemFontInfo = _SystemFontInfo;
|
|
1829
|
+
var _OFFSET_NUMBERS, _OFFSET_BBOX, _OFFSET_FONT_MATRIX, _OFFSET_DEFAULT_VMETRICS, _OFFSET_STRINGS, _buffer3, _decoder3, _view3, _FontInfo_instances, readBoolean_fn, readNumber_fn, readString_fn3;
|
|
1830
|
+
var _FontInfo = class _FontInfo {
|
|
1831
|
+
constructor({ data, extra }) {
|
|
1832
|
+
__privateAdd(this, _FontInfo_instances);
|
|
1833
|
+
__privateAdd(this, _buffer3);
|
|
1834
|
+
__privateAdd(this, _decoder3);
|
|
1835
|
+
__privateAdd(this, _view3);
|
|
1836
|
+
__privateSet(this, _buffer3, data);
|
|
1837
|
+
__privateSet(this, _decoder3, new TextDecoder());
|
|
1838
|
+
__privateSet(this, _view3, new DataView(__privateGet(this, _buffer3)));
|
|
1839
|
+
if (extra) {
|
|
1840
|
+
Object.assign(this, extra);
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
get black() {
|
|
1844
|
+
return __privateMethod(this, _FontInfo_instances, readBoolean_fn).call(this, 0);
|
|
1845
|
+
}
|
|
1846
|
+
get bold() {
|
|
1847
|
+
return __privateMethod(this, _FontInfo_instances, readBoolean_fn).call(this, 1);
|
|
1848
|
+
}
|
|
1849
|
+
get disableFontFace() {
|
|
1850
|
+
return __privateMethod(this, _FontInfo_instances, readBoolean_fn).call(this, 2);
|
|
1851
|
+
}
|
|
1852
|
+
get fontExtraProperties() {
|
|
1853
|
+
return __privateMethod(this, _FontInfo_instances, readBoolean_fn).call(this, 3);
|
|
1854
|
+
}
|
|
1855
|
+
get isInvalidPDFjsFont() {
|
|
1856
|
+
return __privateMethod(this, _FontInfo_instances, readBoolean_fn).call(this, 4);
|
|
1857
|
+
}
|
|
1858
|
+
get isType3Font() {
|
|
1859
|
+
return __privateMethod(this, _FontInfo_instances, readBoolean_fn).call(this, 5);
|
|
1860
|
+
}
|
|
1861
|
+
get italic() {
|
|
1862
|
+
return __privateMethod(this, _FontInfo_instances, readBoolean_fn).call(this, 6);
|
|
1863
|
+
}
|
|
1864
|
+
get missingFile() {
|
|
1865
|
+
return __privateMethod(this, _FontInfo_instances, readBoolean_fn).call(this, 7);
|
|
1866
|
+
}
|
|
1867
|
+
get remeasure() {
|
|
1868
|
+
return __privateMethod(this, _FontInfo_instances, readBoolean_fn).call(this, 8);
|
|
1869
|
+
}
|
|
1870
|
+
get vertical() {
|
|
1871
|
+
return __privateMethod(this, _FontInfo_instances, readBoolean_fn).call(this, 9);
|
|
1872
|
+
}
|
|
1873
|
+
get ascent() {
|
|
1874
|
+
return __privateMethod(this, _FontInfo_instances, readNumber_fn).call(this, 0);
|
|
1875
|
+
}
|
|
1876
|
+
get defaultWidth() {
|
|
1877
|
+
return __privateMethod(this, _FontInfo_instances, readNumber_fn).call(this, 1);
|
|
1878
|
+
}
|
|
1879
|
+
get descent() {
|
|
1880
|
+
return __privateMethod(this, _FontInfo_instances, readNumber_fn).call(this, 2);
|
|
1881
|
+
}
|
|
1882
|
+
get bbox() {
|
|
1883
|
+
let offset = __privateGet(_FontInfo, _OFFSET_BBOX);
|
|
1884
|
+
const numCoords = __privateGet(this, _view3).getUint8(offset);
|
|
1885
|
+
if (numCoords === 0) {
|
|
1886
|
+
return void 0;
|
|
1887
|
+
}
|
|
1888
|
+
offset += 1;
|
|
1889
|
+
const bbox = [];
|
|
1890
|
+
for (let i = 0; i < 4; i++) {
|
|
1891
|
+
bbox.push(__privateGet(this, _view3).getInt16(offset, true));
|
|
1892
|
+
offset += 2;
|
|
1893
|
+
}
|
|
1894
|
+
return bbox;
|
|
1895
|
+
}
|
|
1896
|
+
get fontMatrix() {
|
|
1897
|
+
let offset = __privateGet(_FontInfo, _OFFSET_FONT_MATRIX);
|
|
1898
|
+
const numPoints = __privateGet(this, _view3).getUint8(offset);
|
|
1899
|
+
if (numPoints === 0) {
|
|
1900
|
+
return void 0;
|
|
1901
|
+
}
|
|
1902
|
+
offset += 1;
|
|
1903
|
+
const fontMatrix = [];
|
|
1904
|
+
for (let i = 0; i < 6; i++) {
|
|
1905
|
+
fontMatrix.push(__privateGet(this, _view3).getFloat64(offset, true));
|
|
1906
|
+
offset += 8;
|
|
1907
|
+
}
|
|
1908
|
+
return fontMatrix;
|
|
1909
|
+
}
|
|
1910
|
+
get defaultVMetrics() {
|
|
1911
|
+
let offset = __privateGet(_FontInfo, _OFFSET_DEFAULT_VMETRICS);
|
|
1912
|
+
const numMetrics = __privateGet(this, _view3).getUint8(offset);
|
|
1913
|
+
if (numMetrics === 0) {
|
|
1914
|
+
return void 0;
|
|
1915
|
+
}
|
|
1916
|
+
offset += 1;
|
|
1917
|
+
const defaultVMetrics = [];
|
|
1918
|
+
for (let i = 0; i < 3; i++) {
|
|
1919
|
+
defaultVMetrics.push(__privateGet(this, _view3).getInt16(offset, true));
|
|
1920
|
+
offset += 2;
|
|
1921
|
+
}
|
|
1922
|
+
return defaultVMetrics;
|
|
1923
|
+
}
|
|
1924
|
+
get fallbackName() {
|
|
1925
|
+
return __privateMethod(this, _FontInfo_instances, readString_fn3).call(this, 0);
|
|
1926
|
+
}
|
|
1927
|
+
get loadedName() {
|
|
1928
|
+
return __privateMethod(this, _FontInfo_instances, readString_fn3).call(this, 1);
|
|
1929
|
+
}
|
|
1930
|
+
get mimetype() {
|
|
1931
|
+
return __privateMethod(this, _FontInfo_instances, readString_fn3).call(this, 2);
|
|
1932
|
+
}
|
|
1933
|
+
get name() {
|
|
1934
|
+
return __privateMethod(this, _FontInfo_instances, readString_fn3).call(this, 3);
|
|
1935
|
+
}
|
|
1936
|
+
get data() {
|
|
1937
|
+
let offset = __privateGet(_FontInfo, _OFFSET_STRINGS);
|
|
1938
|
+
const stringsLength = __privateGet(this, _view3).getUint32(offset);
|
|
1939
|
+
offset += 4 + stringsLength;
|
|
1940
|
+
const systemFontInfoLength = __privateGet(this, _view3).getUint32(offset);
|
|
1941
|
+
offset += 4 + systemFontInfoLength;
|
|
1942
|
+
const cssFontInfoLength = __privateGet(this, _view3).getUint32(offset);
|
|
1943
|
+
offset += 4 + cssFontInfoLength;
|
|
1944
|
+
const length = __privateGet(this, _view3).getUint32(offset);
|
|
1945
|
+
if (length === 0) {
|
|
1946
|
+
return void 0;
|
|
1947
|
+
}
|
|
1948
|
+
return new Uint8Array(__privateGet(this, _buffer3), offset + 4, length);
|
|
1949
|
+
}
|
|
1950
|
+
clearData() {
|
|
1951
|
+
let offset = __privateGet(_FontInfo, _OFFSET_STRINGS);
|
|
1952
|
+
const stringsLength = __privateGet(this, _view3).getUint32(offset);
|
|
1953
|
+
offset += 4 + stringsLength;
|
|
1954
|
+
const systemFontInfoLength = __privateGet(this, _view3).getUint32(offset);
|
|
1955
|
+
offset += 4 + systemFontInfoLength;
|
|
1956
|
+
const cssFontInfoLength = __privateGet(this, _view3).getUint32(offset);
|
|
1957
|
+
offset += 4 + cssFontInfoLength;
|
|
1958
|
+
const length = __privateGet(this, _view3).getUint32(offset);
|
|
1959
|
+
const data = new Uint8Array(__privateGet(this, _buffer3), offset + 4, length);
|
|
1960
|
+
data.fill(0);
|
|
1961
|
+
__privateGet(this, _view3).setUint32(offset, 0);
|
|
1962
|
+
}
|
|
1963
|
+
get cssFontInfo() {
|
|
1964
|
+
let offset = __privateGet(_FontInfo, _OFFSET_STRINGS);
|
|
1965
|
+
const stringsLength = __privateGet(this, _view3).getUint32(offset);
|
|
1966
|
+
offset += 4 + stringsLength;
|
|
1967
|
+
const systemFontInfoLength = __privateGet(this, _view3).getUint32(offset);
|
|
1968
|
+
offset += 4 + systemFontInfoLength;
|
|
1969
|
+
const cssFontInfoLength = __privateGet(this, _view3).getUint32(offset);
|
|
1970
|
+
if (cssFontInfoLength === 0) {
|
|
1971
|
+
return null;
|
|
1972
|
+
}
|
|
1973
|
+
const cssFontInfoData = new Uint8Array(cssFontInfoLength);
|
|
1974
|
+
cssFontInfoData.set(
|
|
1975
|
+
new Uint8Array(__privateGet(this, _buffer3), offset + 4, cssFontInfoLength)
|
|
1976
|
+
);
|
|
1977
|
+
return new CssFontInfo(cssFontInfoData.buffer);
|
|
1978
|
+
}
|
|
1979
|
+
get systemFontInfo() {
|
|
1980
|
+
let offset = __privateGet(_FontInfo, _OFFSET_STRINGS);
|
|
1981
|
+
const stringsLength = __privateGet(this, _view3).getUint32(offset);
|
|
1982
|
+
offset += 4 + stringsLength;
|
|
1983
|
+
const systemFontInfoLength = __privateGet(this, _view3).getUint32(offset);
|
|
1984
|
+
if (systemFontInfoLength === 0) {
|
|
1985
|
+
return null;
|
|
1986
|
+
}
|
|
1987
|
+
const systemFontInfoData = new Uint8Array(systemFontInfoLength);
|
|
1988
|
+
systemFontInfoData.set(
|
|
1989
|
+
new Uint8Array(__privateGet(this, _buffer3), offset + 4, systemFontInfoLength)
|
|
1990
|
+
);
|
|
1991
|
+
return new SystemFontInfo(systemFontInfoData.buffer);
|
|
1992
|
+
}
|
|
1993
|
+
static write(font) {
|
|
1994
|
+
const systemFontInfoBuffer = font.systemFontInfo ? SystemFontInfo.write(font.systemFontInfo) : null;
|
|
1995
|
+
const cssFontInfoBuffer = font.cssFontInfo ? CssFontInfo.write(font.cssFontInfo) : null;
|
|
1996
|
+
const encoder = new TextEncoder();
|
|
1997
|
+
const encodedStrings = {};
|
|
1998
|
+
let stringsLength = 0;
|
|
1999
|
+
for (const prop of _FontInfo.strings) {
|
|
2000
|
+
encodedStrings[prop] = encoder.encode(font[prop]);
|
|
2001
|
+
stringsLength += 4 + encodedStrings[prop].length;
|
|
2002
|
+
}
|
|
2003
|
+
const lengthEstimate = __privateGet(_FontInfo, _OFFSET_STRINGS) + 4 + stringsLength + 4 + (systemFontInfoBuffer ? systemFontInfoBuffer.byteLength : 0) + 4 + (cssFontInfoBuffer ? cssFontInfoBuffer.byteLength : 0) + 4 + (font.data ? font.data.length : 0);
|
|
2004
|
+
const buffer = new ArrayBuffer(lengthEstimate);
|
|
2005
|
+
const data = new Uint8Array(buffer);
|
|
2006
|
+
const view = new DataView(buffer);
|
|
2007
|
+
let offset = 0;
|
|
2008
|
+
const numBools = _FontInfo.bools.length;
|
|
2009
|
+
let boolByte = 0, boolBit = 0;
|
|
2010
|
+
for (let i = 0; i < numBools; i++) {
|
|
2011
|
+
const value = font[_FontInfo.bools[i]];
|
|
2012
|
+
const bits = value === void 0 ? 0 : value ? 2 : 1;
|
|
2013
|
+
boolByte |= bits << boolBit;
|
|
2014
|
+
boolBit += 2;
|
|
2015
|
+
if (boolBit === 8 || i === numBools - 1) {
|
|
2016
|
+
view.setUint8(offset++, boolByte);
|
|
2017
|
+
boolByte = 0;
|
|
2018
|
+
boolBit = 0;
|
|
2019
|
+
}
|
|
2020
|
+
}
|
|
2021
|
+
assert(
|
|
2022
|
+
offset === __privateGet(_FontInfo, _OFFSET_NUMBERS),
|
|
2023
|
+
"FontInfo.write: Boolean properties offset mismatch"
|
|
2024
|
+
);
|
|
2025
|
+
for (const prop of _FontInfo.numbers) {
|
|
2026
|
+
view.setFloat64(offset, font[prop]);
|
|
2027
|
+
offset += 8;
|
|
2028
|
+
}
|
|
2029
|
+
assert(
|
|
2030
|
+
offset === __privateGet(_FontInfo, _OFFSET_BBOX),
|
|
2031
|
+
"FontInfo.write: Number properties offset mismatch"
|
|
2032
|
+
);
|
|
2033
|
+
if (font.bbox) {
|
|
2034
|
+
view.setUint8(offset++, 4);
|
|
2035
|
+
for (const coord of font.bbox) {
|
|
2036
|
+
view.setInt16(offset, coord, true);
|
|
2037
|
+
offset += 2;
|
|
2038
|
+
}
|
|
2039
|
+
} else {
|
|
2040
|
+
view.setUint8(offset++, 0);
|
|
2041
|
+
offset += 2 * 4;
|
|
2042
|
+
}
|
|
2043
|
+
assert(
|
|
2044
|
+
offset === __privateGet(_FontInfo, _OFFSET_FONT_MATRIX),
|
|
2045
|
+
"FontInfo.write: BBox properties offset mismatch"
|
|
2046
|
+
);
|
|
2047
|
+
if (font.fontMatrix) {
|
|
2048
|
+
view.setUint8(offset++, 6);
|
|
2049
|
+
for (const point of font.fontMatrix) {
|
|
2050
|
+
view.setFloat64(offset, point, true);
|
|
2051
|
+
offset += 8;
|
|
2052
|
+
}
|
|
2053
|
+
} else {
|
|
2054
|
+
view.setUint8(offset++, 0);
|
|
2055
|
+
offset += 8 * 6;
|
|
2056
|
+
}
|
|
2057
|
+
assert(
|
|
2058
|
+
offset === __privateGet(_FontInfo, _OFFSET_DEFAULT_VMETRICS),
|
|
2059
|
+
"FontInfo.write: FontMatrix properties offset mismatch"
|
|
2060
|
+
);
|
|
2061
|
+
if (font.defaultVMetrics) {
|
|
2062
|
+
view.setUint8(offset++, 1);
|
|
2063
|
+
for (const metric of font.defaultVMetrics) {
|
|
2064
|
+
view.setInt16(offset, metric, true);
|
|
2065
|
+
offset += 2;
|
|
2066
|
+
}
|
|
2067
|
+
} else {
|
|
2068
|
+
view.setUint8(offset++, 0);
|
|
2069
|
+
offset += 3 * 2;
|
|
2070
|
+
}
|
|
2071
|
+
assert(
|
|
2072
|
+
offset === __privateGet(_FontInfo, _OFFSET_STRINGS),
|
|
2073
|
+
"FontInfo.write: DefaultVMetrics properties offset mismatch"
|
|
2074
|
+
);
|
|
2075
|
+
view.setUint32(__privateGet(_FontInfo, _OFFSET_STRINGS), 0);
|
|
2076
|
+
offset += 4;
|
|
2077
|
+
for (const prop of _FontInfo.strings) {
|
|
2078
|
+
const encoded = encodedStrings[prop];
|
|
2079
|
+
const length = encoded.length;
|
|
2080
|
+
view.setUint32(offset, length);
|
|
2081
|
+
data.set(encoded, offset + 4);
|
|
2082
|
+
offset += 4 + length;
|
|
2083
|
+
}
|
|
2084
|
+
view.setUint32(
|
|
2085
|
+
__privateGet(_FontInfo, _OFFSET_STRINGS),
|
|
2086
|
+
offset - __privateGet(_FontInfo, _OFFSET_STRINGS) - 4
|
|
2087
|
+
);
|
|
2088
|
+
if (!systemFontInfoBuffer) {
|
|
2089
|
+
view.setUint32(offset, 0);
|
|
2090
|
+
offset += 4;
|
|
2091
|
+
} else {
|
|
2092
|
+
const length = systemFontInfoBuffer.byteLength;
|
|
2093
|
+
view.setUint32(offset, length);
|
|
2094
|
+
assert(
|
|
2095
|
+
offset + 4 + length <= buffer.byteLength,
|
|
2096
|
+
"FontInfo.write: Buffer overflow at systemFontInfo"
|
|
2097
|
+
);
|
|
2098
|
+
data.set(new Uint8Array(systemFontInfoBuffer), offset + 4);
|
|
2099
|
+
offset += 4 + length;
|
|
2100
|
+
}
|
|
2101
|
+
if (!cssFontInfoBuffer) {
|
|
2102
|
+
view.setUint32(offset, 0);
|
|
2103
|
+
offset += 4;
|
|
2104
|
+
} else {
|
|
2105
|
+
const length = cssFontInfoBuffer.byteLength;
|
|
2106
|
+
view.setUint32(offset, length);
|
|
2107
|
+
assert(
|
|
2108
|
+
offset + 4 + length <= buffer.byteLength,
|
|
2109
|
+
"FontInfo.write: Buffer overflow at cssFontInfo"
|
|
2110
|
+
);
|
|
2111
|
+
data.set(new Uint8Array(cssFontInfoBuffer), offset + 4);
|
|
2112
|
+
offset += 4 + length;
|
|
2113
|
+
}
|
|
2114
|
+
if (font.data === void 0) {
|
|
2115
|
+
view.setUint32(offset, 0);
|
|
2116
|
+
offset += 4;
|
|
2117
|
+
} else {
|
|
2118
|
+
view.setUint32(offset, font.data.length);
|
|
2119
|
+
data.set(font.data, offset + 4);
|
|
2120
|
+
offset += 4 + font.data.length;
|
|
2121
|
+
}
|
|
2122
|
+
assert(offset <= buffer.byteLength, "FontInfo.write: Buffer overflow");
|
|
2123
|
+
return buffer.transferToFixedLength(offset);
|
|
2124
|
+
}
|
|
2125
|
+
};
|
|
2126
|
+
_OFFSET_NUMBERS = new WeakMap();
|
|
2127
|
+
_OFFSET_BBOX = new WeakMap();
|
|
2128
|
+
_OFFSET_FONT_MATRIX = new WeakMap();
|
|
2129
|
+
_OFFSET_DEFAULT_VMETRICS = new WeakMap();
|
|
2130
|
+
_OFFSET_STRINGS = new WeakMap();
|
|
2131
|
+
_buffer3 = new WeakMap();
|
|
2132
|
+
_decoder3 = new WeakMap();
|
|
2133
|
+
_view3 = new WeakMap();
|
|
2134
|
+
_FontInfo_instances = new WeakSet();
|
|
2135
|
+
readBoolean_fn = function(index) {
|
|
2136
|
+
assert(index < _FontInfo.bools.length, "Invalid boolean index");
|
|
2137
|
+
const byteOffset = Math.floor(index / 4);
|
|
2138
|
+
const bitOffset = index * 2 % 8;
|
|
2139
|
+
const value = __privateGet(this, _view3).getUint8(byteOffset) >> bitOffset & 3;
|
|
2140
|
+
return value === 0 ? void 0 : value === 2;
|
|
2141
|
+
};
|
|
2142
|
+
readNumber_fn = function(index) {
|
|
2143
|
+
assert(index < _FontInfo.numbers.length, "Invalid number index");
|
|
2144
|
+
return __privateGet(this, _view3).getFloat64(__privateGet(_FontInfo, _OFFSET_NUMBERS) + index * 8);
|
|
2145
|
+
};
|
|
2146
|
+
readString_fn3 = function(index) {
|
|
2147
|
+
assert(index < _FontInfo.strings.length, "Invalid string index");
|
|
2148
|
+
let offset = __privateGet(_FontInfo, _OFFSET_STRINGS) + 4;
|
|
2149
|
+
for (let i = 0; i < index; i++) {
|
|
2150
|
+
offset += __privateGet(this, _view3).getUint32(offset) + 4;
|
|
2151
|
+
}
|
|
2152
|
+
const length = __privateGet(this, _view3).getUint32(offset);
|
|
2153
|
+
const stringData = new Uint8Array(length);
|
|
2154
|
+
stringData.set(new Uint8Array(__privateGet(this, _buffer3), offset + 4, length));
|
|
2155
|
+
return __privateGet(this, _decoder3).decode(stringData);
|
|
2156
|
+
};
|
|
2157
|
+
__publicField(_FontInfo, "bools", [
|
|
2158
|
+
"black",
|
|
2159
|
+
"bold",
|
|
2160
|
+
"disableFontFace",
|
|
2161
|
+
"fontExtraProperties",
|
|
2162
|
+
"isInvalidPDFjsFont",
|
|
2163
|
+
"isType3Font",
|
|
2164
|
+
"italic",
|
|
2165
|
+
"missingFile",
|
|
2166
|
+
"remeasure",
|
|
2167
|
+
"vertical"
|
|
2168
|
+
]);
|
|
2169
|
+
__publicField(_FontInfo, "numbers", ["ascent", "defaultWidth", "descent"]);
|
|
2170
|
+
__publicField(_FontInfo, "strings", ["fallbackName", "loadedName", "mimetype", "name"]);
|
|
2171
|
+
__privateAdd(_FontInfo, _OFFSET_NUMBERS, Math.ceil(_FontInfo.bools.length * 2 / 8));
|
|
2172
|
+
__privateAdd(_FontInfo, _OFFSET_BBOX, __privateGet(_FontInfo, _OFFSET_NUMBERS) + _FontInfo.numbers.length * 8);
|
|
2173
|
+
__privateAdd(_FontInfo, _OFFSET_FONT_MATRIX, __privateGet(_FontInfo, _OFFSET_BBOX) + 1 + 2 * 4);
|
|
2174
|
+
__privateAdd(_FontInfo, _OFFSET_DEFAULT_VMETRICS, __privateGet(_FontInfo, _OFFSET_FONT_MATRIX) + 1 + 8 * 6);
|
|
2175
|
+
__privateAdd(_FontInfo, _OFFSET_STRINGS, __privateGet(_FontInfo, _OFFSET_DEFAULT_VMETRICS) + 1 + 2 * 3);
|
|
2176
|
+
var FontInfo = _FontInfo;
|
|
2177
|
+
|
|
2178
|
+
// src/pdf.js/src/shared/scripting_utils.js
|
|
2179
|
+
function makeColorComp(n) {
|
|
2180
|
+
return Math.floor(Math.max(0, Math.min(1, n)) * 255).toString(16).padStart(2, "0");
|
|
2181
|
+
}
|
|
2182
|
+
function scaleAndClamp(x) {
|
|
2183
|
+
return Math.max(0, Math.min(255, 255 * x));
|
|
2184
|
+
}
|
|
2185
|
+
var ColorConverters = class {
|
|
2186
|
+
static CMYK_G([c, y, m, k]) {
|
|
2187
|
+
return ["G", 1 - Math.min(1, 0.3 * c + 0.59 * m + 0.11 * y + k)];
|
|
2188
|
+
}
|
|
2189
|
+
static G_CMYK([g]) {
|
|
2190
|
+
return ["CMYK", 0, 0, 0, 1 - g];
|
|
2191
|
+
}
|
|
2192
|
+
static G_RGB([g]) {
|
|
2193
|
+
return ["RGB", g, g, g];
|
|
2194
|
+
}
|
|
2195
|
+
static G_rgb([g]) {
|
|
2196
|
+
g = scaleAndClamp(g);
|
|
2197
|
+
return [g, g, g];
|
|
2198
|
+
}
|
|
2199
|
+
static G_HTML([g]) {
|
|
2200
|
+
const G = makeColorComp(g);
|
|
2201
|
+
return `#${G}${G}${G}`;
|
|
2202
|
+
}
|
|
2203
|
+
static RGB_G([r, g, b]) {
|
|
2204
|
+
return ["G", 0.3 * r + 0.59 * g + 0.11 * b];
|
|
2205
|
+
}
|
|
2206
|
+
static RGB_rgb(color) {
|
|
2207
|
+
return color.map(scaleAndClamp);
|
|
2208
|
+
}
|
|
2209
|
+
static RGB_HTML(color) {
|
|
2210
|
+
return `#${color.map(makeColorComp).join("")}`;
|
|
2211
|
+
}
|
|
2212
|
+
static T_HTML() {
|
|
2213
|
+
return "#00000000";
|
|
2214
|
+
}
|
|
2215
|
+
static T_rgb() {
|
|
2216
|
+
return [null];
|
|
2217
|
+
}
|
|
2218
|
+
static CMYK_RGB([c, y, m, k]) {
|
|
2219
|
+
return [
|
|
2220
|
+
"RGB",
|
|
2221
|
+
1 - Math.min(1, c + k),
|
|
2222
|
+
1 - Math.min(1, m + k),
|
|
2223
|
+
1 - Math.min(1, y + k)
|
|
2224
|
+
];
|
|
2225
|
+
}
|
|
2226
|
+
static CMYK_rgb([c, y, m, k]) {
|
|
2227
|
+
return [
|
|
2228
|
+
scaleAndClamp(1 - Math.min(1, c + k)),
|
|
2229
|
+
scaleAndClamp(1 - Math.min(1, m + k)),
|
|
2230
|
+
scaleAndClamp(1 - Math.min(1, y + k))
|
|
2231
|
+
];
|
|
2232
|
+
}
|
|
2233
|
+
static CMYK_HTML(components) {
|
|
2234
|
+
const rgb = this.CMYK_RGB(components).slice(1);
|
|
2235
|
+
return this.RGB_HTML(rgb);
|
|
2236
|
+
}
|
|
2237
|
+
static RGB_CMYK([r, g, b]) {
|
|
2238
|
+
const c = 1 - r;
|
|
2239
|
+
const m = 1 - g;
|
|
2240
|
+
const y = 1 - b;
|
|
2241
|
+
const k = Math.min(c, m, y);
|
|
2242
|
+
return ["CMYK", c, m, y, k];
|
|
2243
|
+
}
|
|
2244
|
+
};
|
|
2245
|
+
var DateFormats = [
|
|
2246
|
+
"m/d",
|
|
2247
|
+
"m/d/yy",
|
|
2248
|
+
"mm/dd/yy",
|
|
2249
|
+
"mm/yy",
|
|
2250
|
+
"d-mmm",
|
|
2251
|
+
"d-mmm-yy",
|
|
2252
|
+
"dd-mmm-yy",
|
|
2253
|
+
"yy-mm-dd",
|
|
2254
|
+
"mmm-yy",
|
|
2255
|
+
"mmmm-yy",
|
|
2256
|
+
"mmm d, yyyy",
|
|
2257
|
+
"mmmm d, yyyy",
|
|
2258
|
+
"m/d/yy h:MM tt",
|
|
2259
|
+
"m/d/yy HH:MM"
|
|
2260
|
+
];
|
|
2261
|
+
var TimeFormats = ["HH:MM", "h:MM tt", "HH:MM:ss", "h:MM:ss tt"];
|
|
2262
|
+
|
|
1519
2263
|
// src/pdf.js/src/shared/murmurhash3.js
|
|
1520
2264
|
var SEED = 3285377520;
|
|
1521
2265
|
var MASK_HIGH = 4294901760;
|
|
@@ -1709,7 +2453,6 @@ function grayToRGBA(src, dest) {
|
|
|
1709
2453
|
|
|
1710
2454
|
export {
|
|
1711
2455
|
isNodeJS,
|
|
1712
|
-
IDENTITY_MATRIX,
|
|
1713
2456
|
FONT_IDENTITY_MATRIX,
|
|
1714
2457
|
LINE_FACTOR,
|
|
1715
2458
|
LINE_DESCENT_FACTOR,
|
|
@@ -1732,6 +2475,7 @@ export {
|
|
|
1732
2475
|
PageActionEventType,
|
|
1733
2476
|
VerbosityLevel,
|
|
1734
2477
|
OPS,
|
|
2478
|
+
DrawOPS,
|
|
1735
2479
|
PasswordResponses,
|
|
1736
2480
|
setVerbosityLevel,
|
|
1737
2481
|
getVerbosityLevel,
|
|
@@ -1740,6 +2484,7 @@ export {
|
|
|
1740
2484
|
unreachable,
|
|
1741
2485
|
assert,
|
|
1742
2486
|
createValidAbsoluteUrl,
|
|
2487
|
+
updateUrlHash,
|
|
1743
2488
|
shadow,
|
|
1744
2489
|
BaseException,
|
|
1745
2490
|
PasswordException,
|
|
@@ -1751,7 +2496,6 @@ export {
|
|
|
1751
2496
|
stringToBytes,
|
|
1752
2497
|
string32,
|
|
1753
2498
|
objectSize,
|
|
1754
|
-
objectFromMap,
|
|
1755
2499
|
FeatureTest,
|
|
1756
2500
|
hexNumbers,
|
|
1757
2501
|
Util,
|
|
@@ -1763,6 +2507,8 @@ export {
|
|
|
1763
2507
|
normalizeUnicode,
|
|
1764
2508
|
getUuid,
|
|
1765
2509
|
AnnotationPrefix,
|
|
2510
|
+
_isValidExplicitDest,
|
|
2511
|
+
MathClamp,
|
|
1766
2512
|
toHexUtil,
|
|
1767
2513
|
toBase64Util,
|
|
1768
2514
|
fromBase64Util,
|
|
@@ -1771,5 +2517,9 @@ export {
|
|
|
1771
2517
|
MessageHandler,
|
|
1772
2518
|
convertToRGBA,
|
|
1773
2519
|
convertBlackAndWhiteToRGBA,
|
|
1774
|
-
grayToRGBA
|
|
2520
|
+
grayToRGBA,
|
|
2521
|
+
FontInfo,
|
|
2522
|
+
ColorConverters,
|
|
2523
|
+
DateFormats,
|
|
2524
|
+
TimeFormats
|
|
1775
2525
|
};
|