@chialab/pdfjs-lib 1.0.0-alpha.8 → 1.0.0-alpha.9
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/dist/browser/index.js +443 -400
- package/dist/browser/worker.js +19 -6
- package/dist/lib/AnnotationData.d.ts +2 -1
- package/dist/lib/SvgCanvasContext.d.ts +1 -0
- package/dist/lib/utils.d.ts +9 -1
- package/dist/node/index.js +443 -400
- package/dist/node/worker.js +19 -6
- package/dist/pdf.js/src/display/canvas.d.ts +2 -2
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -6847,19 +6847,27 @@ var CanvasExtraState = class {
|
|
|
6847
6847
|
clone.clipBox = this.clipBox.slice();
|
|
6848
6848
|
return clone;
|
|
6849
6849
|
}
|
|
6850
|
-
updateRectMinMax(
|
|
6851
|
-
const
|
|
6852
|
-
|
|
6853
|
-
const
|
|
6854
|
-
|
|
6855
|
-
const
|
|
6856
|
-
|
|
6857
|
-
const
|
|
6858
|
-
|
|
6859
|
-
|
|
6860
|
-
|
|
6861
|
-
|
|
6862
|
-
|
|
6850
|
+
updateRectMinMax([m0, m1, m2, m3, m4, m5], [r0, r1, r2, r3]) {
|
|
6851
|
+
const m0r0m4 = m0 * r0 + m4;
|
|
6852
|
+
const m0r2m4 = m0 * r2 + m4;
|
|
6853
|
+
const m1r0m5 = m1 * r0 + m5;
|
|
6854
|
+
const m1r2m5 = m1 * r2 + m5;
|
|
6855
|
+
const m2r1 = m2 * r1;
|
|
6856
|
+
const m2r3 = m2 * r3;
|
|
6857
|
+
const m3r1 = m3 * r1;
|
|
6858
|
+
const m3r3 = m3 * r3;
|
|
6859
|
+
const a0 = m0r0m4 + m2r1;
|
|
6860
|
+
const a1 = m0r2m4 + m2r3;
|
|
6861
|
+
const a2 = m0r0m4 + m2r3;
|
|
6862
|
+
const a3 = m0r2m4 + m2r1;
|
|
6863
|
+
const b0 = m1r0m5 + m3r1;
|
|
6864
|
+
const b1 = m1r2m5 + m3r3;
|
|
6865
|
+
const b2 = m1r0m5 + m3r3;
|
|
6866
|
+
const b3 = m1r2m5 + m3r1;
|
|
6867
|
+
this.minX = Math.min(this.minX, a0, a1, a2, a3);
|
|
6868
|
+
this.maxX = Math.max(this.maxX, a0, a1, a2, a3);
|
|
6869
|
+
this.minY = Math.min(this.minY, b0, b1, b2, b3);
|
|
6870
|
+
this.maxY = Math.max(this.maxY, b0, b1, b2, b3);
|
|
6863
6871
|
}
|
|
6864
6872
|
getPathBoundingBox(pathType = PathType.FILL, transform = null) {
|
|
6865
6873
|
const box = [this.minX, this.minY, this.maxX, this.maxY];
|
|
@@ -8323,7 +8331,7 @@ var _CanvasGraphics = class _CanvasGraphics {
|
|
|
8323
8331
|
}
|
|
8324
8332
|
this.baseTransform = getCurrentTransform(this.ctx);
|
|
8325
8333
|
if (bbox) {
|
|
8326
|
-
this.current.updateRectMinMax(
|
|
8334
|
+
this.current.updateRectMinMax(this.baseTransform, bbox);
|
|
8327
8335
|
const [x0, y0, x1, y1] = bbox;
|
|
8328
8336
|
const clip = new SvgPath2D();
|
|
8329
8337
|
clip.rect(x0, y0, x1 - x0, y1 - y0);
|
|
@@ -24354,330 +24362,6 @@ if (false) {
|
|
|
24354
24362
|
};
|
|
24355
24363
|
}
|
|
24356
24364
|
|
|
24357
|
-
// src/lib/utils.ts
|
|
24358
|
-
async function canvasToData(canvas) {
|
|
24359
|
-
if ("toBlob" in canvas) {
|
|
24360
|
-
const blob = await new Promise(
|
|
24361
|
-
(resolve) => canvas.toBlob((data) => resolve(data))
|
|
24362
|
-
);
|
|
24363
|
-
if (!blob) {
|
|
24364
|
-
throw new Error("Failed to generate graphics");
|
|
24365
|
-
}
|
|
24366
|
-
return new Uint8Array(await blob.arrayBuffer());
|
|
24367
|
-
}
|
|
24368
|
-
const buffer = await canvas.encode("png");
|
|
24369
|
-
return new Uint8Array(buffer);
|
|
24370
|
-
}
|
|
24371
|
-
async function toDataUrl(data) {
|
|
24372
|
-
if (typeof FileReader !== "undefined") {
|
|
24373
|
-
return new Promise((resolve) => {
|
|
24374
|
-
const reader = new FileReader();
|
|
24375
|
-
reader.onload = () => {
|
|
24376
|
-
resolve(reader.result);
|
|
24377
|
-
};
|
|
24378
|
-
reader.readAsDataURL(new Blob([data], { type: "image/png" }));
|
|
24379
|
-
});
|
|
24380
|
-
}
|
|
24381
|
-
return `data:image/png;base64,${Buffer.from(data).toString("base64")}`;
|
|
24382
|
-
}
|
|
24383
|
-
|
|
24384
|
-
// src/lib/PDFPageProxy.ts
|
|
24385
|
-
var getAnnotations = PDFPageProxy.prototype.getAnnotations;
|
|
24386
|
-
PDFPageProxy.prototype.getAnnotations = async function(params) {
|
|
24387
|
-
const annotations = await getAnnotations.call(this, params);
|
|
24388
|
-
const operatorList = await this.getOperatorList({
|
|
24389
|
-
annotationMode: AnnotationMode.ENABLE_FORMS
|
|
24390
|
-
});
|
|
24391
|
-
const annotationsOperatorList = /* @__PURE__ */ new Map();
|
|
24392
|
-
let currentId = null;
|
|
24393
|
-
let currentList = [];
|
|
24394
|
-
for (const [index, op] of operatorList.fnArray.entries()) {
|
|
24395
|
-
const args = operatorList.argsArray[index];
|
|
24396
|
-
if (op === OPS.beginAnnotation) {
|
|
24397
|
-
currentId = args[0];
|
|
24398
|
-
currentList.push({ fn: op, args });
|
|
24399
|
-
} else if (op === OPS.endAnnotation && currentId) {
|
|
24400
|
-
currentList.push({ fn: op, args });
|
|
24401
|
-
annotationsOperatorList.set(currentId, currentList);
|
|
24402
|
-
currentList = [];
|
|
24403
|
-
} else if (currentId) {
|
|
24404
|
-
currentList.push({ fn: op, args });
|
|
24405
|
-
}
|
|
24406
|
-
}
|
|
24407
|
-
for (const annotation of annotations) {
|
|
24408
|
-
const opList = annotationsOperatorList.get(annotation.id);
|
|
24409
|
-
if (opList) {
|
|
24410
|
-
if (annotation.subtype === "Stamp") {
|
|
24411
|
-
try {
|
|
24412
|
-
const canvasFactory = isNodeJS ? new NodeCanvasFactory({}) : new DOMCanvasFactory({});
|
|
24413
|
-
const scale = 2;
|
|
24414
|
-
const viewport = this.getViewport({ scale });
|
|
24415
|
-
const { context: canvasContext } = canvasFactory.create(
|
|
24416
|
-
viewport.width,
|
|
24417
|
-
viewport.height
|
|
24418
|
-
);
|
|
24419
|
-
const gsx = new CanvasGraphics(
|
|
24420
|
-
canvasContext,
|
|
24421
|
-
this.commonObjs,
|
|
24422
|
-
this.objs,
|
|
24423
|
-
canvasFactory,
|
|
24424
|
-
this.filterFactory,
|
|
24425
|
-
{ optionalContentConfig: null }
|
|
24426
|
-
);
|
|
24427
|
-
gsx.beginDrawing({
|
|
24428
|
-
transform: null,
|
|
24429
|
-
viewport
|
|
24430
|
-
});
|
|
24431
|
-
canvasContext.clearRect(0, 0, viewport.width, viewport.height);
|
|
24432
|
-
gsx.executeOperatorList({
|
|
24433
|
-
fnArray: opList.map((op) => op.fn),
|
|
24434
|
-
argsArray: opList.map((op) => op.args)
|
|
24435
|
-
});
|
|
24436
|
-
const width = annotation.rect[2] - annotation.rect[0];
|
|
24437
|
-
const height = annotation.rect[3] - annotation.rect[1];
|
|
24438
|
-
const { context: croppedCanvasContext } = canvasFactory.create(
|
|
24439
|
-
width * scale,
|
|
24440
|
-
height * scale
|
|
24441
|
-
);
|
|
24442
|
-
croppedCanvasContext.drawImage(
|
|
24443
|
-
canvasContext.canvas,
|
|
24444
|
-
annotation.rect[0] * scale,
|
|
24445
|
-
(this.view[3] - annotation.rect[1] - height) * scale,
|
|
24446
|
-
width * scale,
|
|
24447
|
-
height * scale,
|
|
24448
|
-
0,
|
|
24449
|
-
0,
|
|
24450
|
-
width * scale,
|
|
24451
|
-
height * scale
|
|
24452
|
-
);
|
|
24453
|
-
annotation.graphics = await canvasToData(croppedCanvasContext.canvas);
|
|
24454
|
-
} catch (e) {
|
|
24455
|
-
console.error(e);
|
|
24456
|
-
}
|
|
24457
|
-
} else {
|
|
24458
|
-
let firstStroke = true;
|
|
24459
|
-
let firstFill = true;
|
|
24460
|
-
let firstText = true;
|
|
24461
|
-
let currentFillColor = null;
|
|
24462
|
-
let currentLineWidth = null;
|
|
24463
|
-
for (const { fn, args } of opList) {
|
|
24464
|
-
const finalFn = fn === OPS.constructPath ? args[0] : fn;
|
|
24465
|
-
if (finalFn === OPS.fill) {
|
|
24466
|
-
if (currentFillColor && firstFill) {
|
|
24467
|
-
annotation.interiorColor = currentFillColor;
|
|
24468
|
-
currentFillColor = null;
|
|
24469
|
-
}
|
|
24470
|
-
firstFill = false;
|
|
24471
|
-
continue;
|
|
24472
|
-
}
|
|
24473
|
-
if (fn === OPS.beginText) {
|
|
24474
|
-
firstFill = false;
|
|
24475
|
-
continue;
|
|
24476
|
-
}
|
|
24477
|
-
if (finalFn === OPS.stroke || finalFn === OPS.closeStroke) {
|
|
24478
|
-
if (currentLineWidth === null && firstStroke) {
|
|
24479
|
-
annotation.borderStyle.width = 1;
|
|
24480
|
-
}
|
|
24481
|
-
firstStroke = false;
|
|
24482
|
-
currentLineWidth = null;
|
|
24483
|
-
continue;
|
|
24484
|
-
}
|
|
24485
|
-
if (finalFn === OPS.fillStroke || finalFn === OPS.closeFillStroke) {
|
|
24486
|
-
if (currentFillColor && firstFill) {
|
|
24487
|
-
annotation.interiorColor = currentFillColor;
|
|
24488
|
-
currentFillColor = null;
|
|
24489
|
-
}
|
|
24490
|
-
if (currentLineWidth === null && firstStroke) {
|
|
24491
|
-
annotation.borderStyle.width = 1;
|
|
24492
|
-
}
|
|
24493
|
-
firstStroke = false;
|
|
24494
|
-
currentLineWidth = null;
|
|
24495
|
-
break;
|
|
24496
|
-
}
|
|
24497
|
-
if (!firstFill && !firstStroke) {
|
|
24498
|
-
break;
|
|
24499
|
-
}
|
|
24500
|
-
if (fn === OPS.setLineWidth && firstStroke) {
|
|
24501
|
-
currentLineWidth = args[0];
|
|
24502
|
-
annotation.borderStyle.width = currentLineWidth;
|
|
24503
|
-
}
|
|
24504
|
-
if (fn === OPS.setStrokeRGBColor && firstStroke) {
|
|
24505
|
-
annotation.color = args;
|
|
24506
|
-
}
|
|
24507
|
-
if (fn === OPS.setFillRGBColor && firstFill) {
|
|
24508
|
-
currentFillColor = args;
|
|
24509
|
-
}
|
|
24510
|
-
if (fn === OPS.setGState) {
|
|
24511
|
-
for (const entry of args[0]) {
|
|
24512
|
-
if (!Array.isArray(entry)) {
|
|
24513
|
-
continue;
|
|
24514
|
-
}
|
|
24515
|
-
if (entry[0] === "ca" && firstFill) {
|
|
24516
|
-
annotation.interiorColorOpacity = entry[1];
|
|
24517
|
-
}
|
|
24518
|
-
if (entry[0] === "CA" && firstStroke) {
|
|
24519
|
-
annotation.borderColorOpacity = entry[1];
|
|
24520
|
-
}
|
|
24521
|
-
}
|
|
24522
|
-
}
|
|
24523
|
-
if (fn === OPS.setFont && firstText) {
|
|
24524
|
-
const fontName = args[0];
|
|
24525
|
-
const font = fontName.startsWith("g_") ? this.commonObjs.get(fontName) : this.objs.get(fontName);
|
|
24526
|
-
if (font) {
|
|
24527
|
-
annotation.defaultAppearanceData.fontName = font.fallbackName;
|
|
24528
|
-
}
|
|
24529
|
-
}
|
|
24530
|
-
if (fn === OPS.endText) {
|
|
24531
|
-
firstText = false;
|
|
24532
|
-
}
|
|
24533
|
-
}
|
|
24534
|
-
}
|
|
24535
|
-
}
|
|
24536
|
-
}
|
|
24537
|
-
return annotations;
|
|
24538
|
-
};
|
|
24539
|
-
|
|
24540
|
-
// src/lib/StandardFontDataFactory.ts
|
|
24541
|
-
var StandardFontDataFactory = class extends BaseStandardFontDataFactory {
|
|
24542
|
-
constructor() {
|
|
24543
|
-
super({
|
|
24544
|
-
baseUrl: null
|
|
24545
|
-
});
|
|
24546
|
-
}
|
|
24547
|
-
/**
|
|
24548
|
-
* Fetch the corresponding standard font data.
|
|
24549
|
-
* We need to use specific dynamic imports for each font file for the bundler to include them.
|
|
24550
|
-
*/
|
|
24551
|
-
async fetch({ filename }) {
|
|
24552
|
-
switch (filename) {
|
|
24553
|
-
case "FoxitDingbats.pfb":
|
|
24554
|
-
return import("./FoxitDingbats-SB6TO3S5.js").then((module) => module.default);
|
|
24555
|
-
case "FoxitFixed.pfb":
|
|
24556
|
-
return import("./FoxitFixed-UIGSMBQB.js").then(
|
|
24557
|
-
(module) => module.default
|
|
24558
|
-
);
|
|
24559
|
-
case "FoxitFixedBold.pfb":
|
|
24560
|
-
return import("./FoxitFixedBold-2PAEIZAT.js").then((module) => module.default);
|
|
24561
|
-
case "FoxitFixedBoldItalic.pfb":
|
|
24562
|
-
return import("./FoxitFixedBoldItalic-OSQUQDEE.js").then((module) => module.default);
|
|
24563
|
-
case "FoxitFixedItalic.pfb":
|
|
24564
|
-
return import("./FoxitFixedItalic-W73RDK22.js").then((module) => module.default);
|
|
24565
|
-
case "FoxitSerif.pfb":
|
|
24566
|
-
return import("./FoxitSerif-3HH3SOZF.js").then(
|
|
24567
|
-
(module) => module.default
|
|
24568
|
-
);
|
|
24569
|
-
case "FoxitSerifBold.pfb":
|
|
24570
|
-
return import("./FoxitSerifBold-HXP2QOO7.js").then((module) => module.default);
|
|
24571
|
-
case "FoxitSerifBoldItalic.pfb":
|
|
24572
|
-
return import("./FoxitSerifBoldItalic-FZXLNWD7.js").then((module) => module.default);
|
|
24573
|
-
case "FoxitSerifItalic.pfb":
|
|
24574
|
-
return import("./FoxitSerifItalic-WQFHUBI2.js").then((module) => module.default);
|
|
24575
|
-
case "FoxitSymbol.pfb":
|
|
24576
|
-
return import("./FoxitSymbol-OVWU7LKS.js").then(
|
|
24577
|
-
(module) => module.default
|
|
24578
|
-
);
|
|
24579
|
-
case "LiberationSans-Bold.ttf":
|
|
24580
|
-
return import("./LiberationSans-Bold-GSJN42N5.js").then((module) => module.default);
|
|
24581
|
-
case "LiberationSans-BoldItalic.ttf":
|
|
24582
|
-
return import("./LiberationSans-BoldItalic-UCPQJ3L2.js").then((module) => module.default);
|
|
24583
|
-
case "LiberationSans-Italic.ttf":
|
|
24584
|
-
return import("./LiberationSans-Italic-6CIHEALY.js").then((module) => module.default);
|
|
24585
|
-
case "LiberationSans-Regular.ttf":
|
|
24586
|
-
return import("./LiberationSans-Regular-KIF3IRJY.js").then((module) => module.default);
|
|
24587
|
-
}
|
|
24588
|
-
return Uint8Array.from([]);
|
|
24589
|
-
}
|
|
24590
|
-
};
|
|
24591
|
-
|
|
24592
|
-
// src/lib/AnnotationData.ts
|
|
24593
|
-
function isTextAnnotation(annotation) {
|
|
24594
|
-
return annotation.subtype === "Text";
|
|
24595
|
-
}
|
|
24596
|
-
function isLinkAnnotation(annotation) {
|
|
24597
|
-
return annotation.subtype === "Link";
|
|
24598
|
-
}
|
|
24599
|
-
function isFreeTextAnnotation(annotation) {
|
|
24600
|
-
return annotation.subtype === "FreeText";
|
|
24601
|
-
}
|
|
24602
|
-
function isLineAnnotation(annotation) {
|
|
24603
|
-
return annotation.subtype === "Line";
|
|
24604
|
-
}
|
|
24605
|
-
function isSquareAnnotation(annotation) {
|
|
24606
|
-
return annotation.subtype === "Square";
|
|
24607
|
-
}
|
|
24608
|
-
function isCircleAnnotation(annotation) {
|
|
24609
|
-
return annotation.subtype === "Circle";
|
|
24610
|
-
}
|
|
24611
|
-
function isPolygonAnnotation(annotation) {
|
|
24612
|
-
return annotation.subtype === "Polygon";
|
|
24613
|
-
}
|
|
24614
|
-
function isPolylineAnnotation(annotation) {
|
|
24615
|
-
return annotation.subtype === "PolyLine";
|
|
24616
|
-
}
|
|
24617
|
-
function isHighlightAnnotation(annotation) {
|
|
24618
|
-
return annotation.subtype === "Highlight";
|
|
24619
|
-
}
|
|
24620
|
-
function isUnderlineAnnotation(annotation) {
|
|
24621
|
-
return annotation.subtype === "Underline";
|
|
24622
|
-
}
|
|
24623
|
-
function isSquigglyAnnotation(annotation) {
|
|
24624
|
-
return annotation.subtype === "Squiggly";
|
|
24625
|
-
}
|
|
24626
|
-
function isStrikeOutAnnotation(annotation) {
|
|
24627
|
-
return annotation.subtype === "StrikeOut";
|
|
24628
|
-
}
|
|
24629
|
-
function isStampAnnotation(annotation) {
|
|
24630
|
-
return annotation.subtype === "Stamp";
|
|
24631
|
-
}
|
|
24632
|
-
function isCaretAnnotation(annotation) {
|
|
24633
|
-
return annotation.subtype === "Caret";
|
|
24634
|
-
}
|
|
24635
|
-
function isInkAnnotation(annotation) {
|
|
24636
|
-
return annotation.subtype === "Ink";
|
|
24637
|
-
}
|
|
24638
|
-
function isPopupAnnotation(annotation) {
|
|
24639
|
-
return annotation.subtype === "Popup";
|
|
24640
|
-
}
|
|
24641
|
-
function isFileAttachmentAnnotation(annotation) {
|
|
24642
|
-
return annotation.subtype === "FileAttachment";
|
|
24643
|
-
}
|
|
24644
|
-
function isSoundAnnotation(annotation) {
|
|
24645
|
-
return annotation.subtype === "Sound";
|
|
24646
|
-
}
|
|
24647
|
-
function isMovieAnnotation(annotation) {
|
|
24648
|
-
return annotation.subtype === "Movie";
|
|
24649
|
-
}
|
|
24650
|
-
function isWidgetAnnotation(annotation) {
|
|
24651
|
-
return annotation.subtype === "Widget";
|
|
24652
|
-
}
|
|
24653
|
-
function isTextWidgetAnnotation(annotation) {
|
|
24654
|
-
return annotation.subtype === "Widget" && annotation.fieldType === "Tx";
|
|
24655
|
-
}
|
|
24656
|
-
function isChoiceWidgetAnnotation(annotation) {
|
|
24657
|
-
return annotation.subtype === "Widget" && annotation.fieldType === "Ch";
|
|
24658
|
-
}
|
|
24659
|
-
function isButtonWidgetAnnotation(annotation) {
|
|
24660
|
-
return annotation.subtype === "Widget" && annotation.fieldType === "Btn";
|
|
24661
|
-
}
|
|
24662
|
-
function isScreenAnnotation(annotation) {
|
|
24663
|
-
return annotation.subtype === "Screen";
|
|
24664
|
-
}
|
|
24665
|
-
function isPrinterMarkAnnotation(annotation) {
|
|
24666
|
-
return annotation.subtype === "PrinterMark";
|
|
24667
|
-
}
|
|
24668
|
-
function isTrapNetAnnotation(annotation) {
|
|
24669
|
-
return annotation.subtype === "TrapNet";
|
|
24670
|
-
}
|
|
24671
|
-
function isWatermarkAnnotation(annotation) {
|
|
24672
|
-
return annotation.subtype === "Watermark";
|
|
24673
|
-
}
|
|
24674
|
-
function isThreeDAnnotation(annotation) {
|
|
24675
|
-
return annotation.subtype === "3D";
|
|
24676
|
-
}
|
|
24677
|
-
function isRedactAnnotation(annotation) {
|
|
24678
|
-
return annotation.subtype === "Redact";
|
|
24679
|
-
}
|
|
24680
|
-
|
|
24681
24365
|
// src/lib/SvgCanvasContext.ts
|
|
24682
24366
|
function parseTransformMatrix(transformString) {
|
|
24683
24367
|
const values = transformString.match(/matrix\(([^)]+)\)/)?.[1].split(",").map(Number);
|
|
@@ -24971,19 +24655,33 @@ var SvgCanvasContext = class {
|
|
|
24971
24655
|
this._styleStack.push(this._getStyleState());
|
|
24972
24656
|
this._transformMatrixStack.push(this.getTransform());
|
|
24973
24657
|
}
|
|
24658
|
+
clearRect(x, y, width, height) {
|
|
24659
|
+
if (x !== 0 || y !== 0 || this._width !== width || this._height !== height) {
|
|
24660
|
+
throw new Error("clearRect is not supported in SVG");
|
|
24661
|
+
}
|
|
24662
|
+
this._clearCanvas();
|
|
24663
|
+
}
|
|
24974
24664
|
restore() {
|
|
24975
|
-
|
|
24976
|
-
|
|
24977
|
-
|
|
24978
|
-
|
|
24979
|
-
|
|
24980
|
-
|
|
24665
|
+
if (this._groupStack.length) {
|
|
24666
|
+
const group = this._groupStack.pop();
|
|
24667
|
+
if (!this._isTransformationGroup(this._currentGroup)) {
|
|
24668
|
+
group.children = group.children.filter(
|
|
24669
|
+
(child) => child !== this._currentGroup
|
|
24670
|
+
);
|
|
24671
|
+
group.children.push(...this._currentGroup.children);
|
|
24672
|
+
}
|
|
24673
|
+
this._currentGroup = group;
|
|
24674
|
+
} else {
|
|
24675
|
+
this._currentGroup = this._root;
|
|
24676
|
+
}
|
|
24677
|
+
if (this._styleStack.length) {
|
|
24678
|
+
const state = this._styleStack.pop();
|
|
24679
|
+
this._applyStyleState(state);
|
|
24680
|
+
}
|
|
24681
|
+
if (this._transformMatrixStack.length) {
|
|
24682
|
+
const { a, b, c, d, e, f } = this._transformMatrixStack.pop();
|
|
24683
|
+
this.setTransform(a, b, c, d, e, f);
|
|
24981
24684
|
}
|
|
24982
|
-
this._currentGroup = group;
|
|
24983
|
-
const state = this._styleStack.pop();
|
|
24984
|
-
this._applyStyleState(state);
|
|
24985
|
-
const { a, b, c, d, e, f } = this._transformMatrixStack.pop();
|
|
24986
|
-
this.setTransform(a, b, c, d, e, f);
|
|
24987
24685
|
}
|
|
24988
24686
|
beginPath() {
|
|
24989
24687
|
this._currentPosition = {};
|
|
@@ -25321,6 +25019,9 @@ var SvgCanvasContext = class {
|
|
|
25321
25019
|
const fillRuleValue = fillRule ?? path;
|
|
25322
25020
|
this._currentStyle.fillRule = fillRuleValue;
|
|
25323
25021
|
}
|
|
25022
|
+
if (path instanceof SvgPath2D && path.commands.length === 0) {
|
|
25023
|
+
return;
|
|
25024
|
+
}
|
|
25324
25025
|
const id = `clip_${crypto.randomUUID()}`;
|
|
25325
25026
|
const clipPath = {
|
|
25326
25027
|
tag: "clipPath",
|
|
@@ -25526,64 +25227,405 @@ var SvgCanvasContext = class {
|
|
|
25526
25227
|
if (command === "Z" && this._currentElement.attrs.d.endsWith("Z")) {
|
|
25527
25228
|
return;
|
|
25528
25229
|
}
|
|
25529
|
-
this._currentElement.attrs.d += ` ${command}`;
|
|
25530
|
-
} else {
|
|
25531
|
-
this._currentElement.attrs.d = command;
|
|
25532
|
-
this._currentGroup.children.push(this._currentElement);
|
|
25230
|
+
this._currentElement.attrs.d += ` ${command}`;
|
|
25231
|
+
} else {
|
|
25232
|
+
this._currentElement.attrs.d = command;
|
|
25233
|
+
this._currentGroup.children.push(this._currentElement);
|
|
25234
|
+
}
|
|
25235
|
+
}
|
|
25236
|
+
}
|
|
25237
|
+
_applyText(text, x, y, action) {
|
|
25238
|
+
const parent = this._currentGroup;
|
|
25239
|
+
const style = parseFontStyle(this._currentStyle.font);
|
|
25240
|
+
const textElement = {
|
|
25241
|
+
tag: "text",
|
|
25242
|
+
attrs: {
|
|
25243
|
+
x: `${x}`,
|
|
25244
|
+
y: `${y}`,
|
|
25245
|
+
"font-family": style.fontFamilies.join(", "),
|
|
25246
|
+
"font-size": style.fontSize,
|
|
25247
|
+
"font-style": style.fontStyle,
|
|
25248
|
+
"font-weight": style.fontWeight,
|
|
25249
|
+
"text-anchor": getTextAnchor(this._currentStyle.textAlign),
|
|
25250
|
+
"dominant-baseline": getDominantBaseline(
|
|
25251
|
+
this._currentStyle.textBaseline
|
|
25252
|
+
)
|
|
25253
|
+
},
|
|
25254
|
+
text
|
|
25255
|
+
};
|
|
25256
|
+
this._applyTransformation(textElement);
|
|
25257
|
+
this._applyStyle(textElement, action);
|
|
25258
|
+
parent.children.push(textElement);
|
|
25259
|
+
}
|
|
25260
|
+
_clearCanvas() {
|
|
25261
|
+
this._defs.children = [];
|
|
25262
|
+
this._root.children = [this._defs];
|
|
25263
|
+
this._currentGroup = this._root;
|
|
25264
|
+
this._groupStack = [];
|
|
25265
|
+
}
|
|
25266
|
+
};
|
|
25267
|
+
async function createSvgContext(width, height) {
|
|
25268
|
+
const canvas = await createCanvas(width, height);
|
|
25269
|
+
return new SvgCanvasContext(
|
|
25270
|
+
width,
|
|
25271
|
+
height,
|
|
25272
|
+
canvas
|
|
25273
|
+
);
|
|
25274
|
+
}
|
|
25275
|
+
async function toSvgNode(ctx) {
|
|
25276
|
+
if (!(ctx instanceof SvgCanvasContext)) {
|
|
25277
|
+
throw new Error("Invalid context");
|
|
25278
|
+
}
|
|
25279
|
+
return ctx.getNode();
|
|
25280
|
+
}
|
|
25281
|
+
|
|
25282
|
+
// src/lib/utils.ts
|
|
25283
|
+
async function canvasToData(canvas) {
|
|
25284
|
+
if ("toBlob" in canvas) {
|
|
25285
|
+
const blob = await new Promise(
|
|
25286
|
+
(resolve) => canvas.toBlob((data) => resolve(data))
|
|
25287
|
+
);
|
|
25288
|
+
if (!blob) {
|
|
25289
|
+
throw new Error("Failed to generate graphics");
|
|
25290
|
+
}
|
|
25291
|
+
return new Uint8Array(await blob.arrayBuffer());
|
|
25292
|
+
}
|
|
25293
|
+
const buffer = await canvas.encode("png");
|
|
25294
|
+
return new Uint8Array(buffer);
|
|
25295
|
+
}
|
|
25296
|
+
async function toDataUrl(data, type = "image/png") {
|
|
25297
|
+
if (typeof FileReader !== "undefined") {
|
|
25298
|
+
return new Promise((resolve) => {
|
|
25299
|
+
const reader = new FileReader();
|
|
25300
|
+
reader.onload = () => {
|
|
25301
|
+
resolve(reader.result);
|
|
25302
|
+
};
|
|
25303
|
+
reader.readAsDataURL(new Blob([data], { type }));
|
|
25304
|
+
});
|
|
25305
|
+
}
|
|
25306
|
+
return `data:${type};base64,${Buffer.from(data).toString("base64")}`;
|
|
25307
|
+
}
|
|
25308
|
+
function makeSerializable(object) {
|
|
25309
|
+
if (typeof object !== "object" || object === null) {
|
|
25310
|
+
return object;
|
|
25311
|
+
}
|
|
25312
|
+
if (object instanceof Int8Array || object instanceof Uint8Array || object instanceof Uint8ClampedArray || object instanceof Int16Array || object instanceof Uint16Array || object instanceof Int32Array || object instanceof Uint32Array || object instanceof Float32Array || object instanceof Float64Array) {
|
|
25313
|
+
return makeSerializable(Array.from(object));
|
|
25314
|
+
}
|
|
25315
|
+
if (object instanceof BigInt64Array || object instanceof BigUint64Array) {
|
|
25316
|
+
return makeSerializable(Array.from(object));
|
|
25317
|
+
}
|
|
25318
|
+
if (Array.isArray(object)) {
|
|
25319
|
+
return object.map(makeSerializable);
|
|
25320
|
+
}
|
|
25321
|
+
return Object.fromEntries(
|
|
25322
|
+
Object.entries(object).map(([key, value]) => [
|
|
25323
|
+
key,
|
|
25324
|
+
makeSerializable(value)
|
|
25325
|
+
])
|
|
25326
|
+
);
|
|
25327
|
+
}
|
|
25328
|
+
|
|
25329
|
+
// src/lib/PDFPageProxy.ts
|
|
25330
|
+
var getAnnotations = PDFPageProxy.prototype.getAnnotations;
|
|
25331
|
+
PDFPageProxy.prototype.getAnnotations = async function(params) {
|
|
25332
|
+
const annotations = await getAnnotations.call(this, params);
|
|
25333
|
+
const operatorList = await this.getOperatorList({
|
|
25334
|
+
annotationMode: AnnotationMode.ENABLE_FORMS
|
|
25335
|
+
});
|
|
25336
|
+
const annotationsOperatorList = /* @__PURE__ */ new Map();
|
|
25337
|
+
let currentId = null;
|
|
25338
|
+
let currentList = [];
|
|
25339
|
+
for (const [index, op] of operatorList.fnArray.entries()) {
|
|
25340
|
+
const args = operatorList.argsArray[index];
|
|
25341
|
+
if (op === OPS.beginAnnotation) {
|
|
25342
|
+
currentId = args[0];
|
|
25343
|
+
currentList.push({ fn: op, args });
|
|
25344
|
+
} else if (op === OPS.endAnnotation && currentId) {
|
|
25345
|
+
currentList.push({ fn: op, args });
|
|
25346
|
+
annotationsOperatorList.set(currentId, currentList);
|
|
25347
|
+
currentList = [];
|
|
25348
|
+
} else if (currentId) {
|
|
25349
|
+
currentList.push({ fn: op, args });
|
|
25350
|
+
}
|
|
25351
|
+
}
|
|
25352
|
+
for (const annotation of annotations) {
|
|
25353
|
+
const opList = annotationsOperatorList.get(annotation.id);
|
|
25354
|
+
if (opList) {
|
|
25355
|
+
if (annotation.subtype === "Stamp") {
|
|
25356
|
+
try {
|
|
25357
|
+
const canvasFactory = isNodeJS ? new NodeCanvasFactory({}) : new DOMCanvasFactory({});
|
|
25358
|
+
const scale = 2;
|
|
25359
|
+
const viewport = this.getViewport({ scale });
|
|
25360
|
+
const svgContext = await createSvgContext(
|
|
25361
|
+
viewport.width,
|
|
25362
|
+
viewport.height
|
|
25363
|
+
);
|
|
25364
|
+
const gsx = new CanvasGraphics(
|
|
25365
|
+
svgContext,
|
|
25366
|
+
this.commonObjs,
|
|
25367
|
+
this.objs,
|
|
25368
|
+
canvasFactory,
|
|
25369
|
+
this.filterFactory,
|
|
25370
|
+
{ optionalContentConfig: null }
|
|
25371
|
+
);
|
|
25372
|
+
gsx.beginDrawing({
|
|
25373
|
+
transform: null,
|
|
25374
|
+
viewport
|
|
25375
|
+
});
|
|
25376
|
+
svgContext.clearRect(0, 0, viewport.width, viewport.height);
|
|
25377
|
+
gsx.executeOperatorList({
|
|
25378
|
+
fnArray: opList.map((op) => op.fn),
|
|
25379
|
+
argsArray: opList.map((op) => op.args)
|
|
25380
|
+
});
|
|
25381
|
+
const width = annotation.rect[2] - annotation.rect[0];
|
|
25382
|
+
const height = annotation.rect[3] - annotation.rect[1];
|
|
25383
|
+
annotation.graphics = {
|
|
25384
|
+
tag: "svg",
|
|
25385
|
+
attrs: {
|
|
25386
|
+
version: "1.1",
|
|
25387
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
25388
|
+
width: `${width}`,
|
|
25389
|
+
height: `${height}`,
|
|
25390
|
+
viewBox: `0 0 ${width * scale} ${height * scale}`,
|
|
25391
|
+
preserveAspectRatio: "none",
|
|
25392
|
+
"xml:space": "preserve"
|
|
25393
|
+
},
|
|
25394
|
+
children: [
|
|
25395
|
+
{
|
|
25396
|
+
tag: "g",
|
|
25397
|
+
attrs: {
|
|
25398
|
+
transform: `translate(-${annotation.rect[0] * scale}, -${(this.view[3] - annotation.rect[1] - height) * scale})`
|
|
25399
|
+
},
|
|
25400
|
+
children: [await toSvgNode(svgContext)]
|
|
25401
|
+
}
|
|
25402
|
+
]
|
|
25403
|
+
};
|
|
25404
|
+
} catch (e) {
|
|
25405
|
+
console.error(e);
|
|
25406
|
+
}
|
|
25407
|
+
} else {
|
|
25408
|
+
let firstStroke = true;
|
|
25409
|
+
let firstFill = true;
|
|
25410
|
+
let firstText = true;
|
|
25411
|
+
let currentFillColor = null;
|
|
25412
|
+
let currentLineWidth = null;
|
|
25413
|
+
for (const { fn, args } of opList) {
|
|
25414
|
+
const finalFn = fn === OPS.constructPath ? args[0] : fn;
|
|
25415
|
+
if (finalFn === OPS.fill) {
|
|
25416
|
+
if (currentFillColor && firstFill) {
|
|
25417
|
+
annotation.interiorColor = currentFillColor;
|
|
25418
|
+
currentFillColor = null;
|
|
25419
|
+
}
|
|
25420
|
+
firstFill = false;
|
|
25421
|
+
continue;
|
|
25422
|
+
}
|
|
25423
|
+
if (fn === OPS.beginText) {
|
|
25424
|
+
firstFill = false;
|
|
25425
|
+
continue;
|
|
25426
|
+
}
|
|
25427
|
+
if (finalFn === OPS.stroke || finalFn === OPS.closeStroke) {
|
|
25428
|
+
if (currentLineWidth === null && firstStroke) {
|
|
25429
|
+
annotation.borderStyle.width = 1;
|
|
25430
|
+
}
|
|
25431
|
+
firstStroke = false;
|
|
25432
|
+
currentLineWidth = null;
|
|
25433
|
+
continue;
|
|
25434
|
+
}
|
|
25435
|
+
if (finalFn === OPS.fillStroke || finalFn === OPS.closeFillStroke) {
|
|
25436
|
+
if (currentFillColor && firstFill) {
|
|
25437
|
+
annotation.interiorColor = currentFillColor;
|
|
25438
|
+
currentFillColor = null;
|
|
25439
|
+
}
|
|
25440
|
+
if (currentLineWidth === null && firstStroke) {
|
|
25441
|
+
annotation.borderStyle.width = 1;
|
|
25442
|
+
}
|
|
25443
|
+
firstStroke = false;
|
|
25444
|
+
currentLineWidth = null;
|
|
25445
|
+
break;
|
|
25446
|
+
}
|
|
25447
|
+
if (!firstFill && !firstStroke) {
|
|
25448
|
+
break;
|
|
25449
|
+
}
|
|
25450
|
+
if (fn === OPS.setLineWidth && firstStroke) {
|
|
25451
|
+
currentLineWidth = args[0];
|
|
25452
|
+
annotation.borderStyle.width = currentLineWidth;
|
|
25453
|
+
}
|
|
25454
|
+
if (fn === OPS.setStrokeRGBColor && firstStroke) {
|
|
25455
|
+
annotation.color = args;
|
|
25456
|
+
}
|
|
25457
|
+
if (fn === OPS.setFillRGBColor && firstFill) {
|
|
25458
|
+
currentFillColor = args;
|
|
25459
|
+
}
|
|
25460
|
+
if (fn === OPS.setGState) {
|
|
25461
|
+
for (const entry of args[0]) {
|
|
25462
|
+
if (!Array.isArray(entry)) {
|
|
25463
|
+
continue;
|
|
25464
|
+
}
|
|
25465
|
+
if (entry[0] === "ca" && firstFill) {
|
|
25466
|
+
annotation.interiorColorOpacity = entry[1];
|
|
25467
|
+
}
|
|
25468
|
+
if (entry[0] === "CA" && firstStroke) {
|
|
25469
|
+
annotation.borderColorOpacity = entry[1];
|
|
25470
|
+
}
|
|
25471
|
+
}
|
|
25472
|
+
}
|
|
25473
|
+
if (fn === OPS.setFont && firstText) {
|
|
25474
|
+
const fontName = args[0];
|
|
25475
|
+
const font = fontName.startsWith("g_") ? this.commonObjs.get(fontName) : this.objs.get(fontName);
|
|
25476
|
+
if (font) {
|
|
25477
|
+
annotation.defaultAppearanceData.fontName = font.fallbackName;
|
|
25478
|
+
}
|
|
25479
|
+
}
|
|
25480
|
+
if (fn === OPS.endText) {
|
|
25481
|
+
firstText = false;
|
|
25482
|
+
}
|
|
25483
|
+
}
|
|
25533
25484
|
}
|
|
25534
25485
|
}
|
|
25535
25486
|
}
|
|
25536
|
-
|
|
25537
|
-
|
|
25538
|
-
|
|
25539
|
-
|
|
25540
|
-
|
|
25541
|
-
|
|
25542
|
-
|
|
25543
|
-
|
|
25544
|
-
|
|
25545
|
-
"font-size": style.fontSize,
|
|
25546
|
-
"font-style": style.fontStyle,
|
|
25547
|
-
"font-weight": style.fontWeight,
|
|
25548
|
-
"text-anchor": getTextAnchor(this._currentStyle.textAlign),
|
|
25549
|
-
"dominant-baseline": getDominantBaseline(
|
|
25550
|
-
this._currentStyle.textBaseline
|
|
25551
|
-
)
|
|
25552
|
-
},
|
|
25553
|
-
text
|
|
25554
|
-
};
|
|
25555
|
-
this._applyTransformation(textElement);
|
|
25556
|
-
this._applyStyle(textElement, action);
|
|
25557
|
-
parent.children.push(textElement);
|
|
25487
|
+
return makeSerializable(annotations);
|
|
25488
|
+
};
|
|
25489
|
+
|
|
25490
|
+
// src/lib/StandardFontDataFactory.ts
|
|
25491
|
+
var StandardFontDataFactory = class extends BaseStandardFontDataFactory {
|
|
25492
|
+
constructor() {
|
|
25493
|
+
super({
|
|
25494
|
+
baseUrl: null
|
|
25495
|
+
});
|
|
25558
25496
|
}
|
|
25559
|
-
|
|
25560
|
-
|
|
25561
|
-
|
|
25562
|
-
|
|
25563
|
-
|
|
25564
|
-
)
|
|
25565
|
-
|
|
25566
|
-
|
|
25567
|
-
|
|
25568
|
-
|
|
25569
|
-
|
|
25570
|
-
|
|
25571
|
-
|
|
25497
|
+
/**
|
|
25498
|
+
* Fetch the corresponding standard font data.
|
|
25499
|
+
* We need to use specific dynamic imports for each font file for the bundler to include them.
|
|
25500
|
+
*/
|
|
25501
|
+
async fetch({ filename }) {
|
|
25502
|
+
switch (filename) {
|
|
25503
|
+
case "FoxitDingbats.pfb":
|
|
25504
|
+
return import("./FoxitDingbats-SB6TO3S5.js").then((module) => module.default);
|
|
25505
|
+
case "FoxitFixed.pfb":
|
|
25506
|
+
return import("./FoxitFixed-UIGSMBQB.js").then(
|
|
25507
|
+
(module) => module.default
|
|
25508
|
+
);
|
|
25509
|
+
case "FoxitFixedBold.pfb":
|
|
25510
|
+
return import("./FoxitFixedBold-2PAEIZAT.js").then((module) => module.default);
|
|
25511
|
+
case "FoxitFixedBoldItalic.pfb":
|
|
25512
|
+
return import("./FoxitFixedBoldItalic-OSQUQDEE.js").then((module) => module.default);
|
|
25513
|
+
case "FoxitFixedItalic.pfb":
|
|
25514
|
+
return import("./FoxitFixedItalic-W73RDK22.js").then((module) => module.default);
|
|
25515
|
+
case "FoxitSerif.pfb":
|
|
25516
|
+
return import("./FoxitSerif-3HH3SOZF.js").then(
|
|
25517
|
+
(module) => module.default
|
|
25518
|
+
);
|
|
25519
|
+
case "FoxitSerifBold.pfb":
|
|
25520
|
+
return import("./FoxitSerifBold-HXP2QOO7.js").then((module) => module.default);
|
|
25521
|
+
case "FoxitSerifBoldItalic.pfb":
|
|
25522
|
+
return import("./FoxitSerifBoldItalic-FZXLNWD7.js").then((module) => module.default);
|
|
25523
|
+
case "FoxitSerifItalic.pfb":
|
|
25524
|
+
return import("./FoxitSerifItalic-WQFHUBI2.js").then((module) => module.default);
|
|
25525
|
+
case "FoxitSymbol.pfb":
|
|
25526
|
+
return import("./FoxitSymbol-OVWU7LKS.js").then(
|
|
25527
|
+
(module) => module.default
|
|
25528
|
+
);
|
|
25529
|
+
case "LiberationSans-Bold.ttf":
|
|
25530
|
+
return import("./LiberationSans-Bold-GSJN42N5.js").then((module) => module.default);
|
|
25531
|
+
case "LiberationSans-BoldItalic.ttf":
|
|
25532
|
+
return import("./LiberationSans-BoldItalic-UCPQJ3L2.js").then((module) => module.default);
|
|
25533
|
+
case "LiberationSans-Italic.ttf":
|
|
25534
|
+
return import("./LiberationSans-Italic-6CIHEALY.js").then((module) => module.default);
|
|
25535
|
+
case "LiberationSans-Regular.ttf":
|
|
25536
|
+
return import("./LiberationSans-Regular-KIF3IRJY.js").then((module) => module.default);
|
|
25537
|
+
}
|
|
25538
|
+
return Uint8Array.from([]);
|
|
25572
25539
|
}
|
|
25573
25540
|
};
|
|
25574
|
-
|
|
25575
|
-
|
|
25576
|
-
|
|
25577
|
-
|
|
25578
|
-
height,
|
|
25579
|
-
canvas
|
|
25580
|
-
);
|
|
25541
|
+
|
|
25542
|
+
// src/lib/AnnotationData.ts
|
|
25543
|
+
function isTextAnnotation(annotation) {
|
|
25544
|
+
return annotation.subtype === "Text";
|
|
25581
25545
|
}
|
|
25582
|
-
|
|
25583
|
-
|
|
25584
|
-
|
|
25585
|
-
|
|
25586
|
-
return
|
|
25546
|
+
function isLinkAnnotation(annotation) {
|
|
25547
|
+
return annotation.subtype === "Link";
|
|
25548
|
+
}
|
|
25549
|
+
function isFreeTextAnnotation(annotation) {
|
|
25550
|
+
return annotation.subtype === "FreeText";
|
|
25551
|
+
}
|
|
25552
|
+
function isLineAnnotation(annotation) {
|
|
25553
|
+
return annotation.subtype === "Line";
|
|
25554
|
+
}
|
|
25555
|
+
function isSquareAnnotation(annotation) {
|
|
25556
|
+
return annotation.subtype === "Square";
|
|
25557
|
+
}
|
|
25558
|
+
function isCircleAnnotation(annotation) {
|
|
25559
|
+
return annotation.subtype === "Circle";
|
|
25560
|
+
}
|
|
25561
|
+
function isPolygonAnnotation(annotation) {
|
|
25562
|
+
return annotation.subtype === "Polygon";
|
|
25563
|
+
}
|
|
25564
|
+
function isPolylineAnnotation(annotation) {
|
|
25565
|
+
return annotation.subtype === "PolyLine";
|
|
25566
|
+
}
|
|
25567
|
+
function isHighlightAnnotation(annotation) {
|
|
25568
|
+
return annotation.subtype === "Highlight";
|
|
25569
|
+
}
|
|
25570
|
+
function isUnderlineAnnotation(annotation) {
|
|
25571
|
+
return annotation.subtype === "Underline";
|
|
25572
|
+
}
|
|
25573
|
+
function isSquigglyAnnotation(annotation) {
|
|
25574
|
+
return annotation.subtype === "Squiggly";
|
|
25575
|
+
}
|
|
25576
|
+
function isStrikeOutAnnotation(annotation) {
|
|
25577
|
+
return annotation.subtype === "StrikeOut";
|
|
25578
|
+
}
|
|
25579
|
+
function isStampAnnotation(annotation) {
|
|
25580
|
+
return annotation.subtype === "Stamp";
|
|
25581
|
+
}
|
|
25582
|
+
function isCaretAnnotation(annotation) {
|
|
25583
|
+
return annotation.subtype === "Caret";
|
|
25584
|
+
}
|
|
25585
|
+
function isInkAnnotation(annotation) {
|
|
25586
|
+
return annotation.subtype === "Ink";
|
|
25587
|
+
}
|
|
25588
|
+
function isPopupAnnotation(annotation) {
|
|
25589
|
+
return annotation.subtype === "Popup";
|
|
25590
|
+
}
|
|
25591
|
+
function isFileAttachmentAnnotation(annotation) {
|
|
25592
|
+
return annotation.subtype === "FileAttachment";
|
|
25593
|
+
}
|
|
25594
|
+
function isSoundAnnotation(annotation) {
|
|
25595
|
+
return annotation.subtype === "Sound";
|
|
25596
|
+
}
|
|
25597
|
+
function isMovieAnnotation(annotation) {
|
|
25598
|
+
return annotation.subtype === "Movie";
|
|
25599
|
+
}
|
|
25600
|
+
function isWidgetAnnotation(annotation) {
|
|
25601
|
+
return annotation.subtype === "Widget";
|
|
25602
|
+
}
|
|
25603
|
+
function isTextWidgetAnnotation(annotation) {
|
|
25604
|
+
return annotation.subtype === "Widget" && annotation.fieldType === "Tx";
|
|
25605
|
+
}
|
|
25606
|
+
function isChoiceWidgetAnnotation(annotation) {
|
|
25607
|
+
return annotation.subtype === "Widget" && annotation.fieldType === "Ch";
|
|
25608
|
+
}
|
|
25609
|
+
function isButtonWidgetAnnotation(annotation) {
|
|
25610
|
+
return annotation.subtype === "Widget" && annotation.fieldType === "Btn";
|
|
25611
|
+
}
|
|
25612
|
+
function isScreenAnnotation(annotation) {
|
|
25613
|
+
return annotation.subtype === "Screen";
|
|
25614
|
+
}
|
|
25615
|
+
function isPrinterMarkAnnotation(annotation) {
|
|
25616
|
+
return annotation.subtype === "PrinterMark";
|
|
25617
|
+
}
|
|
25618
|
+
function isTrapNetAnnotation(annotation) {
|
|
25619
|
+
return annotation.subtype === "TrapNet";
|
|
25620
|
+
}
|
|
25621
|
+
function isWatermarkAnnotation(annotation) {
|
|
25622
|
+
return annotation.subtype === "Watermark";
|
|
25623
|
+
}
|
|
25624
|
+
function isThreeDAnnotation(annotation) {
|
|
25625
|
+
return annotation.subtype === "3D";
|
|
25626
|
+
}
|
|
25627
|
+
function isRedactAnnotation(annotation) {
|
|
25628
|
+
return annotation.subtype === "Redact";
|
|
25587
25629
|
}
|
|
25588
25630
|
|
|
25589
25631
|
// src/lib/TextLayer.ts
|
|
@@ -26146,6 +26188,7 @@ export {
|
|
|
26146
26188
|
isWatermarkAnnotation,
|
|
26147
26189
|
isWidgetAnnotation,
|
|
26148
26190
|
loadDefaultFonts,
|
|
26191
|
+
makeSerializable,
|
|
26149
26192
|
noContextMenu,
|
|
26150
26193
|
normalizeUnicode,
|
|
26151
26194
|
setLayerDimensions,
|