@embedpdf/models 1.0.14 → 1.0.15

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/pdf.d.ts CHANGED
@@ -484,6 +484,22 @@ export declare enum PdfAnnotationSubtype {
484
484
  * @public
485
485
  */
486
486
  export declare const PdfAnnotationSubtypeName: Record<PdfAnnotationSubtype, string>;
487
+ /**
488
+ * Context map for annotation subtypes
489
+ *
490
+ * @public
491
+ */
492
+ export interface AnnotationContextMap {
493
+ [PdfAnnotationSubtype.STAMP]: {
494
+ imageData: ImageData;
495
+ };
496
+ }
497
+ /**
498
+ * Context type for annotation subtypes
499
+ *
500
+ * @public
501
+ */
502
+ export type AnnotationCreateContext<A extends PdfAnnotationObject> = A['type'] extends keyof AnnotationContextMap ? AnnotationContextMap[A['type']] : undefined;
487
503
  /**
488
504
  * Status of pdf annotation
489
505
  *
@@ -636,6 +652,10 @@ export interface PdfAnnotationObjectBase {
636
652
  * Sub type of annotation
637
653
  */
638
654
  type: PdfAnnotationSubtype;
655
+ /**
656
+ * flags of the annotation
657
+ */
658
+ flags?: PdfAnnotationFlagName[];
639
659
  /**
640
660
  * The index of page that this annotation belong to
641
661
  */
@@ -1257,10 +1277,6 @@ export type PdfStampAnnoObjectContents = Array<PdfPathObject | PdfImageObject |
1257
1277
  export interface PdfStampAnnoObject extends PdfAnnotationObjectBase {
1258
1278
  /** {@inheritDoc PdfAnnotationObjectBase.type} */
1259
1279
  type: PdfAnnotationSubtype.STAMP;
1260
- /**
1261
- * contents in this stamp annotation
1262
- */
1263
- contents: PdfStampAnnoObjectContents;
1264
1280
  }
1265
1281
  /**
1266
1282
  * Pdf circle annotation
@@ -2049,7 +2065,7 @@ export interface PdfEngine<T = Blob> {
2049
2065
  * @param annotation - new annotations
2050
2066
  * @returns task whether the annotations is created successfully
2051
2067
  */
2052
- createPageAnnotation: (doc: PdfDocumentObject, page: PdfPageObject, annotation: PdfAnnotationObject) => PdfTask<number>;
2068
+ createPageAnnotation: <A extends PdfAnnotationObject>(doc: PdfDocumentObject, page: PdfPageObject, annotation: A, context?: AnnotationCreateContext<A>) => PdfTask<number>;
2053
2069
  /**
2054
2070
  * Update a annotation on specified page
2055
2071
  * @param doc - pdf document
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embedpdf/models",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
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",