@embedpdf/engines 2.1.2 → 2.3.0

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.
Files changed (43) hide show
  1. package/dist/direct-engine-Dwkk7o9U.cjs +2 -0
  2. package/dist/direct-engine-Dwkk7o9U.cjs.map +1 -0
  3. package/dist/{direct-engine-CB3k-o0I.js → direct-engine-nrX_KvVy.js} +403 -415
  4. package/dist/direct-engine-nrX_KvVy.js.map +1 -0
  5. package/dist/index.cjs +1 -1
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.js +17 -2
  8. package/dist/index.js.map +1 -1
  9. package/dist/lib/orchestrator/pdf-engine.d.ts +20 -0
  10. package/dist/lib/orchestrator/remote-executor.d.ts +5 -0
  11. package/dist/lib/pdfium/engine.d.ts +105 -0
  12. package/dist/lib/pdfium/index.cjs +1 -1
  13. package/dist/lib/pdfium/index.js +3 -3
  14. package/dist/lib/pdfium/web/direct-engine.cjs +1 -1
  15. package/dist/lib/pdfium/web/direct-engine.js +2 -2
  16. package/dist/lib/pdfium/web/worker-engine.cjs +1 -1
  17. package/dist/lib/pdfium/web/worker-engine.cjs.map +1 -1
  18. package/dist/lib/pdfium/web/worker-engine.js +22 -2
  19. package/dist/lib/pdfium/web/worker-engine.js.map +1 -1
  20. package/dist/lib/webworker/engine.cjs +1 -1
  21. package/dist/lib/webworker/engine.cjs.map +1 -1
  22. package/dist/lib/webworker/engine.d.ts +30 -0
  23. package/dist/lib/webworker/engine.js +73 -0
  24. package/dist/lib/webworker/engine.js.map +1 -1
  25. package/dist/{pdf-engine-BVNF_Yo9.js → pdf-engine-ChjNHvQd.js} +61 -1
  26. package/dist/{pdf-engine-BVNF_Yo9.js.map → pdf-engine-ChjNHvQd.js.map} +1 -1
  27. package/dist/pdf-engine-DgNNP62W.cjs +2 -0
  28. package/dist/{pdf-engine-C3JeKij1.cjs.map → pdf-engine-DgNNP62W.cjs.map} +1 -1
  29. package/dist/preact/index.cjs +1 -1
  30. package/dist/preact/index.js +1 -1
  31. package/dist/react/index.cjs +1 -1
  32. package/dist/react/index.js +1 -1
  33. package/dist/svelte/index.cjs +1 -1
  34. package/dist/svelte/index.cjs.map +1 -1
  35. package/dist/svelte/index.js +1 -1
  36. package/dist/svelte/index.js.map +1 -1
  37. package/dist/vue/index.cjs +1 -1
  38. package/dist/vue/index.js +1 -1
  39. package/package.json +5 -5
  40. package/dist/direct-engine-BeZ18SKz.cjs +0 -2
  41. package/dist/direct-engine-BeZ18SKz.cjs.map +0 -1
  42. package/dist/direct-engine-CB3k-o0I.js.map +0 -1
  43. package/dist/pdf-engine-C3JeKij1.cjs +0 -2
@@ -1,6 +1,6 @@
1
1
  import { init } from "@embedpdf/pdfium";
2
- import { Rotation, NoopLogger, PdfTaskHelper, PdfErrorCode, pdfDateToDate, isUuidV4, uuidV4, PdfAnnotationSubtype, PdfPageFlattenFlag, stripPdfUnwantedMarkers, PdfAnnotationIcon, PdfAnnotationBorderStyle, PdfAnnotationColorType, PdfAnnotationLineEnding, PdfStampFit, PdfTrappedStatus, pdfColorToWebColor, webColorToPdfColor, pdfAlphaToWebOpacity, webOpacityToPdfAlpha, dateToPdfDate, quadToRect, rectToQuad, PdfStandardFont, PdfPageObjectType, flagsToNames, namesToFlags, PDF_FORM_FIELD_TYPE, AppearanceMode, Task, toIntRect, transformRect, buildUserToDeviceMatrix, PdfZoomMode, PdfActionType } from "@embedpdf/models";
3
- import { P as PdfEngine } from "./pdf-engine-BVNF_Yo9.js";
2
+ import { Rotation, NoopLogger, PdfTaskHelper, PdfErrorCode, pdfDateToDate, isUuidV4, uuidV4, PdfAnnotationSubtype, PdfPageFlattenFlag, stripPdfUnwantedMarkers, PdfAnnotationIcon, PdfAnnotationBorderStyle, PdfAnnotationColorType, PdfAnnotationLineEnding, PdfStampFit, PdfTrappedStatus, pdfColorToWebColor, webColorToPdfColor, pdfAlphaToWebOpacity, webOpacityToPdfAlpha, PdfAnnotationReplyType, dateToPdfDate, quadToRect, rectToQuad, PdfStandardFont, PdfPageObjectType, flagsToNames, namesToFlags, PDF_FORM_FIELD_TYPE, AppearanceMode, Task, toIntRect, transformRect, buildUserToDeviceMatrix, PdfZoomMode, PdfActionType } from "@embedpdf/models";
3
+ import { P as PdfEngine } from "./pdf-engine-ChjNHvQd.js";
4
4
  import { b as browserImageDataToBlobConverter } from "./browser-awZxztMA.js";
5
5
  function readString(wasmModule, readChars, parseChars, defaultLength = 100) {
6
6
  let buffer = wasmModule.wasmExports.malloc(defaultLength);
@@ -1102,10 +1102,16 @@ class PdfiumNative {
1102
1102
  pages.push(page);
1103
1103
  }
1104
1104
  this.memoryManager.free(sizePtr);
1105
+ const isEncrypted = this.pdfiumModule.EPDF_IsEncrypted(docPtr);
1106
+ const isOwnerUnlocked = this.pdfiumModule.EPDF_IsOwnerUnlocked(docPtr);
1107
+ const permissions = this.pdfiumModule.FPDF_GetDocPermissions(docPtr);
1105
1108
  const pdfDoc = {
1106
1109
  id: file.id,
1107
1110
  pageCount,
1108
- pages
1111
+ pages,
1112
+ isEncrypted,
1113
+ isOwnerUnlocked,
1114
+ permissions
1109
1115
  };
1110
1116
  this.cache.setDocument(file.id, filePtr, docPtr);
1111
1117
  this.logger.perf(LOG_SOURCE, LOG_CATEGORY, `OpenDocumentBuffer`, "End", file.id);
@@ -1589,6 +1595,9 @@ class PdfiumNative {
1589
1595
  case PdfAnnotationSubtype.HIGHLIGHT:
1590
1596
  isSucceed = this.addTextMarkupContent(page, pageCtx.pagePtr, annotationPtr, annotation);
1591
1597
  break;
1598
+ case PdfAnnotationSubtype.LINK:
1599
+ isSucceed = this.addLinkContent(ctx.docPtr, pageCtx.pagePtr, annotationPtr, annotation);
1600
+ break;
1592
1601
  }
1593
1602
  if (!isSucceed) {
1594
1603
  this.pdfiumModule.FPDFPage_RemoveAnnot(pageCtx.pagePtr, annotationPtr);
@@ -1729,6 +1738,11 @@ class PdfiumNative {
1729
1738
  ok = this.addTextMarkupContent(page, pageCtx.pagePtr, annotPtr, annotation);
1730
1739
  break;
1731
1740
  }
1741
+ /* ── Link ─────────────────────────────────────────────────────────────── */
1742
+ case PdfAnnotationSubtype.LINK: {
1743
+ ok = this.addLinkContent(ctx.docPtr, pageCtx.pagePtr, annotPtr, annotation);
1744
+ break;
1745
+ }
1732
1746
  /* ── Unsupported edits – fall through to error ───────────────────────── */
1733
1747
  default:
1734
1748
  ok = false;
@@ -2543,6 +2557,117 @@ class PdfiumNative {
2543
2557
  }
2544
2558
  }
2545
2559
  }
2560
+ /**
2561
+ * Sets AES-256 encryption on a document.
2562
+ * Must be called before saveAsCopy() for encryption to take effect.
2563
+ *
2564
+ * @param doc - Document to encrypt
2565
+ * @param userPassword - Password to open document (empty = no open password)
2566
+ * @param ownerPassword - Password to change permissions (required)
2567
+ * @param allowedFlags - OR'd PdfPermissionFlag values indicating allowed actions
2568
+ * @returns true on success, false if already encrypted or invalid params
2569
+ *
2570
+ * @public
2571
+ */
2572
+ setDocumentEncryption(doc, userPassword, ownerPassword, allowedFlags) {
2573
+ this.logger.debug(LOG_SOURCE, LOG_CATEGORY, "setDocumentEncryption", doc, allowedFlags);
2574
+ const ctx = this.cache.getContext(doc.id);
2575
+ if (!ctx) {
2576
+ return PdfTaskHelper.reject({
2577
+ code: PdfErrorCode.DocNotOpen,
2578
+ message: "document does not open"
2579
+ });
2580
+ }
2581
+ const result = this.pdfiumModule.EPDF_SetEncryption(
2582
+ ctx.docPtr,
2583
+ userPassword,
2584
+ ownerPassword,
2585
+ allowedFlags
2586
+ );
2587
+ return PdfTaskHelper.resolve(result);
2588
+ }
2589
+ /**
2590
+ * Marks document for encryption removal on save.
2591
+ * When saveAsCopy is called, the document will be saved without encryption.
2592
+ *
2593
+ * @param doc - Document to remove encryption from
2594
+ * @returns true on success
2595
+ *
2596
+ * @public
2597
+ */
2598
+ removeEncryption(doc) {
2599
+ this.logger.debug(LOG_SOURCE, LOG_CATEGORY, "removeEncryption", doc);
2600
+ const ctx = this.cache.getContext(doc.id);
2601
+ if (!ctx) {
2602
+ return PdfTaskHelper.reject({
2603
+ code: PdfErrorCode.DocNotOpen,
2604
+ message: "document does not open"
2605
+ });
2606
+ }
2607
+ const result = this.pdfiumModule.EPDF_RemoveEncryption(ctx.docPtr);
2608
+ return PdfTaskHelper.resolve(result);
2609
+ }
2610
+ /**
2611
+ * Attempts to unlock owner permissions for an already-opened encrypted document.
2612
+ *
2613
+ * @param doc - Document to unlock
2614
+ * @param ownerPassword - The owner password
2615
+ * @returns true on success, false on failure
2616
+ *
2617
+ * @public
2618
+ */
2619
+ unlockOwnerPermissions(doc, ownerPassword) {
2620
+ this.logger.debug(LOG_SOURCE, LOG_CATEGORY, "unlockOwnerPermissions", doc.id);
2621
+ const ctx = this.cache.getContext(doc.id);
2622
+ if (!ctx) {
2623
+ return PdfTaskHelper.reject({
2624
+ code: PdfErrorCode.DocNotOpen,
2625
+ message: "document does not open"
2626
+ });
2627
+ }
2628
+ const success = this.pdfiumModule.EPDF_UnlockOwnerPermissions(ctx.docPtr, ownerPassword);
2629
+ return PdfTaskHelper.resolve(success);
2630
+ }
2631
+ /**
2632
+ * Check if a document is encrypted.
2633
+ *
2634
+ * @param doc - Document to check
2635
+ * @returns true if the document is encrypted
2636
+ *
2637
+ * @public
2638
+ */
2639
+ isEncrypted(doc) {
2640
+ this.logger.debug(LOG_SOURCE, LOG_CATEGORY, "isEncrypted", doc.id);
2641
+ const ctx = this.cache.getContext(doc.id);
2642
+ if (!ctx) {
2643
+ return PdfTaskHelper.reject({
2644
+ code: PdfErrorCode.DocNotOpen,
2645
+ message: "document does not open"
2646
+ });
2647
+ }
2648
+ const result = this.pdfiumModule.EPDF_IsEncrypted(ctx.docPtr);
2649
+ return PdfTaskHelper.resolve(result);
2650
+ }
2651
+ /**
2652
+ * Check if owner permissions are currently unlocked.
2653
+ *
2654
+ * @param doc - Document to check
2655
+ * @returns true if owner permissions are unlocked
2656
+ *
2657
+ * @public
2658
+ */
2659
+ isOwnerUnlocked(doc) {
2660
+ this.logger.debug(LOG_SOURCE, LOG_CATEGORY, "isOwnerUnlocked", doc.id);
2661
+ const ctx = this.cache.getContext(doc.id);
2662
+ if (!ctx) {
2663
+ return PdfTaskHelper.reject({
2664
+ code: PdfErrorCode.DocNotOpen,
2665
+ message: "document does not open"
2666
+ });
2667
+ }
2668
+ const result = this.pdfiumModule.EPDF_IsOwnerUnlocked(ctx.docPtr);
2669
+ return PdfTaskHelper.resolve(result);
2670
+ }
2546
2671
  /**
2547
2672
  * {@inheritDoc @embedpdf/models!PdfEngine.saveAsCopy}
2548
2673
  *
@@ -2600,37 +2725,21 @@ class PdfiumNative {
2600
2725
  * @private
2601
2726
  */
2602
2727
  addTextContent(page, pagePtr, annotationPtr, annotation) {
2603
- if (!this.setAnnotString(annotationPtr, "Contents", annotation.contents ?? "")) {
2604
- return false;
2605
- }
2606
- if (annotation.custom && !this.setAnnotCustom(annotationPtr, annotation.custom)) {
2607
- return false;
2608
- }
2609
- if (!this.setAnnotString(annotationPtr, "T", annotation.author || "")) {
2610
- return false;
2611
- }
2612
- if (annotation.modified && !this.setAnnotationDate(annotationPtr, "M", annotation.modified)) {
2613
- return false;
2614
- }
2615
- if (annotation.created && !this.setAnnotationDate(annotationPtr, "CreationDate", annotation.created)) {
2616
- return false;
2617
- }
2618
- if (annotation.inReplyToId && !this.setInReplyToId(pagePtr, annotationPtr, annotation.inReplyToId)) {
2619
- return false;
2620
- }
2621
2728
  if (!this.setAnnotationIcon(annotationPtr, annotation.icon || PdfAnnotationIcon.Comment)) {
2622
2729
  return false;
2623
2730
  }
2624
- if (!this.setAnnotationFlags(annotationPtr, annotation.flags || ["print", "noZoom", "noRotate"])) {
2625
- return false;
2626
- }
2627
2731
  if (annotation.state && !this.setAnnotString(annotationPtr, "State", annotation.state)) {
2628
2732
  return false;
2629
2733
  }
2630
2734
  if (annotation.stateModel && !this.setAnnotString(annotationPtr, "StateModel", annotation.stateModel)) {
2631
2735
  return false;
2632
2736
  }
2633
- return true;
2737
+ if (!annotation.flags) {
2738
+ if (!this.setAnnotationFlags(annotationPtr, ["print", "noZoom", "noRotate"])) {
2739
+ return false;
2740
+ }
2741
+ }
2742
+ return this.applyBaseAnnotationProperties(pagePtr, annotationPtr, annotation);
2634
2743
  }
2635
2744
  /**
2636
2745
  * Add free text content to annotation
@@ -2643,27 +2752,9 @@ class PdfiumNative {
2643
2752
  * @private
2644
2753
  */
2645
2754
  addFreeTextContent(page, pagePtr, annotationPtr, annotation) {
2646
- if (annotation.created && !this.setAnnotationDate(annotationPtr, "CreationDate", annotation.created)) {
2647
- return false;
2648
- }
2649
- if (annotation.custom && !this.setAnnotCustom(annotationPtr, annotation.custom)) {
2650
- return false;
2651
- }
2652
- if (annotation.flags && !this.setAnnotationFlags(annotationPtr, annotation.flags)) {
2653
- return false;
2654
- }
2655
- if (annotation.modified && !this.setAnnotationDate(annotationPtr, "M", annotation.modified)) {
2656
- return false;
2657
- }
2658
2755
  if (!this.setBorderStyle(annotationPtr, PdfAnnotationBorderStyle.SOLID, 0)) {
2659
2756
  return false;
2660
2757
  }
2661
- if (!this.setAnnotString(annotationPtr, "Contents", annotation.contents ?? "")) {
2662
- return false;
2663
- }
2664
- if (!this.setAnnotString(annotationPtr, "T", annotation.author || "")) {
2665
- return false;
2666
- }
2667
2758
  if (!this.setAnnotationOpacity(annotationPtr, annotation.opacity ?? 1)) {
2668
2759
  return false;
2669
2760
  }
@@ -2684,18 +2775,15 @@ class PdfiumNative {
2684
2775
  if (annotation.intent && !this.setAnnotIntent(annotationPtr, annotation.intent)) {
2685
2776
  return false;
2686
2777
  }
2687
- if (!annotation.backgroundColor || annotation.backgroundColor === "transparent") {
2778
+ const bgColor = annotation.color ?? annotation.backgroundColor;
2779
+ if (!bgColor || bgColor === "transparent") {
2688
2780
  if (!this.pdfiumModule.EPDFAnnot_ClearColor(annotationPtr, PdfAnnotationColorType.Color)) {
2689
2781
  return false;
2690
2782
  }
2691
- } else if (!this.setAnnotationColor(
2692
- annotationPtr,
2693
- annotation.backgroundColor ?? "#FFFFFF",
2694
- PdfAnnotationColorType.Color
2695
- )) {
2783
+ } else if (!this.setAnnotationColor(annotationPtr, bgColor ?? "#FFFFFF", PdfAnnotationColorType.Color)) {
2696
2784
  return false;
2697
2785
  }
2698
- return true;
2786
+ return this.applyBaseAnnotationProperties(pagePtr, annotationPtr, annotation);
2699
2787
  }
2700
2788
  /**
2701
2789
  * Set the rect of specified annotation
@@ -2708,41 +2796,20 @@ class PdfiumNative {
2708
2796
  * @private
2709
2797
  */
2710
2798
  addInkStroke(page, pagePtr, annotationPtr, annotation) {
2711
- if (annotation.created && !this.setAnnotationDate(annotationPtr, "CreationDate", annotation.created)) {
2712
- return false;
2713
- }
2714
- if (annotation.custom && !this.setAnnotCustom(annotationPtr, annotation.custom)) {
2715
- return false;
2716
- }
2717
- if (annotation.flags && !this.setAnnotationFlags(annotationPtr, annotation.flags)) {
2718
- return false;
2719
- }
2720
- if (annotation.modified && !this.setAnnotationDate(annotationPtr, "M", annotation.modified)) {
2721
- return false;
2722
- }
2723
- if (!this.setAnnotString(annotationPtr, "Contents", annotation.contents ?? "")) {
2724
- return false;
2725
- }
2726
2799
  if (!this.setBorderStyle(annotationPtr, PdfAnnotationBorderStyle.SOLID, annotation.strokeWidth)) {
2727
2800
  return false;
2728
2801
  }
2729
2802
  if (!this.setInkList(page, annotationPtr, annotation.inkList)) {
2730
2803
  return false;
2731
2804
  }
2732
- if (!this.setAnnotString(annotationPtr, "T", annotation.author || "")) {
2733
- return false;
2734
- }
2735
2805
  if (!this.setAnnotationOpacity(annotationPtr, annotation.opacity ?? 1)) {
2736
2806
  return false;
2737
2807
  }
2738
- if (!this.setAnnotationColor(
2739
- annotationPtr,
2740
- annotation.color ?? "#FFFF00",
2741
- PdfAnnotationColorType.Color
2742
- )) {
2808
+ const strokeColor = annotation.strokeColor ?? annotation.color ?? "#FFFF00";
2809
+ if (!this.setAnnotationColor(annotationPtr, strokeColor, PdfAnnotationColorType.Color)) {
2743
2810
  return false;
2744
2811
  }
2745
- return true;
2812
+ return this.applyBaseAnnotationProperties(pagePtr, annotationPtr, annotation);
2746
2813
  }
2747
2814
  /**
2748
2815
  * Add line content to annotation
@@ -2756,18 +2823,6 @@ class PdfiumNative {
2756
2823
  */
2757
2824
  addLineContent(page, pagePtr, annotationPtr, annotation) {
2758
2825
  var _a, _b;
2759
- if (annotation.created && !this.setAnnotationDate(annotationPtr, "CreationDate", annotation.created)) {
2760
- return false;
2761
- }
2762
- if (annotation.custom && !this.setAnnotCustom(annotationPtr, annotation.custom)) {
2763
- return false;
2764
- }
2765
- if (annotation.flags && !this.setAnnotationFlags(annotationPtr, annotation.flags)) {
2766
- return false;
2767
- }
2768
- if (annotation.modified && !this.setAnnotationDate(annotationPtr, "M", annotation.modified)) {
2769
- return false;
2770
- }
2771
2826
  if (!this.setLinePoints(
2772
2827
  page,
2773
2828
  annotationPtr,
@@ -2783,12 +2838,6 @@ class PdfiumNative {
2783
2838
  )) {
2784
2839
  return false;
2785
2840
  }
2786
- if (!this.setAnnotString(annotationPtr, "Contents", annotation.contents ?? "")) {
2787
- return false;
2788
- }
2789
- if (!this.setAnnotString(annotationPtr, "T", annotation.author || "")) {
2790
- return false;
2791
- }
2792
2841
  if (!this.setBorderStyle(annotationPtr, annotation.strokeStyle, annotation.strokeWidth)) {
2793
2842
  return false;
2794
2843
  }
@@ -2819,7 +2868,7 @@ class PdfiumNative {
2819
2868
  )) {
2820
2869
  return false;
2821
2870
  }
2822
- return true;
2871
+ return this.applyBaseAnnotationProperties(pagePtr, annotationPtr, annotation);
2823
2872
  }
2824
2873
  /**
2825
2874
  * Add polygon or polyline content to annotation
@@ -2833,18 +2882,6 @@ class PdfiumNative {
2833
2882
  */
2834
2883
  addPolyContent(page, pagePtr, annotationPtr, annotation) {
2835
2884
  var _a, _b;
2836
- if (annotation.created && !this.setAnnotationDate(annotationPtr, "CreationDate", annotation.created)) {
2837
- return false;
2838
- }
2839
- if (annotation.custom && !this.setAnnotCustom(annotationPtr, annotation.custom)) {
2840
- return false;
2841
- }
2842
- if (annotation.modified && !this.setAnnotationDate(annotationPtr, "M", annotation.modified)) {
2843
- return false;
2844
- }
2845
- if (annotation.flags && !this.setAnnotationFlags(annotationPtr, annotation.flags)) {
2846
- return false;
2847
- }
2848
2885
  if (annotation.type === PdfAnnotationSubtype.POLYLINE && !this.setLineEndings(
2849
2886
  annotationPtr,
2850
2887
  ((_a = annotation.lineEndings) == null ? void 0 : _a.start) ?? PdfAnnotationLineEnding.None,
@@ -2855,12 +2892,6 @@ class PdfiumNative {
2855
2892
  if (!this.setPdfAnnoVertices(page, annotationPtr, annotation.vertices)) {
2856
2893
  return false;
2857
2894
  }
2858
- if (!this.setAnnotString(annotationPtr, "Contents", annotation.contents ?? "")) {
2859
- return false;
2860
- }
2861
- if (!this.setAnnotString(annotationPtr, "T", annotation.author || "")) {
2862
- return false;
2863
- }
2864
2895
  if (!this.setBorderStyle(annotationPtr, annotation.strokeStyle, annotation.strokeWidth)) {
2865
2896
  return false;
2866
2897
  }
@@ -2891,7 +2922,42 @@ class PdfiumNative {
2891
2922
  )) {
2892
2923
  return false;
2893
2924
  }
2894
- return true;
2925
+ return this.applyBaseAnnotationProperties(pagePtr, annotationPtr, annotation);
2926
+ }
2927
+ /**
2928
+ * Add link content (action or destination) to a link annotation
2929
+ * @param docPtr - pointer to pdf document
2930
+ * @param pagePtr - pointer to the page
2931
+ * @param annotationPtr - pointer to pdf annotation
2932
+ * @param annotation - the link annotation object
2933
+ * @returns true if successful
2934
+ *
2935
+ * @private
2936
+ */
2937
+ addLinkContent(docPtr, pagePtr, annotationPtr, annotation) {
2938
+ const style = annotation.strokeStyle ?? PdfAnnotationBorderStyle.UNDERLINE;
2939
+ const width = annotation.strokeWidth ?? 2;
2940
+ if (!this.setBorderStyle(annotationPtr, style, width)) {
2941
+ return false;
2942
+ }
2943
+ if (annotation.strokeDashArray && !this.setBorderDashPattern(annotationPtr, annotation.strokeDashArray)) {
2944
+ return false;
2945
+ }
2946
+ if (annotation.strokeColor) {
2947
+ if (!this.setAnnotationColor(
2948
+ annotationPtr,
2949
+ annotation.strokeColor,
2950
+ PdfAnnotationColorType.Color
2951
+ )) {
2952
+ return false;
2953
+ }
2954
+ }
2955
+ if (annotation.target) {
2956
+ if (!this.applyLinkTarget(docPtr, annotationPtr, annotation.target)) {
2957
+ return false;
2958
+ }
2959
+ }
2960
+ return this.applyBaseAnnotationProperties(pagePtr, annotationPtr, annotation);
2895
2961
  }
2896
2962
  /**
2897
2963
  * Add shape content to annotation
@@ -2904,30 +2970,12 @@ class PdfiumNative {
2904
2970
  * @private
2905
2971
  */
2906
2972
  addShapeContent(page, pagePtr, annotationPtr, annotation) {
2907
- if (annotation.created && !this.setAnnotationDate(annotationPtr, "CreationDate", annotation.created)) {
2908
- return false;
2909
- }
2910
- if (annotation.custom && !this.setAnnotCustom(annotationPtr, annotation.custom)) {
2911
- return false;
2912
- }
2913
- if (annotation.modified && !this.setAnnotationDate(annotationPtr, "M", annotation.modified)) {
2914
- return false;
2915
- }
2916
- if (!this.setAnnotString(annotationPtr, "Contents", annotation.contents ?? "")) {
2917
- return false;
2918
- }
2919
- if (!this.setAnnotString(annotationPtr, "T", annotation.author || "")) {
2920
- return false;
2921
- }
2922
2973
  if (!this.setBorderStyle(annotationPtr, annotation.strokeStyle, annotation.strokeWidth)) {
2923
2974
  return false;
2924
2975
  }
2925
2976
  if (!this.setBorderDashPattern(annotationPtr, annotation.strokeDashArray ?? [])) {
2926
2977
  return false;
2927
2978
  }
2928
- if (!this.setAnnotationFlags(annotationPtr, annotation.flags)) {
2929
- return false;
2930
- }
2931
2979
  if (!annotation.color || annotation.color === "transparent") {
2932
2980
  if (!this.pdfiumModule.EPDFAnnot_ClearColor(annotationPtr, PdfAnnotationColorType.InteriorColor)) {
2933
2981
  return false;
@@ -2949,7 +2997,7 @@ class PdfiumNative {
2949
2997
  )) {
2950
2998
  return false;
2951
2999
  }
2952
- return true;
3000
+ return this.applyBaseAnnotationProperties(pagePtr, annotationPtr, annotation);
2953
3001
  }
2954
3002
  /**
2955
3003
  * Add highlight content to annotation
@@ -2961,38 +3009,17 @@ class PdfiumNative {
2961
3009
  * @private
2962
3010
  */
2963
3011
  addTextMarkupContent(page, pagePtr, annotationPtr, annotation) {
2964
- if (annotation.created && !this.setAnnotationDate(annotationPtr, "CreationDate", annotation.created)) {
2965
- return false;
2966
- }
2967
- if (annotation.custom && !this.setAnnotCustom(annotationPtr, annotation.custom)) {
2968
- return false;
2969
- }
2970
- if (annotation.flags && !this.setAnnotationFlags(annotationPtr, annotation.flags)) {
2971
- return false;
2972
- }
2973
- if (annotation.modified && !this.setAnnotationDate(annotationPtr, "M", annotation.modified)) {
2974
- return false;
2975
- }
2976
3012
  if (!this.syncQuadPointsAnno(page, annotationPtr, annotation.segmentRects)) {
2977
3013
  return false;
2978
3014
  }
2979
- if (!this.setAnnotString(annotationPtr, "Contents", annotation.contents ?? "")) {
2980
- return false;
2981
- }
2982
- if (!this.setAnnotString(annotationPtr, "T", annotation.author || "")) {
2983
- return false;
2984
- }
2985
3015
  if (!this.setAnnotationOpacity(annotationPtr, annotation.opacity ?? 1)) {
2986
3016
  return false;
2987
3017
  }
2988
- if (!this.setAnnotationColor(
2989
- annotationPtr,
2990
- annotation.color ?? "#FFFF00",
2991
- PdfAnnotationColorType.Color
2992
- )) {
3018
+ const strokeColor = annotation.strokeColor ?? annotation.color ?? "#FFFF00";
3019
+ if (!this.setAnnotationColor(annotationPtr, strokeColor, PdfAnnotationColorType.Color)) {
2993
3020
  return false;
2994
3021
  }
2995
- return true;
3022
+ return this.applyBaseAnnotationProperties(pagePtr, annotationPtr, annotation);
2996
3023
  }
2997
3024
  /**
2998
3025
  * Add contents to stamp annotation
@@ -3007,30 +3034,12 @@ class PdfiumNative {
3007
3034
  * @private
3008
3035
  */
3009
3036
  addStampContent(docPtr, page, pagePtr, annotationPtr, annotation, imageData) {
3010
- if (annotation.created && !this.setAnnotationDate(annotationPtr, "CreationDate", annotation.created)) {
3011
- return false;
3012
- }
3013
- if (annotation.custom && !this.setAnnotCustom(annotationPtr, annotation.custom)) {
3014
- return false;
3015
- }
3016
- if (annotation.flags && !this.setAnnotationFlags(annotationPtr, annotation.flags)) {
3017
- return false;
3018
- }
3019
- if (annotation.modified && !this.setAnnotationDate(annotationPtr, "M", annotation.modified)) {
3020
- return false;
3021
- }
3022
3037
  if (annotation.icon && !this.setAnnotationIcon(annotationPtr, annotation.icon)) {
3023
3038
  return false;
3024
3039
  }
3025
- if (!this.setAnnotString(annotationPtr, "T", annotation.author || "")) {
3026
- return false;
3027
- }
3028
3040
  if (annotation.subject && !this.setAnnotString(annotationPtr, "Subj", annotation.subject)) {
3029
3041
  return false;
3030
3042
  }
3031
- if (!this.setAnnotString(annotationPtr, "Contents", annotation.contents ?? "")) {
3032
- return false;
3033
- }
3034
3043
  if (imageData) {
3035
3044
  for (let i = this.pdfiumModule.FPDFAnnot_GetObjectCount(annotationPtr) - 1; i >= 0; i--) {
3036
3045
  this.pdfiumModule.FPDFAnnot_RemoveObject(annotationPtr, i);
@@ -3042,7 +3051,7 @@ class PdfiumNative {
3042
3051
  if (!this.pdfiumModule.EPDFAnnot_UpdateAppearanceToRect(annotationPtr, PdfStampFit.Cover)) {
3043
3052
  return false;
3044
3053
  }
3045
- return true;
3054
+ return this.applyBaseAnnotationProperties(pagePtr, annotationPtr, annotation);
3046
3055
  }
3047
3056
  /**
3048
3057
  * Add image object to annotation
@@ -4173,6 +4182,28 @@ class PdfiumNative {
4173
4182
  setAnnotationIcon(annotationPtr, icon) {
4174
4183
  return this.pdfiumModule.EPDFAnnot_SetIcon(annotationPtr, icon);
4175
4184
  }
4185
+ /**
4186
+ * Get the reply type of the annotation (RT property per ISO 32000-2)
4187
+ *
4188
+ * @param annotationPtr - pointer to an `FPDF_ANNOTATION`
4189
+ * @returns `PdfAnnotationReplyType`
4190
+ */
4191
+ getReplyType(annotationPtr) {
4192
+ return this.pdfiumModule.EPDFAnnot_GetReplyType(annotationPtr);
4193
+ }
4194
+ /**
4195
+ * Set the reply type of the annotation (RT property per ISO 32000-2)
4196
+ *
4197
+ * @param annotationPtr - pointer to an `FPDF_ANNOTATION`
4198
+ * @param replyType - `PdfAnnotationReplyType`
4199
+ * @returns `true` on success
4200
+ */
4201
+ setReplyType(annotationPtr, replyType) {
4202
+ return this.pdfiumModule.EPDFAnnot_SetReplyType(
4203
+ annotationPtr,
4204
+ replyType ?? PdfAnnotationReplyType.Unknown
4205
+ );
4206
+ }
4176
4207
  /**
4177
4208
  * Border-effect (“cloudy”) helper
4178
4209
  *
@@ -4657,37 +4688,24 @@ class PdfiumNative {
4657
4688
  * @private
4658
4689
  */
4659
4690
  readPdfTextAnno(page, annotationPtr, index) {
4660
- const custom = this.getAnnotCustom(annotationPtr);
4661
4691
  const annoRect = this.readPageAnnoRect(annotationPtr);
4662
4692
  const rect = this.convertPageRectToDeviceRect(page, annoRect);
4663
- const author = this.getAnnotString(annotationPtr, "T");
4664
- const modified = this.getAnnotationDate(annotationPtr, "M");
4665
- const created = this.getAnnotationDate(annotationPtr, "CreationDate");
4666
- const contents = this.getAnnotString(annotationPtr, "Contents") || "";
4667
4693
  const state = this.getAnnotString(annotationPtr, "State");
4668
4694
  const stateModel = this.getAnnotString(annotationPtr, "StateModel");
4669
4695
  const color = this.getAnnotationColor(annotationPtr);
4670
4696
  const opacity = this.getAnnotationOpacity(annotationPtr);
4671
- const inReplyToId = this.getInReplyToId(annotationPtr);
4672
- const flags = this.getAnnotationFlags(annotationPtr);
4673
4697
  const icon = this.getAnnotationIcon(annotationPtr);
4674
4698
  return {
4675
4699
  pageIndex: page.index,
4676
- custom,
4677
4700
  id: index,
4678
4701
  type: PdfAnnotationSubtype.TEXT,
4679
- flags,
4680
- contents,
4702
+ rect,
4681
4703
  color: color ?? "#FFFF00",
4682
4704
  opacity,
4683
- rect,
4684
- inReplyToId,
4685
- author,
4686
- modified,
4687
- created,
4688
4705
  state,
4689
4706
  stateModel,
4690
- icon
4707
+ icon,
4708
+ ...this.readBaseAnnotationProperties(annotationPtr)
4691
4709
  };
4692
4710
  }
4693
4711
  /**
@@ -4700,41 +4718,33 @@ class PdfiumNative {
4700
4718
  * @private
4701
4719
  */
4702
4720
  readPdfFreeTextAnno(page, annotationPtr, index) {
4703
- const custom = this.getAnnotCustom(annotationPtr);
4704
4721
  const annoRect = this.readPageAnnoRect(annotationPtr);
4705
4722
  const rect = this.convertPageRectToDeviceRect(page, annoRect);
4706
- const contents = this.getAnnotString(annotationPtr, "Contents") || "";
4707
- const author = this.getAnnotString(annotationPtr, "T");
4708
- const modified = this.getAnnotationDate(annotationPtr, "M");
4709
- const created = this.getAnnotationDate(annotationPtr, "CreationDate");
4710
4723
  const defaultStyle = this.getAnnotString(annotationPtr, "DS");
4711
4724
  const da = this.getAnnotationDefaultAppearance(annotationPtr);
4712
- const backgroundColor = this.getAnnotationColor(annotationPtr);
4725
+ const bgColor = this.getAnnotationColor(annotationPtr);
4713
4726
  const textAlign = this.getAnnotationTextAlignment(annotationPtr);
4714
4727
  const verticalAlign = this.getAnnotationVerticalAlignment(annotationPtr);
4715
4728
  const opacity = this.getAnnotationOpacity(annotationPtr);
4716
4729
  const richContent = this.getAnnotRichContent(annotationPtr);
4717
- const flags = this.getAnnotationFlags(annotationPtr);
4718
4730
  return {
4719
4731
  pageIndex: page.index,
4720
- custom,
4721
4732
  id: index,
4722
4733
  type: PdfAnnotationSubtype.FREETEXT,
4734
+ rect,
4723
4735
  fontFamily: (da == null ? void 0 : da.fontFamily) ?? PdfStandardFont.Unknown,
4724
4736
  fontSize: (da == null ? void 0 : da.fontSize) ?? 12,
4725
4737
  fontColor: (da == null ? void 0 : da.fontColor) ?? "#000000",
4726
4738
  verticalAlign,
4727
- backgroundColor,
4728
- flags,
4739
+ color: bgColor,
4740
+ // fill color (matches shape convention)
4741
+ backgroundColor: bgColor,
4742
+ // deprecated alias
4729
4743
  opacity,
4730
4744
  textAlign,
4731
4745
  defaultStyle,
4732
4746
  richContent,
4733
- contents,
4734
- author,
4735
- modified,
4736
- created,
4737
- rect
4747
+ ...this.readBaseAnnotationProperties(annotationPtr)
4738
4748
  };
4739
4749
  }
4740
4750
  /**
@@ -4748,17 +4758,21 @@ class PdfiumNative {
4748
4758
  * @private
4749
4759
  */
4750
4760
  readPdfLinkAnno(page, docPtr, annotationPtr, index) {
4751
- const custom = this.getAnnotCustom(annotationPtr);
4752
4761
  const linkPtr = this.pdfiumModule.FPDFAnnot_GetLink(annotationPtr);
4753
4762
  if (!linkPtr) {
4754
4763
  return;
4755
4764
  }
4756
4765
  const annoRect = this.readPageAnnoRect(annotationPtr);
4757
4766
  const rect = this.convertPageRectToDeviceRect(page, annoRect);
4758
- const author = this.getAnnotString(annotationPtr, "T");
4759
- const modified = this.getAnnotationDate(annotationPtr, "M");
4760
- const created = this.getAnnotationDate(annotationPtr, "CreationDate");
4761
- const flags = this.getAnnotationFlags(annotationPtr);
4767
+ const { style: strokeStyle, width: strokeWidth } = this.getBorderStyle(annotationPtr);
4768
+ const strokeColor = this.getAnnotationColor(annotationPtr, PdfAnnotationColorType.Color);
4769
+ let strokeDashArray;
4770
+ if (strokeStyle === PdfAnnotationBorderStyle.DASHED) {
4771
+ const { ok, pattern } = this.getBorderDashPattern(annotationPtr);
4772
+ if (ok) {
4773
+ strokeDashArray = pattern;
4774
+ }
4775
+ }
4762
4776
  const target = this.readPdfLinkAnnoTarget(
4763
4777
  docPtr,
4764
4778
  () => {
@@ -4770,15 +4784,15 @@ class PdfiumNative {
4770
4784
  );
4771
4785
  return {
4772
4786
  pageIndex: page.index,
4773
- custom,
4774
4787
  id: index,
4775
4788
  type: PdfAnnotationSubtype.LINK,
4776
- flags,
4777
- target,
4778
4789
  rect,
4779
- author,
4780
- modified,
4781
- created
4790
+ target,
4791
+ strokeColor,
4792
+ strokeWidth,
4793
+ strokeStyle,
4794
+ strokeDashArray,
4795
+ ...this.readBaseAnnotationProperties(annotationPtr)
4782
4796
  };
4783
4797
  }
4784
4798
  /**
@@ -4792,25 +4806,16 @@ class PdfiumNative {
4792
4806
  * @private
4793
4807
  */
4794
4808
  readPdfWidgetAnno(page, annotationPtr, formHandle, index) {
4795
- const custom = this.getAnnotCustom(annotationPtr);
4796
4809
  const pageRect = this.readPageAnnoRect(annotationPtr);
4797
4810
  const rect = this.convertPageRectToDeviceRect(page, pageRect);
4798
- const author = this.getAnnotString(annotationPtr, "T");
4799
- const modified = this.getAnnotationDate(annotationPtr, "M");
4800
- const created = this.getAnnotationDate(annotationPtr, "CreationDate");
4801
- const flags = this.getAnnotationFlags(annotationPtr);
4802
4811
  const field = this.readPdfWidgetAnnoField(formHandle, annotationPtr);
4803
4812
  return {
4804
4813
  pageIndex: page.index,
4805
- custom,
4806
4814
  id: index,
4807
4815
  type: PdfAnnotationSubtype.WIDGET,
4808
- flags,
4809
4816
  rect,
4810
4817
  field,
4811
- author,
4812
- modified,
4813
- created
4818
+ ...this.readBaseAnnotationProperties(annotationPtr)
4814
4819
  };
4815
4820
  }
4816
4821
  /**
@@ -4823,23 +4828,14 @@ class PdfiumNative {
4823
4828
  * @private
4824
4829
  */
4825
4830
  readPdfFileAttachmentAnno(page, annotationPtr, index) {
4826
- const custom = this.getAnnotCustom(annotationPtr);
4827
4831
  const pageRect = this.readPageAnnoRect(annotationPtr);
4828
4832
  const rect = this.convertPageRectToDeviceRect(page, pageRect);
4829
- const author = this.getAnnotString(annotationPtr, "T");
4830
- const modified = this.getAnnotationDate(annotationPtr, "M");
4831
- const created = this.getAnnotationDate(annotationPtr, "CreationDate");
4832
- const flags = this.getAnnotationFlags(annotationPtr);
4833
4833
  return {
4834
4834
  pageIndex: page.index,
4835
- custom,
4836
4835
  id: index,
4837
4836
  type: PdfAnnotationSubtype.FILEATTACHMENT,
4838
- flags,
4839
4837
  rect,
4840
- author,
4841
- modified,
4842
- created
4838
+ ...this.readBaseAnnotationProperties(annotationPtr)
4843
4839
  };
4844
4840
  }
4845
4841
  /**
@@ -4852,37 +4848,28 @@ class PdfiumNative {
4852
4848
  * @private
4853
4849
  */
4854
4850
  readPdfInkAnno(page, annotationPtr, index) {
4855
- const custom = this.getAnnotCustom(annotationPtr);
4856
4851
  const pageRect = this.readPageAnnoRect(annotationPtr);
4857
4852
  const rect = this.convertPageRectToDeviceRect(page, pageRect);
4858
- const author = this.getAnnotString(annotationPtr, "T");
4859
- const modified = this.getAnnotationDate(annotationPtr, "M");
4860
- const created = this.getAnnotationDate(annotationPtr, "CreationDate");
4861
- const color = this.getAnnotationColor(annotationPtr);
4853
+ const strokeColor = this.getAnnotationColor(annotationPtr) ?? "#FF0000";
4862
4854
  const opacity = this.getAnnotationOpacity(annotationPtr);
4863
4855
  const { width: strokeWidth } = this.getBorderStyle(annotationPtr);
4864
4856
  const inkList = this.getInkList(page, annotationPtr);
4865
4857
  const blendMode = this.pdfiumModule.EPDFAnnot_GetBlendMode(annotationPtr);
4866
4858
  const intent = this.getAnnotIntent(annotationPtr);
4867
- const flags = this.getAnnotationFlags(annotationPtr);
4868
- const contents = this.getAnnotString(annotationPtr, "Contents") || "";
4869
4859
  return {
4870
4860
  pageIndex: page.index,
4871
- custom,
4872
4861
  id: index,
4873
4862
  type: PdfAnnotationSubtype.INK,
4863
+ rect,
4874
4864
  ...intent && { intent },
4875
- contents,
4876
4865
  blendMode,
4877
- flags,
4878
- color: color ?? "#FF0000",
4866
+ strokeColor,
4867
+ color: strokeColor,
4868
+ // deprecated alias
4879
4869
  opacity,
4880
4870
  strokeWidth: strokeWidth === 0 ? 1 : strokeWidth,
4881
- rect,
4882
4871
  inkList,
4883
- author,
4884
- modified,
4885
- created
4872
+ ...this.readBaseAnnotationProperties(annotationPtr)
4886
4873
  };
4887
4874
  }
4888
4875
  /**
@@ -4895,22 +4882,16 @@ class PdfiumNative {
4895
4882
  * @private
4896
4883
  */
4897
4884
  readPdfPolygonAnno(page, annotationPtr, index) {
4898
- const custom = this.getAnnotCustom(annotationPtr);
4899
4885
  const pageRect = this.readPageAnnoRect(annotationPtr);
4900
4886
  const rect = this.convertPageRectToDeviceRect(page, pageRect);
4901
- const author = this.getAnnotString(annotationPtr, "T");
4902
- const modified = this.getAnnotationDate(annotationPtr, "M");
4903
- const created = this.getAnnotationDate(annotationPtr, "CreationDate");
4904
4887
  const vertices = this.readPdfAnnoVertices(page, annotationPtr);
4905
- const contents = this.getAnnotString(annotationPtr, "Contents") || "";
4906
- const flags = this.getAnnotationFlags(annotationPtr);
4907
4888
  const strokeColor = this.getAnnotationColor(annotationPtr);
4908
4889
  const interiorColor = this.getAnnotationColor(
4909
4890
  annotationPtr,
4910
4891
  PdfAnnotationColorType.InteriorColor
4911
4892
  );
4912
4893
  const opacity = this.getAnnotationOpacity(annotationPtr);
4913
- let { style: strokeStyle, width: strokeWidth } = this.getBorderStyle(annotationPtr);
4894
+ const { style: strokeStyle, width: strokeWidth } = this.getBorderStyle(annotationPtr);
4914
4895
  let strokeDashArray;
4915
4896
  if (strokeStyle === PdfAnnotationBorderStyle.DASHED) {
4916
4897
  const { ok, pattern } = this.getBorderDashPattern(annotationPtr);
@@ -4927,22 +4908,17 @@ class PdfiumNative {
4927
4908
  }
4928
4909
  return {
4929
4910
  pageIndex: page.index,
4930
- custom,
4931
4911
  id: index,
4932
4912
  type: PdfAnnotationSubtype.POLYGON,
4933
- contents,
4934
- flags,
4913
+ rect,
4935
4914
  strokeColor: strokeColor ?? "#FF0000",
4936
4915
  color: interiorColor ?? "transparent",
4937
4916
  opacity,
4938
4917
  strokeWidth: strokeWidth === 0 ? 1 : strokeWidth,
4939
4918
  strokeStyle,
4940
4919
  strokeDashArray,
4941
- rect,
4942
4920
  vertices,
4943
- author,
4944
- modified,
4945
- created
4921
+ ...this.readBaseAnnotationProperties(annotationPtr)
4946
4922
  };
4947
4923
  }
4948
4924
  /**
@@ -4955,22 +4931,16 @@ class PdfiumNative {
4955
4931
  * @private
4956
4932
  */
4957
4933
  readPdfPolylineAnno(page, annotationPtr, index) {
4958
- const custom = this.getAnnotCustom(annotationPtr);
4959
4934
  const pageRect = this.readPageAnnoRect(annotationPtr);
4960
4935
  const rect = this.convertPageRectToDeviceRect(page, pageRect);
4961
- const author = this.getAnnotString(annotationPtr, "T");
4962
- const modified = this.getAnnotationDate(annotationPtr, "M");
4963
- const created = this.getAnnotationDate(annotationPtr, "CreationDate");
4964
4936
  const vertices = this.readPdfAnnoVertices(page, annotationPtr);
4965
- const contents = this.getAnnotString(annotationPtr, "Contents") || "";
4966
4937
  const strokeColor = this.getAnnotationColor(annotationPtr);
4967
- const flags = this.getAnnotationFlags(annotationPtr);
4968
4938
  const interiorColor = this.getAnnotationColor(
4969
4939
  annotationPtr,
4970
4940
  PdfAnnotationColorType.InteriorColor
4971
4941
  );
4972
4942
  const opacity = this.getAnnotationOpacity(annotationPtr);
4973
- let { style: strokeStyle, width: strokeWidth } = this.getBorderStyle(annotationPtr);
4943
+ const { style: strokeStyle, width: strokeWidth } = this.getBorderStyle(annotationPtr);
4974
4944
  let strokeDashArray;
4975
4945
  if (strokeStyle === PdfAnnotationBorderStyle.DASHED) {
4976
4946
  const { ok, pattern } = this.getBorderDashPattern(annotationPtr);
@@ -4981,11 +4951,9 @@ class PdfiumNative {
4981
4951
  const lineEndings = this.getLineEndings(annotationPtr);
4982
4952
  return {
4983
4953
  pageIndex: page.index,
4984
- custom,
4985
4954
  id: index,
4986
4955
  type: PdfAnnotationSubtype.POLYLINE,
4987
- contents,
4988
- flags,
4956
+ rect,
4989
4957
  strokeColor: strokeColor ?? "#FF0000",
4990
4958
  color: interiorColor ?? "transparent",
4991
4959
  opacity,
@@ -4993,11 +4961,8 @@ class PdfiumNative {
4993
4961
  strokeStyle,
4994
4962
  strokeDashArray,
4995
4963
  lineEndings,
4996
- rect,
4997
4964
  vertices,
4998
- author,
4999
- modified,
5000
- created
4965
+ ...this.readBaseAnnotationProperties(annotationPtr)
5001
4966
  };
5002
4967
  }
5003
4968
  /**
@@ -5010,23 +4975,17 @@ class PdfiumNative {
5010
4975
  * @private
5011
4976
  */
5012
4977
  readPdfLineAnno(page, annotationPtr, index) {
5013
- const custom = this.getAnnotCustom(annotationPtr);
5014
4978
  const pageRect = this.readPageAnnoRect(annotationPtr);
5015
4979
  const rect = this.convertPageRectToDeviceRect(page, pageRect);
5016
- const author = this.getAnnotString(annotationPtr, "T");
5017
- const modified = this.getAnnotationDate(annotationPtr, "M");
5018
- const created = this.getAnnotationDate(annotationPtr, "CreationDate");
5019
4980
  const linePoints = this.getLinePoints(page, annotationPtr);
5020
4981
  const lineEndings = this.getLineEndings(annotationPtr);
5021
- const contents = this.getAnnotString(annotationPtr, "Contents") || "";
5022
4982
  const strokeColor = this.getAnnotationColor(annotationPtr);
5023
- const flags = this.getAnnotationFlags(annotationPtr);
5024
4983
  const interiorColor = this.getAnnotationColor(
5025
4984
  annotationPtr,
5026
4985
  PdfAnnotationColorType.InteriorColor
5027
4986
  );
5028
4987
  const opacity = this.getAnnotationOpacity(annotationPtr);
5029
- let { style: strokeStyle, width: strokeWidth } = this.getBorderStyle(annotationPtr);
4988
+ const { style: strokeStyle, width: strokeWidth } = this.getBorderStyle(annotationPtr);
5030
4989
  let strokeDashArray;
5031
4990
  if (strokeStyle === PdfAnnotationBorderStyle.DASHED) {
5032
4991
  const { ok, pattern } = this.getBorderDashPattern(annotationPtr);
@@ -5036,12 +4995,9 @@ class PdfiumNative {
5036
4995
  }
5037
4996
  return {
5038
4997
  pageIndex: page.index,
5039
- custom,
5040
4998
  id: index,
5041
4999
  type: PdfAnnotationSubtype.LINE,
5042
- flags,
5043
5000
  rect,
5044
- contents,
5045
5001
  strokeWidth: strokeWidth === 0 ? 1 : strokeWidth,
5046
5002
  strokeStyle,
5047
5003
  strokeDashArray,
@@ -5053,9 +5009,7 @@ class PdfiumNative {
5053
5009
  start: PdfAnnotationLineEnding.None,
5054
5010
  end: PdfAnnotationLineEnding.None
5055
5011
  },
5056
- author,
5057
- modified,
5058
- created
5012
+ ...this.readBaseAnnotationProperties(annotationPtr)
5059
5013
  };
5060
5014
  }
5061
5015
  /**
@@ -5068,33 +5022,24 @@ class PdfiumNative {
5068
5022
  * @private
5069
5023
  */
5070
5024
  readPdfHighlightAnno(page, annotationPtr, index) {
5071
- const custom = this.getAnnotCustom(annotationPtr);
5072
5025
  const pageRect = this.readPageAnnoRect(annotationPtr);
5073
5026
  const rect = this.convertPageRectToDeviceRect(page, pageRect);
5074
5027
  const segmentRects = this.getQuadPointsAnno(page, annotationPtr);
5075
- const color = this.getAnnotationColor(annotationPtr);
5028
+ const strokeColor = this.getAnnotationColor(annotationPtr) ?? "#FFFF00";
5076
5029
  const opacity = this.getAnnotationOpacity(annotationPtr);
5077
5030
  const blendMode = this.pdfiumModule.EPDFAnnot_GetBlendMode(annotationPtr);
5078
- const author = this.getAnnotString(annotationPtr, "T");
5079
- const modified = this.getAnnotationDate(annotationPtr, "M");
5080
- const created = this.getAnnotationDate(annotationPtr, "CreationDate");
5081
- const contents = this.getAnnotString(annotationPtr, "Contents") || "";
5082
- const flags = this.getAnnotationFlags(annotationPtr);
5083
5031
  return {
5084
5032
  pageIndex: page.index,
5085
- custom,
5086
5033
  id: index,
5087
- blendMode,
5088
5034
  type: PdfAnnotationSubtype.HIGHLIGHT,
5089
5035
  rect,
5090
- flags,
5091
- contents,
5036
+ blendMode,
5092
5037
  segmentRects,
5093
- color: color ?? "#FFFF00",
5038
+ strokeColor,
5039
+ color: strokeColor,
5040
+ // deprecated alias
5094
5041
  opacity,
5095
- author,
5096
- modified,
5097
- created
5042
+ ...this.readBaseAnnotationProperties(annotationPtr)
5098
5043
  };
5099
5044
  }
5100
5045
  /**
@@ -5107,33 +5052,24 @@ class PdfiumNative {
5107
5052
  * @private
5108
5053
  */
5109
5054
  readPdfUnderlineAnno(page, annotationPtr, index) {
5110
- const custom = this.getAnnotCustom(annotationPtr);
5111
5055
  const pageRect = this.readPageAnnoRect(annotationPtr);
5112
5056
  const rect = this.convertPageRectToDeviceRect(page, pageRect);
5113
- const author = this.getAnnotString(annotationPtr, "T");
5114
- const modified = this.getAnnotationDate(annotationPtr, "M");
5115
- const created = this.getAnnotationDate(annotationPtr, "CreationDate");
5116
5057
  const segmentRects = this.getQuadPointsAnno(page, annotationPtr);
5117
- const contents = this.getAnnotString(annotationPtr, "Contents") || "";
5118
- const color = this.getAnnotationColor(annotationPtr);
5058
+ const strokeColor = this.getAnnotationColor(annotationPtr) ?? "#FF0000";
5119
5059
  const opacity = this.getAnnotationOpacity(annotationPtr);
5120
5060
  const blendMode = this.pdfiumModule.EPDFAnnot_GetBlendMode(annotationPtr);
5121
- const flags = this.getAnnotationFlags(annotationPtr);
5122
5061
  return {
5123
5062
  pageIndex: page.index,
5124
- custom,
5125
5063
  id: index,
5126
- blendMode,
5127
5064
  type: PdfAnnotationSubtype.UNDERLINE,
5128
5065
  rect,
5129
- flags,
5130
- contents,
5066
+ blendMode,
5131
5067
  segmentRects,
5132
- color: color ?? "#FF0000",
5068
+ strokeColor,
5069
+ color: strokeColor,
5070
+ // deprecated alias
5133
5071
  opacity,
5134
- author,
5135
- modified,
5136
- created
5072
+ ...this.readBaseAnnotationProperties(annotationPtr)
5137
5073
  };
5138
5074
  }
5139
5075
  /**
@@ -5146,33 +5082,24 @@ class PdfiumNative {
5146
5082
  * @private
5147
5083
  */
5148
5084
  readPdfStrikeOutAnno(page, annotationPtr, index) {
5149
- const custom = this.getAnnotCustom(annotationPtr);
5150
5085
  const pageRect = this.readPageAnnoRect(annotationPtr);
5151
5086
  const rect = this.convertPageRectToDeviceRect(page, pageRect);
5152
- const author = this.getAnnotString(annotationPtr, "T");
5153
- const modified = this.getAnnotationDate(annotationPtr, "M");
5154
- const created = this.getAnnotationDate(annotationPtr, "CreationDate");
5155
5087
  const segmentRects = this.getQuadPointsAnno(page, annotationPtr);
5156
- const contents = this.getAnnotString(annotationPtr, "Contents") || "";
5157
- const color = this.getAnnotationColor(annotationPtr);
5088
+ const strokeColor = this.getAnnotationColor(annotationPtr) ?? "#FF0000";
5158
5089
  const opacity = this.getAnnotationOpacity(annotationPtr);
5159
5090
  const blendMode = this.pdfiumModule.EPDFAnnot_GetBlendMode(annotationPtr);
5160
- const flags = this.getAnnotationFlags(annotationPtr);
5161
5091
  return {
5162
5092
  pageIndex: page.index,
5163
- custom,
5164
5093
  id: index,
5165
- blendMode,
5166
5094
  type: PdfAnnotationSubtype.STRIKEOUT,
5167
- flags,
5168
5095
  rect,
5169
- contents,
5096
+ blendMode,
5170
5097
  segmentRects,
5171
- color: color ?? "#FF0000",
5098
+ strokeColor,
5099
+ color: strokeColor,
5100
+ // deprecated alias
5172
5101
  opacity,
5173
- author,
5174
- modified,
5175
- created
5102
+ ...this.readBaseAnnotationProperties(annotationPtr)
5176
5103
  };
5177
5104
  }
5178
5105
  /**
@@ -5185,33 +5112,24 @@ class PdfiumNative {
5185
5112
  * @private
5186
5113
  */
5187
5114
  readPdfSquigglyAnno(page, annotationPtr, index) {
5188
- const custom = this.getAnnotCustom(annotationPtr);
5189
5115
  const pageRect = this.readPageAnnoRect(annotationPtr);
5190
5116
  const rect = this.convertPageRectToDeviceRect(page, pageRect);
5191
- const author = this.getAnnotString(annotationPtr, "T");
5192
- const modified = this.getAnnotationDate(annotationPtr, "M");
5193
- const created = this.getAnnotationDate(annotationPtr, "CreationDate");
5194
5117
  const segmentRects = this.getQuadPointsAnno(page, annotationPtr);
5195
- const contents = this.getAnnotString(annotationPtr, "Contents") || "";
5196
- const color = this.getAnnotationColor(annotationPtr);
5118
+ const strokeColor = this.getAnnotationColor(annotationPtr) ?? "#FF0000";
5197
5119
  const opacity = this.getAnnotationOpacity(annotationPtr);
5198
5120
  const blendMode = this.pdfiumModule.EPDFAnnot_GetBlendMode(annotationPtr);
5199
- const flags = this.getAnnotationFlags(annotationPtr);
5200
5121
  return {
5201
5122
  pageIndex: page.index,
5202
- custom,
5203
5123
  id: index,
5204
- blendMode,
5205
5124
  type: PdfAnnotationSubtype.SQUIGGLY,
5206
5125
  rect,
5207
- flags,
5208
- contents,
5126
+ blendMode,
5209
5127
  segmentRects,
5210
- color: color ?? "#FF0000",
5128
+ strokeColor,
5129
+ color: strokeColor,
5130
+ // deprecated alias
5211
5131
  opacity,
5212
- author,
5213
- modified,
5214
- created
5132
+ ...this.readBaseAnnotationProperties(annotationPtr)
5215
5133
  };
5216
5134
  }
5217
5135
  /**
@@ -5224,23 +5142,14 @@ class PdfiumNative {
5224
5142
  * @private
5225
5143
  */
5226
5144
  readPdfCaretAnno(page, annotationPtr, index) {
5227
- const custom = this.getAnnotCustom(annotationPtr);
5228
5145
  const pageRect = this.readPageAnnoRect(annotationPtr);
5229
5146
  const rect = this.convertPageRectToDeviceRect(page, pageRect);
5230
- const author = this.getAnnotString(annotationPtr, "T");
5231
- const modified = this.getAnnotationDate(annotationPtr, "M");
5232
- const created = this.getAnnotationDate(annotationPtr, "CreationDate");
5233
- const flags = this.getAnnotationFlags(annotationPtr);
5234
5147
  return {
5235
5148
  pageIndex: page.index,
5236
- custom,
5237
5149
  id: index,
5238
5150
  type: PdfAnnotationSubtype.CARET,
5239
5151
  rect,
5240
- flags,
5241
- author,
5242
- modified,
5243
- created
5152
+ ...this.readBaseAnnotationProperties(annotationPtr)
5244
5153
  };
5245
5154
  }
5246
5155
  /**
@@ -5253,25 +5162,14 @@ class PdfiumNative {
5253
5162
  * @private
5254
5163
  */
5255
5164
  readPdfStampAnno(page, annotationPtr, index) {
5256
- const custom = this.getAnnotCustom(annotationPtr);
5257
5165
  const pageRect = this.readPageAnnoRect(annotationPtr);
5258
5166
  const rect = this.convertPageRectToDeviceRect(page, pageRect);
5259
- const author = this.getAnnotString(annotationPtr, "T");
5260
- const modified = this.getAnnotationDate(annotationPtr, "M");
5261
- const created = this.getAnnotationDate(annotationPtr, "CreationDate");
5262
- const flags = this.getAnnotationFlags(annotationPtr);
5263
- const contents = this.getAnnotString(annotationPtr, "Contents") || "";
5264
5167
  return {
5265
5168
  pageIndex: page.index,
5266
- custom,
5267
5169
  id: index,
5268
5170
  type: PdfAnnotationSubtype.STAMP,
5269
- contents,
5270
5171
  rect,
5271
- author,
5272
- modified,
5273
- created,
5274
- flags
5172
+ ...this.readBaseAnnotationProperties(annotationPtr)
5275
5173
  };
5276
5174
  }
5277
5175
  /**
@@ -5507,21 +5405,15 @@ class PdfiumNative {
5507
5405
  * @private
5508
5406
  */
5509
5407
  readPdfCircleAnno(page, annotationPtr, index) {
5510
- const custom = this.getAnnotCustom(annotationPtr);
5511
- const flags = this.getAnnotationFlags(annotationPtr);
5512
5408
  const pageRect = this.readPageAnnoRect(annotationPtr);
5513
5409
  const rect = this.convertPageRectToDeviceRect(page, pageRect);
5514
- const author = this.getAnnotString(annotationPtr, "T");
5515
- const modified = this.getAnnotationDate(annotationPtr, "M");
5516
- const created = this.getAnnotationDate(annotationPtr, "CreationDate");
5517
- const contents = this.getAnnotString(annotationPtr, "Contents") || "";
5518
5410
  const interiorColor = this.getAnnotationColor(
5519
5411
  annotationPtr,
5520
5412
  PdfAnnotationColorType.InteriorColor
5521
5413
  );
5522
5414
  const strokeColor = this.getAnnotationColor(annotationPtr);
5523
5415
  const opacity = this.getAnnotationOpacity(annotationPtr);
5524
- let { style: strokeStyle, width: strokeWidth } = this.getBorderStyle(annotationPtr);
5416
+ const { style: strokeStyle, width: strokeWidth } = this.getBorderStyle(annotationPtr);
5525
5417
  let strokeDashArray;
5526
5418
  if (strokeStyle === PdfAnnotationBorderStyle.DASHED) {
5527
5419
  const { ok, pattern } = this.getBorderDashPattern(annotationPtr);
@@ -5531,21 +5423,16 @@ class PdfiumNative {
5531
5423
  }
5532
5424
  return {
5533
5425
  pageIndex: page.index,
5534
- custom,
5535
5426
  id: index,
5536
5427
  type: PdfAnnotationSubtype.CIRCLE,
5537
- flags,
5428
+ rect,
5538
5429
  color: interiorColor ?? "transparent",
5539
5430
  opacity,
5540
- contents,
5541
5431
  strokeWidth,
5542
5432
  strokeColor: strokeColor ?? "#FF0000",
5543
5433
  strokeStyle,
5544
- rect,
5545
- author,
5546
- modified,
5547
- created,
5548
- ...strokeDashArray !== void 0 && { strokeDashArray }
5434
+ ...strokeDashArray !== void 0 && { strokeDashArray },
5435
+ ...this.readBaseAnnotationProperties(annotationPtr)
5549
5436
  };
5550
5437
  }
5551
5438
  /**
@@ -5558,21 +5445,15 @@ class PdfiumNative {
5558
5445
  * @private
5559
5446
  */
5560
5447
  readPdfSquareAnno(page, annotationPtr, index) {
5561
- const custom = this.getAnnotCustom(annotationPtr);
5562
- const flags = this.getAnnotationFlags(annotationPtr);
5563
5448
  const pageRect = this.readPageAnnoRect(annotationPtr);
5564
5449
  const rect = this.convertPageRectToDeviceRect(page, pageRect);
5565
- const author = this.getAnnotString(annotationPtr, "T");
5566
- const modified = this.getAnnotationDate(annotationPtr, "M");
5567
- const created = this.getAnnotationDate(annotationPtr, "CreationDate");
5568
- const contents = this.getAnnotString(annotationPtr, "Contents") || "";
5569
5450
  const interiorColor = this.getAnnotationColor(
5570
5451
  annotationPtr,
5571
5452
  PdfAnnotationColorType.InteriorColor
5572
5453
  );
5573
5454
  const strokeColor = this.getAnnotationColor(annotationPtr);
5574
5455
  const opacity = this.getAnnotationOpacity(annotationPtr);
5575
- let { style: strokeStyle, width: strokeWidth } = this.getBorderStyle(annotationPtr);
5456
+ const { style: strokeStyle, width: strokeWidth } = this.getBorderStyle(annotationPtr);
5576
5457
  let strokeDashArray;
5577
5458
  if (strokeStyle === PdfAnnotationBorderStyle.DASHED) {
5578
5459
  const { ok, pattern } = this.getBorderDashPattern(annotationPtr);
@@ -5582,21 +5463,16 @@ class PdfiumNative {
5582
5463
  }
5583
5464
  return {
5584
5465
  pageIndex: page.index,
5585
- custom,
5586
5466
  id: index,
5587
5467
  type: PdfAnnotationSubtype.SQUARE,
5588
- flags,
5468
+ rect,
5589
5469
  color: interiorColor ?? "transparent",
5590
5470
  opacity,
5591
- contents,
5592
5471
  strokeColor: strokeColor ?? "#FF0000",
5593
5472
  strokeWidth,
5594
5473
  strokeStyle,
5595
- rect,
5596
- author,
5597
- modified,
5598
- created,
5599
- ...strokeDashArray !== void 0 && { strokeDashArray }
5474
+ ...strokeDashArray !== void 0 && { strokeDashArray },
5475
+ ...this.readBaseAnnotationProperties(annotationPtr)
5600
5476
  };
5601
5477
  }
5602
5478
  /**
@@ -5610,23 +5486,14 @@ class PdfiumNative {
5610
5486
  * @private
5611
5487
  */
5612
5488
  readPdfAnno(page, type, annotationPtr, index) {
5613
- const custom = this.getAnnotCustom(annotationPtr);
5614
5489
  const pageRect = this.readPageAnnoRect(annotationPtr);
5615
5490
  const rect = this.convertPageRectToDeviceRect(page, pageRect);
5616
- const author = this.getAnnotString(annotationPtr, "T");
5617
- const modified = this.getAnnotationDate(annotationPtr, "M");
5618
- const created = this.getAnnotationDate(annotationPtr, "CreationDate");
5619
- const flags = this.getAnnotationFlags(annotationPtr);
5620
5491
  return {
5621
5492
  pageIndex: page.index,
5622
- custom,
5623
5493
  id: index,
5624
- flags,
5625
5494
  type,
5626
5495
  rect,
5627
- author,
5628
- modified,
5629
- created
5496
+ ...this.readBaseAnnotationProperties(annotationPtr)
5630
5497
  };
5631
5498
  }
5632
5499
  /**
@@ -5651,10 +5518,86 @@ class PdfiumNative {
5651
5518
  * @returns `true` on success
5652
5519
  */
5653
5520
  setInReplyToId(pagePtr, annotationPtr, id) {
5521
+ if (!id) {
5522
+ return this.pdfiumModule.EPDFAnnot_SetLinkedAnnot(annotationPtr, "IRT", 0);
5523
+ }
5654
5524
  const parentPtr = this.getAnnotationByName(pagePtr, id);
5655
5525
  if (!parentPtr) return false;
5656
5526
  return this.pdfiumModule.EPDFAnnot_SetLinkedAnnot(annotationPtr, "IRT", parentPtr);
5657
5527
  }
5528
+ /**
5529
+ * Apply all base annotation properties from PdfAnnotationObjectBase.
5530
+ * The setInReplyToId and setReplyType functions handle clearing when undefined.
5531
+ *
5532
+ * @param pagePtr - pointer to page object
5533
+ * @param annotationPtr - pointer to annotation object
5534
+ * @param annotation - the annotation object containing properties to apply
5535
+ * @returns `true` on success
5536
+ */
5537
+ applyBaseAnnotationProperties(pagePtr, annotationPtr, annotation) {
5538
+ if (!this.setAnnotString(annotationPtr, "T", annotation.author || "")) {
5539
+ return false;
5540
+ }
5541
+ if (!this.setAnnotString(annotationPtr, "Contents", annotation.contents ?? "")) {
5542
+ return false;
5543
+ }
5544
+ if (annotation.modified) {
5545
+ if (!this.setAnnotationDate(annotationPtr, "M", annotation.modified)) {
5546
+ return false;
5547
+ }
5548
+ }
5549
+ if (annotation.created) {
5550
+ if (!this.setAnnotationDate(annotationPtr, "CreationDate", annotation.created)) {
5551
+ return false;
5552
+ }
5553
+ }
5554
+ if (annotation.flags) {
5555
+ if (!this.setAnnotationFlags(annotationPtr, annotation.flags)) {
5556
+ return false;
5557
+ }
5558
+ }
5559
+ if (annotation.custom) {
5560
+ if (!this.setAnnotCustom(annotationPtr, annotation.custom)) {
5561
+ return false;
5562
+ }
5563
+ }
5564
+ if (!this.setInReplyToId(pagePtr, annotationPtr, annotation.inReplyToId)) {
5565
+ return false;
5566
+ }
5567
+ if (!this.setReplyType(annotationPtr, annotation.replyType)) {
5568
+ return false;
5569
+ }
5570
+ return true;
5571
+ }
5572
+ /**
5573
+ * Read all base annotation properties from PdfAnnotationObjectBase.
5574
+ * Returns an object that can be spread into the annotation return value.
5575
+ *
5576
+ * @param annotationPtr - pointer to annotation object
5577
+ * @returns object with base annotation properties
5578
+ */
5579
+ readBaseAnnotationProperties(annotationPtr) {
5580
+ const author = this.getAnnotString(annotationPtr, "T");
5581
+ const contents = this.getAnnotString(annotationPtr, "Contents") || "";
5582
+ const modified = this.getAnnotationDate(annotationPtr, "M");
5583
+ const created = this.getAnnotationDate(annotationPtr, "CreationDate");
5584
+ const flags = this.getAnnotationFlags(annotationPtr);
5585
+ const custom = this.getAnnotCustom(annotationPtr);
5586
+ const inReplyToId = this.getInReplyToId(annotationPtr);
5587
+ const replyType = this.getReplyType(annotationPtr);
5588
+ return {
5589
+ author,
5590
+ contents,
5591
+ modified,
5592
+ created,
5593
+ flags,
5594
+ custom,
5595
+ // Only include IRT if present
5596
+ ...inReplyToId && { inReplyToId },
5597
+ // Only include RT if present and not the default (Reply)
5598
+ ...replyType && replyType !== PdfAnnotationReplyType.Reply && { replyType }
5599
+ };
5600
+ }
5658
5601
  /**
5659
5602
  * Fetch a string value (`/T`, `/M`, `/State`, …) from an annotation.
5660
5603
  *
@@ -6369,6 +6312,51 @@ class PdfiumNative {
6369
6312
  return false;
6370
6313
  }
6371
6314
  }
6315
+ /**
6316
+ * Apply a link target (action or destination) to a link annotation
6317
+ * @param docPtr - pointer to pdf document
6318
+ * @param annotationPtr - pointer to the link annotation
6319
+ * @param target - the link target to apply
6320
+ * @returns true if successful
6321
+ *
6322
+ * @private
6323
+ */
6324
+ applyLinkTarget(docPtr, annotationPtr, target) {
6325
+ if (target.type === "destination") {
6326
+ const destPtr = this.createLocalDestPtr(docPtr, target.destination);
6327
+ if (!destPtr) return false;
6328
+ const actPtr = this.pdfiumModule.EPDFAction_CreateGoTo(docPtr, destPtr);
6329
+ if (!actPtr) return false;
6330
+ return !!this.pdfiumModule.EPDFAnnot_SetAction(annotationPtr, actPtr);
6331
+ }
6332
+ const action = target.action;
6333
+ switch (action.type) {
6334
+ case PdfActionType.Goto: {
6335
+ const destPtr = this.createLocalDestPtr(docPtr, action.destination);
6336
+ if (!destPtr) return false;
6337
+ const actPtr = this.pdfiumModule.EPDFAction_CreateGoTo(docPtr, destPtr);
6338
+ if (!actPtr) return false;
6339
+ return !!this.pdfiumModule.EPDFAnnot_SetAction(annotationPtr, actPtr);
6340
+ }
6341
+ case PdfActionType.URI: {
6342
+ const actPtr = this.pdfiumModule.EPDFAction_CreateURI(docPtr, action.uri);
6343
+ if (!actPtr) return false;
6344
+ return !!this.pdfiumModule.EPDFAnnot_SetAction(annotationPtr, actPtr);
6345
+ }
6346
+ case PdfActionType.LaunchAppOrOpenFile: {
6347
+ const actPtr = this.withWString(
6348
+ action.path,
6349
+ (wptr) => this.pdfiumModule.EPDFAction_CreateLaunch(docPtr, wptr)
6350
+ );
6351
+ if (!actPtr) return false;
6352
+ return !!this.pdfiumModule.EPDFAnnot_SetAction(annotationPtr, actPtr);
6353
+ }
6354
+ case PdfActionType.RemoteGoto:
6355
+ case PdfActionType.Unsupported:
6356
+ default:
6357
+ return false;
6358
+ }
6359
+ }
6372
6360
  /**
6373
6361
  * Read pdf action from pdf document
6374
6362
  * @param docPtr - pointer to pdf document object
@@ -7305,4 +7293,4 @@ export {
7305
7293
  isValidCustomKey as i,
7306
7294
  readString as r
7307
7295
  };
7308
- //# sourceMappingURL=direct-engine-CB3k-o0I.js.map
7296
+ //# sourceMappingURL=direct-engine-nrX_KvVy.js.map