@embedpdf/models 2.10.0 → 2.11.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.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +45 -31
- package/dist/index.js.map +1 -1
- package/dist/pdf.d.ts +84 -95
- package/package.json +1 -1
package/dist/pdf.d.ts
CHANGED
|
@@ -613,6 +613,10 @@ export declare const PdfAnnotationSubtypeName: Record<PdfAnnotationSubtype, stri
|
|
|
613
613
|
export interface AnnotationContextMap {
|
|
614
614
|
[PdfAnnotationSubtype.STAMP]: {
|
|
615
615
|
imageData: ImageData;
|
|
616
|
+
appearance?: never;
|
|
617
|
+
} | {
|
|
618
|
+
imageData?: never;
|
|
619
|
+
appearance: ArrayBuffer;
|
|
616
620
|
};
|
|
617
621
|
}
|
|
618
622
|
/**
|
|
@@ -697,124 +701,56 @@ export declare enum PdfAnnotationStateModel {
|
|
|
697
701
|
Review = "Review"
|
|
698
702
|
}
|
|
699
703
|
/**
|
|
700
|
-
*
|
|
704
|
+
* Name (/Name entry) of a pdf annotation — identifies the icon for text/sound/file
|
|
705
|
+
* annotations and the stamp type for stamp annotations.
|
|
701
706
|
*
|
|
702
707
|
* @public
|
|
703
708
|
*/
|
|
704
|
-
export declare enum
|
|
705
|
-
/**
|
|
706
|
-
* Unknown icon
|
|
707
|
-
*/
|
|
709
|
+
export declare enum PdfAnnotationName {
|
|
708
710
|
Unknown = -1,
|
|
709
|
-
/**
|
|
710
|
-
* Comment icon
|
|
711
|
-
*/
|
|
712
711
|
Comment = 0,
|
|
713
|
-
/**
|
|
714
|
-
* Key icon
|
|
715
|
-
*/
|
|
716
712
|
Key = 1,
|
|
717
|
-
/**
|
|
718
|
-
* Note icon
|
|
719
|
-
*/
|
|
720
713
|
Note = 2,
|
|
721
|
-
/**
|
|
722
|
-
* Help icon
|
|
723
|
-
*/
|
|
724
714
|
Help = 3,
|
|
725
|
-
/**
|
|
726
|
-
* New paragraph icon
|
|
727
|
-
*/
|
|
728
715
|
NewParagraph = 4,
|
|
729
|
-
/**
|
|
730
|
-
* Paragraph icon
|
|
731
|
-
*/
|
|
732
716
|
Paragraph = 5,
|
|
733
|
-
/**
|
|
734
|
-
* Insert icon
|
|
735
|
-
*/
|
|
736
717
|
Insert = 6,
|
|
737
|
-
/**
|
|
738
|
-
* Graph icon
|
|
739
|
-
*/
|
|
740
718
|
Graph = 7,
|
|
741
|
-
/**
|
|
742
|
-
* Push pin icon
|
|
743
|
-
*/
|
|
744
719
|
PushPin = 8,
|
|
745
|
-
/**
|
|
746
|
-
* Paperclip icon
|
|
747
|
-
*/
|
|
748
720
|
Paperclip = 9,
|
|
749
|
-
/**
|
|
750
|
-
* Tag icon
|
|
751
|
-
*/
|
|
752
721
|
Tag = 10,
|
|
753
|
-
/**
|
|
754
|
-
* Speaker icon
|
|
755
|
-
*/
|
|
756
722
|
Speaker = 11,
|
|
757
|
-
/**
|
|
758
|
-
* Mic icon
|
|
759
|
-
*/
|
|
760
723
|
Mic = 12,
|
|
761
|
-
/**
|
|
762
|
-
* Approved icon
|
|
763
|
-
*/
|
|
764
724
|
Approved = 13,
|
|
765
|
-
/**
|
|
766
|
-
* Experimental icon
|
|
767
|
-
*/
|
|
768
725
|
Experimental = 14,
|
|
769
|
-
/**
|
|
770
|
-
* Not approved icon
|
|
771
|
-
*/
|
|
772
726
|
NotApproved = 15,
|
|
773
|
-
/**
|
|
774
|
-
* As is icon
|
|
775
|
-
*/
|
|
776
727
|
AsIs = 16,
|
|
777
|
-
/**
|
|
778
|
-
* Expired icon
|
|
779
|
-
*/
|
|
780
728
|
Expired = 17,
|
|
781
|
-
/**
|
|
782
|
-
* Not for public release icon
|
|
783
|
-
*/
|
|
784
729
|
NotForPublicRelease = 18,
|
|
785
|
-
/**
|
|
786
|
-
* Confidential icon
|
|
787
|
-
*/
|
|
788
730
|
Confidential = 19,
|
|
789
|
-
/**
|
|
790
|
-
* Final icon
|
|
791
|
-
*/
|
|
792
731
|
Final = 20,
|
|
793
|
-
/**
|
|
794
|
-
* Sold icon
|
|
795
|
-
*/
|
|
796
732
|
Sold = 21,
|
|
797
|
-
/**
|
|
798
|
-
* Departmental icon
|
|
799
|
-
*/
|
|
800
733
|
Departmental = 22,
|
|
801
|
-
/**
|
|
802
|
-
* For comment icon
|
|
803
|
-
*/
|
|
804
734
|
ForComment = 23,
|
|
805
|
-
/**
|
|
806
|
-
* Top secret icon
|
|
807
|
-
*/
|
|
808
735
|
TopSecret = 24,
|
|
809
|
-
/**
|
|
810
|
-
* Draft icon
|
|
811
|
-
*/
|
|
812
736
|
Draft = 25,
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
737
|
+
ForPublicRelease = 26,
|
|
738
|
+
Completed = 27,
|
|
739
|
+
Void = 28,
|
|
740
|
+
PreliminaryResults = 29,
|
|
741
|
+
InformationOnly = 30,
|
|
742
|
+
Rejected = 31,
|
|
743
|
+
Witness = 32,
|
|
744
|
+
InitialHere = 33,
|
|
745
|
+
SignHere = 34,
|
|
746
|
+
Accepted = 35,
|
|
747
|
+
Custom = 36,
|
|
748
|
+
Image = 37
|
|
749
|
+
}
|
|
750
|
+
/** @deprecated Use PdfAnnotationName instead */
|
|
751
|
+
export type PdfAnnotationIcon = PdfAnnotationName;
|
|
752
|
+
/** @deprecated Use PdfAnnotationName instead */
|
|
753
|
+
export declare const PdfAnnotationIcon: typeof PdfAnnotationName;
|
|
818
754
|
/**
|
|
819
755
|
* Line ending of annotation
|
|
820
756
|
*/
|
|
@@ -984,6 +920,10 @@ export interface PdfAnnotationObjectBase {
|
|
|
984
920
|
* Reply type (how this annotation relates to the parent via IRT)
|
|
985
921
|
*/
|
|
986
922
|
replyType?: PdfAnnotationReplyType;
|
|
923
|
+
/**
|
|
924
|
+
* Subject of the annotation
|
|
925
|
+
*/
|
|
926
|
+
subject?: string;
|
|
987
927
|
}
|
|
988
928
|
/**
|
|
989
929
|
* Popup annotation
|
|
@@ -1064,8 +1004,10 @@ export interface PdfTextAnnoObject extends PdfAnnotationObjectBase {
|
|
|
1064
1004
|
*/
|
|
1065
1005
|
stateModel?: PdfAnnotationStateModel;
|
|
1066
1006
|
/**
|
|
1067
|
-
*
|
|
1007
|
+
* Name (/Name entry) of the text annotation
|
|
1068
1008
|
*/
|
|
1009
|
+
name?: PdfAnnotationName;
|
|
1010
|
+
/** @deprecated Use name instead */
|
|
1069
1011
|
icon?: PdfAnnotationIcon;
|
|
1070
1012
|
}
|
|
1071
1013
|
/**
|
|
@@ -1789,13 +1731,11 @@ export interface PdfStampAnnoObject extends PdfAnnotationObjectBase {
|
|
|
1789
1731
|
/** {@inheritDoc PdfAnnotationObjectBase.type} */
|
|
1790
1732
|
type: PdfAnnotationSubtype.STAMP;
|
|
1791
1733
|
/**
|
|
1792
|
-
*
|
|
1734
|
+
* Name (/Name entry) of the stamp annotation
|
|
1793
1735
|
*/
|
|
1736
|
+
name?: PdfAnnotationName;
|
|
1737
|
+
/** @deprecated Use name instead */
|
|
1794
1738
|
icon?: PdfAnnotationIcon;
|
|
1795
|
-
/**
|
|
1796
|
-
* Subject of the stamp annotation
|
|
1797
|
-
*/
|
|
1798
|
-
subject?: string;
|
|
1799
1739
|
}
|
|
1800
1740
|
/**
|
|
1801
1741
|
* Pdf circle annotation
|
|
@@ -2680,7 +2620,8 @@ export declare enum PdfErrorCode {
|
|
|
2680
2620
|
CantSelectText = 26,
|
|
2681
2621
|
CantSelectOption = 27,
|
|
2682
2622
|
CantCheckField = 28,
|
|
2683
|
-
CantSetAnnotString = 29
|
|
2623
|
+
CantSetAnnotString = 29,
|
|
2624
|
+
CantDeletePage = 30
|
|
2684
2625
|
}
|
|
2685
2626
|
export interface PdfErrorReason {
|
|
2686
2627
|
code: PdfErrorCode;
|
|
@@ -2800,6 +2741,11 @@ export interface PdfRenderPageOptions extends PdfRenderOptions {
|
|
|
2800
2741
|
* Whether to render interactive form widgets
|
|
2801
2742
|
*/
|
|
2802
2743
|
withForms?: boolean;
|
|
2744
|
+
/**
|
|
2745
|
+
* When true, the background is transparent instead of white.
|
|
2746
|
+
* Useful for rendering stamp thumbnails or overlay content.
|
|
2747
|
+
*/
|
|
2748
|
+
transparentBackground?: boolean;
|
|
2803
2749
|
}
|
|
2804
2750
|
export interface PdfRenderPageAnnotationOptions extends PdfRenderOptions {
|
|
2805
2751
|
/**
|
|
@@ -3198,6 +3144,28 @@ export interface PdfEngine<T = Blob> {
|
|
|
3198
3144
|
* @returns task contains the new pdf file content
|
|
3199
3145
|
*/
|
|
3200
3146
|
extractPages: (doc: PdfDocumentObject, pageIndexes: number[]) => PdfTask<ArrayBuffer>;
|
|
3147
|
+
/**
|
|
3148
|
+
* Create a new empty PDF document
|
|
3149
|
+
* @param id - unique document identifier
|
|
3150
|
+
* @returns task contains the empty document object
|
|
3151
|
+
*/
|
|
3152
|
+
createDocument: (id: string) => PdfTask<PdfDocumentObject>;
|
|
3153
|
+
/**
|
|
3154
|
+
* Import pages from a source document into a destination document
|
|
3155
|
+
* @param destDoc - destination document
|
|
3156
|
+
* @param srcDoc - source document
|
|
3157
|
+
* @param srcPageIndices - zero-based page indices in the source document
|
|
3158
|
+
* @param insertIndex - position to insert at (defaults to end)
|
|
3159
|
+
* @returns task contains the newly added page objects
|
|
3160
|
+
*/
|
|
3161
|
+
importPages: (destDoc: PdfDocumentObject, srcDoc: PdfDocumentObject, srcPageIndices: number[], insertIndex?: number) => PdfTask<PdfPageObject[]>;
|
|
3162
|
+
/**
|
|
3163
|
+
* Delete a page from a document
|
|
3164
|
+
* @param doc - pdf document
|
|
3165
|
+
* @param pageIndex - zero-based index of the page to delete
|
|
3166
|
+
* @returns task contains the result
|
|
3167
|
+
*/
|
|
3168
|
+
deletePage: (doc: PdfDocumentObject, pageIndex: number) => PdfTask<boolean>;
|
|
3201
3169
|
/**
|
|
3202
3170
|
* Extract text on specified pdf pages
|
|
3203
3171
|
* @param doc - pdf document
|
|
@@ -3237,6 +3205,22 @@ export interface PdfEngine<T = Blob> {
|
|
|
3237
3205
|
* @returns task contains the result
|
|
3238
3206
|
*/
|
|
3239
3207
|
flattenAnnotation: (doc: PdfDocumentObject, page: PdfPageObject, annotation: PdfAnnotationObject) => PdfTask<boolean>;
|
|
3208
|
+
/**
|
|
3209
|
+
* Export an annotation's appearance as a standalone PDF document
|
|
3210
|
+
* @param doc - pdf document
|
|
3211
|
+
* @param page - pdf page
|
|
3212
|
+
* @param annotation - the annotation to export
|
|
3213
|
+
* @returns task contains the exported PDF as ArrayBuffer
|
|
3214
|
+
*/
|
|
3215
|
+
exportAnnotationAppearanceAsPdf: (doc: PdfDocumentObject, page: PdfPageObject, annotation: PdfAnnotationObject) => PdfTask<ArrayBuffer>;
|
|
3216
|
+
/**
|
|
3217
|
+
* Export multiple annotations' appearances as a standalone single-page PDF
|
|
3218
|
+
* @param doc - pdf document
|
|
3219
|
+
* @param page - pdf page
|
|
3220
|
+
* @param annotations - the annotations to export
|
|
3221
|
+
* @returns task contains the exported PDF as ArrayBuffer
|
|
3222
|
+
*/
|
|
3223
|
+
exportAnnotationsAppearanceAsPdf: (doc: PdfDocumentObject, page: PdfPageObject, annotations: PdfAnnotationObject[]) => PdfTask<ArrayBuffer>;
|
|
3240
3224
|
/**
|
|
3241
3225
|
* Extract text on specified pdf pages
|
|
3242
3226
|
* @param doc - pdf document
|
|
@@ -3412,11 +3396,15 @@ export interface IPdfiumExecutor {
|
|
|
3412
3396
|
shareWidgetField(doc: PdfDocumentObject, sourcePage: PdfPageObject, sourceAnnotation: PdfWidgetAnnoObject, targetPage: PdfPageObject, targetAnnotation: PdfWidgetAnnoObject): PdfTask<boolean>;
|
|
3413
3397
|
flattenPage(doc: PdfDocumentObject, page: PdfPageObject, options?: PdfFlattenPageOptions): PdfTask<PdfPageFlattenResult>;
|
|
3414
3398
|
extractPages(doc: PdfDocumentObject, pageIndexes: number[]): PdfTask<ArrayBuffer>;
|
|
3399
|
+
createDocument(id: string): PdfTask<PdfDocumentObject>;
|
|
3400
|
+
importPages(destDoc: PdfDocumentObject, srcDoc: PdfDocumentObject, srcPageIndices: number[], insertIndex?: number): PdfTask<PdfPageObject[]>;
|
|
3415
3401
|
extractText(doc: PdfDocumentObject, pageIndexes: number[]): PdfTask<string>;
|
|
3416
3402
|
redactTextInRects(doc: PdfDocumentObject, page: PdfPageObject, rects: Rect[], options?: PdfRedactTextOptions): PdfTask<boolean>;
|
|
3417
3403
|
applyRedaction(doc: PdfDocumentObject, page: PdfPageObject, annotation: PdfAnnotationObject): PdfTask<boolean>;
|
|
3418
3404
|
applyAllRedactions(doc: PdfDocumentObject, page: PdfPageObject): PdfTask<boolean>;
|
|
3419
3405
|
flattenAnnotation(doc: PdfDocumentObject, page: PdfPageObject, annotation: PdfAnnotationObject): PdfTask<boolean>;
|
|
3406
|
+
exportAnnotationAppearanceAsPdf(doc: PdfDocumentObject, page: PdfPageObject, annotation: PdfAnnotationObject): PdfTask<ArrayBuffer>;
|
|
3407
|
+
exportAnnotationsAppearanceAsPdf(doc: PdfDocumentObject, page: PdfPageObject, annotations: PdfAnnotationObject[]): PdfTask<ArrayBuffer>;
|
|
3420
3408
|
getTextSlices(doc: PdfDocumentObject, slices: PageTextSlice[]): PdfTask<string[]>;
|
|
3421
3409
|
getPageGlyphs(doc: PdfDocumentObject, page: PdfPageObject): PdfTask<PdfGlyphObject[]>;
|
|
3422
3410
|
getPageGeometry(doc: PdfDocumentObject, page: PdfPageObject): PdfTask<PdfPageGeometry>;
|
|
@@ -3427,6 +3415,7 @@ export interface IPdfiumExecutor {
|
|
|
3427
3415
|
pageIndices: number[];
|
|
3428
3416
|
}>): PdfTask<PdfFile>;
|
|
3429
3417
|
preparePrintDocument(doc: PdfDocumentObject, options?: PdfPrintOptions): PdfTask<ArrayBuffer>;
|
|
3418
|
+
deletePage(doc: PdfDocumentObject, pageIndex: number): PdfTask<boolean>;
|
|
3430
3419
|
saveAsCopy(doc: PdfDocumentObject): PdfTask<ArrayBuffer>;
|
|
3431
3420
|
closeDocument(doc: PdfDocumentObject): PdfTask<boolean>;
|
|
3432
3421
|
closeAllDocuments(): PdfTask<boolean>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embedpdf/models",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Shared type definitions, data models, and utility helpers (geometry, tasks, logging, PDF primitives) that underpin every package in the EmbedPDF ecosystem.",
|
|
6
6
|
"type": "module",
|