@embedpdf/models 2.6.2 → 2.8.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/color.d.ts +5 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -1
- package/dist/pdf.d.ts +98 -7
- package/package.json +1 -1
package/dist/pdf.d.ts
CHANGED
|
@@ -382,6 +382,36 @@ export type ImageDataLike = {
|
|
|
382
382
|
height: number;
|
|
383
383
|
colorSpace?: PredefinedColorSpace;
|
|
384
384
|
};
|
|
385
|
+
/**
|
|
386
|
+
* Bitmask constants for annotation appearance stream modes.
|
|
387
|
+
* @public
|
|
388
|
+
*/
|
|
389
|
+
export declare const AP_MODE_NORMAL = 1;
|
|
390
|
+
export declare const AP_MODE_ROLLOVER = 2;
|
|
391
|
+
export declare const AP_MODE_DOWN = 4;
|
|
392
|
+
/**
|
|
393
|
+
* A rendered appearance stream image for a single mode of an annotation.
|
|
394
|
+
* @public
|
|
395
|
+
*/
|
|
396
|
+
export interface AnnotationAppearanceImage<TImage = ImageDataLike> {
|
|
397
|
+
data: TImage;
|
|
398
|
+
rect: Rect;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* All available appearance stream images for one annotation,
|
|
402
|
+
* keyed by mode (normal, rollover, down).
|
|
403
|
+
* @public
|
|
404
|
+
*/
|
|
405
|
+
export interface AnnotationAppearances<TImage = ImageDataLike> {
|
|
406
|
+
normal?: AnnotationAppearanceImage<TImage>;
|
|
407
|
+
rollover?: AnnotationAppearanceImage<TImage>;
|
|
408
|
+
down?: AnnotationAppearanceImage<TImage>;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Map of annotation ID to its rendered appearance stream images.
|
|
412
|
+
* @public
|
|
413
|
+
*/
|
|
414
|
+
export type AnnotationAppearanceMap<TImage = ImageDataLike> = Record<string, AnnotationAppearances<TImage>>;
|
|
385
415
|
/**
|
|
386
416
|
* Representation of pdf action
|
|
387
417
|
*
|
|
@@ -863,6 +893,18 @@ export declare enum PdfAnnotationReplyType {
|
|
|
863
893
|
*/
|
|
864
894
|
Group = 2
|
|
865
895
|
}
|
|
896
|
+
/**
|
|
897
|
+
* Rectangle differences (/RD) defining the inset between an annotation's
|
|
898
|
+
* /Rect and the actual drawn appearance.
|
|
899
|
+
*
|
|
900
|
+
* @public
|
|
901
|
+
*/
|
|
902
|
+
export interface PdfRectDifferences {
|
|
903
|
+
left: number;
|
|
904
|
+
top: number;
|
|
905
|
+
right: number;
|
|
906
|
+
bottom: number;
|
|
907
|
+
}
|
|
866
908
|
/**
|
|
867
909
|
* Basic information of pdf annotation
|
|
868
910
|
*
|
|
@@ -928,6 +970,12 @@ export interface PdfAnnotationObjectBase {
|
|
|
928
970
|
* Custom data of the annotation
|
|
929
971
|
*/
|
|
930
972
|
custom?: any;
|
|
973
|
+
/**
|
|
974
|
+
* Bitmask of available appearance stream modes.
|
|
975
|
+
* bit 0 (1) = Normal, bit 1 (2) = Rollover, bit 2 (4) = Down.
|
|
976
|
+
* 0 or undefined = no appearance stream.
|
|
977
|
+
*/
|
|
978
|
+
appearanceModes?: number;
|
|
931
979
|
/**
|
|
932
980
|
* In reply to annotation id (IRT - for grouping or reply threads)
|
|
933
981
|
*/
|
|
@@ -996,7 +1044,11 @@ export interface PdfTextAnnoObject extends PdfAnnotationObjectBase {
|
|
|
996
1044
|
*/
|
|
997
1045
|
contents: string;
|
|
998
1046
|
/**
|
|
999
|
-
*
|
|
1047
|
+
* Color of the text annotation (preferred over deprecated `color`)
|
|
1048
|
+
*/
|
|
1049
|
+
strokeColor?: string;
|
|
1050
|
+
/**
|
|
1051
|
+
* @deprecated Use strokeColor instead. Will be removed in next major version.
|
|
1000
1052
|
*/
|
|
1001
1053
|
color?: string;
|
|
1002
1054
|
/**
|
|
@@ -1326,6 +1378,10 @@ export interface PdfPolygonAnnoObject extends PdfAnnotationObjectBase {
|
|
|
1326
1378
|
* stroke dash array of polygon annotation
|
|
1327
1379
|
*/
|
|
1328
1380
|
strokeDashArray?: number[];
|
|
1381
|
+
/**
|
|
1382
|
+
* Rectangle Differences (/RD) - inset padding from Rect to the drawn area.
|
|
1383
|
+
*/
|
|
1384
|
+
rectangleDifferences?: PdfRectDifferences;
|
|
1329
1385
|
}
|
|
1330
1386
|
/**
|
|
1331
1387
|
* PDF polyline annotation
|
|
@@ -1616,9 +1672,9 @@ export interface PdfCircleAnnoObject extends PdfAnnotationObjectBase {
|
|
|
1616
1672
|
*/
|
|
1617
1673
|
cloudyBorderIntensity?: number;
|
|
1618
1674
|
/**
|
|
1619
|
-
*
|
|
1675
|
+
* Rectangle Differences (/RD) - inset padding from Rect to the drawn area.
|
|
1620
1676
|
*/
|
|
1621
|
-
|
|
1677
|
+
rectangleDifferences?: PdfRectDifferences;
|
|
1622
1678
|
}
|
|
1623
1679
|
/**
|
|
1624
1680
|
* Pdf square annotation
|
|
@@ -1665,9 +1721,9 @@ export interface PdfSquareAnnoObject extends PdfAnnotationObjectBase {
|
|
|
1665
1721
|
*/
|
|
1666
1722
|
cloudyBorderIntensity?: number;
|
|
1667
1723
|
/**
|
|
1668
|
-
*
|
|
1724
|
+
* Rectangle Differences (/RD) - inset padding from Rect to the drawn area.
|
|
1669
1725
|
*/
|
|
1670
|
-
|
|
1726
|
+
rectangleDifferences?: PdfRectDifferences;
|
|
1671
1727
|
}
|
|
1672
1728
|
/**
|
|
1673
1729
|
* Pdf squiggly annotation
|
|
@@ -1764,6 +1820,14 @@ export interface PdfStrikeOutAnnoObject extends PdfAnnotationObjectBase {
|
|
|
1764
1820
|
export interface PdfCaretAnnoObject extends PdfAnnotationObjectBase {
|
|
1765
1821
|
/** {@inheritDoc PdfAnnotationObjectBase.type} */
|
|
1766
1822
|
type: PdfAnnotationSubtype.CARET;
|
|
1823
|
+
/** Stroke color of the caret symbol */
|
|
1824
|
+
strokeColor?: string;
|
|
1825
|
+
/** Opacity (0-1) */
|
|
1826
|
+
opacity?: number;
|
|
1827
|
+
/**
|
|
1828
|
+
* Rectangle Differences (/RD) - inset padding from Rect to the drawn area.
|
|
1829
|
+
*/
|
|
1830
|
+
rectangleDifferences?: PdfRectDifferences;
|
|
1767
1831
|
}
|
|
1768
1832
|
/**
|
|
1769
1833
|
* Pdf free text annotation
|
|
@@ -1817,6 +1881,10 @@ export interface PdfFreeTextAnnoObject extends PdfAnnotationObjectBase {
|
|
|
1817
1881
|
* Rich content of the free text annotation
|
|
1818
1882
|
*/
|
|
1819
1883
|
richContent?: string;
|
|
1884
|
+
/**
|
|
1885
|
+
* Rectangle Differences (/RD) - inset padding from Rect to the drawn area.
|
|
1886
|
+
*/
|
|
1887
|
+
rectangleDifferences?: PdfRectDifferences;
|
|
1820
1888
|
}
|
|
1821
1889
|
/**
|
|
1822
1890
|
* Pdf redact annotation
|
|
@@ -2770,6 +2838,24 @@ export interface PdfEngine<T = Blob> {
|
|
|
2770
2838
|
* @param options - render options
|
|
2771
2839
|
*/
|
|
2772
2840
|
renderPageAnnotation(doc: PdfDocumentObject, page: PdfPageObject, annotation: PdfAnnotationObject, options?: PdfRenderPageAnnotationOptions): PdfTask<T>;
|
|
2841
|
+
/**
|
|
2842
|
+
* Batch-render all annotation appearance streams for a page and encode
|
|
2843
|
+
* each rendered image to the output type of this engine.
|
|
2844
|
+
* Returns a map of annotation ID to rendered appearances (Normal/Rollover/Down).
|
|
2845
|
+
* @param doc - pdf document
|
|
2846
|
+
* @param page - pdf page
|
|
2847
|
+
* @param options - render options
|
|
2848
|
+
*/
|
|
2849
|
+
renderPageAnnotations(doc: PdfDocumentObject, page: PdfPageObject, options?: PdfRenderPageAnnotationOptions): PdfTask<AnnotationAppearanceMap<T>>;
|
|
2850
|
+
/**
|
|
2851
|
+
* Batch-render all annotation appearance streams for a page.
|
|
2852
|
+
* Returns a map of annotation ID to rendered appearances (Normal/Rollover/Down).
|
|
2853
|
+
* Skips EmbedPDF-rotated annotations and annotations without appearance streams.
|
|
2854
|
+
* @param doc - pdf document
|
|
2855
|
+
* @param page - pdf page
|
|
2856
|
+
* @param options - render options (scaleFactor, dpr, rotation)
|
|
2857
|
+
*/
|
|
2858
|
+
renderPageAnnotationsRaw(doc: PdfDocumentObject, page: PdfPageObject, options?: PdfRenderPageAnnotationOptions): PdfTask<AnnotationAppearanceMap<ImageDataLike>>;
|
|
2773
2859
|
/**
|
|
2774
2860
|
* Get annotations of pdf page
|
|
2775
2861
|
* @param doc - pdf document
|
|
@@ -2793,7 +2879,9 @@ export interface PdfEngine<T = Blob> {
|
|
|
2793
2879
|
* @param annotation - new annotations
|
|
2794
2880
|
* @returns task that indicates whether the operation succeeded
|
|
2795
2881
|
*/
|
|
2796
|
-
updatePageAnnotation: (doc: PdfDocumentObject, page: PdfPageObject, annotation: PdfAnnotationObject
|
|
2882
|
+
updatePageAnnotation: (doc: PdfDocumentObject, page: PdfPageObject, annotation: PdfAnnotationObject, options?: {
|
|
2883
|
+
regenerateAppearance?: boolean;
|
|
2884
|
+
}) => PdfTask<boolean>;
|
|
2797
2885
|
/**
|
|
2798
2886
|
* Remove a annotation on specified page
|
|
2799
2887
|
* @param doc - pdf document
|
|
@@ -3063,10 +3151,13 @@ export interface IPdfiumExecutor {
|
|
|
3063
3151
|
renderPageRect(doc: PdfDocumentObject, page: PdfPageObject, rect: Rect, options?: PdfRenderPageOptions): PdfTask<ImageDataLike>;
|
|
3064
3152
|
renderThumbnailRaw(doc: PdfDocumentObject, page: PdfPageObject, options?: PdfRenderThumbnailOptions): PdfTask<ImageDataLike>;
|
|
3065
3153
|
renderPageAnnotationRaw(doc: PdfDocumentObject, page: PdfPageObject, annotation: PdfAnnotationObject, options?: PdfRenderPageAnnotationOptions): PdfTask<ImageDataLike>;
|
|
3154
|
+
renderPageAnnotationsRaw(doc: PdfDocumentObject, page: PdfPageObject, options?: PdfRenderPageAnnotationOptions): PdfTask<AnnotationAppearanceMap<ImageDataLike>>;
|
|
3066
3155
|
getPageAnnotationsRaw(doc: PdfDocumentObject, page: PdfPageObject): PdfTask<PdfAnnotationObject[]>;
|
|
3067
3156
|
getPageAnnotations(doc: PdfDocumentObject, page: PdfPageObject): PdfTask<PdfAnnotationObject[]>;
|
|
3068
3157
|
createPageAnnotation<A extends PdfAnnotationObject>(doc: PdfDocumentObject, page: PdfPageObject, annotation: A, context?: AnnotationCreateContext<A>): PdfTask<string>;
|
|
3069
|
-
updatePageAnnotation(doc: PdfDocumentObject, page: PdfPageObject, annotation: PdfAnnotationObject
|
|
3158
|
+
updatePageAnnotation(doc: PdfDocumentObject, page: PdfPageObject, annotation: PdfAnnotationObject, options?: {
|
|
3159
|
+
regenerateAppearance?: boolean;
|
|
3160
|
+
}): PdfTask<boolean>;
|
|
3070
3161
|
removePageAnnotation(doc: PdfDocumentObject, page: PdfPageObject, annotation: PdfAnnotationObject): PdfTask<boolean>;
|
|
3071
3162
|
getPageTextRects(doc: PdfDocumentObject, page: PdfPageObject): PdfTask<PdfTextRectObject[]>;
|
|
3072
3163
|
searchInPage(doc: PdfDocumentObject, page: PdfPageObject, keyword: string, flags: number): PdfTask<SearchResult[]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embedpdf/models",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.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",
|