@vue-pdf-viewer/shared 1.5.0 → 1.6.0-rc.1

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/const.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type InjectionKey, type Reactive, type ComputedRef } from "vue";
2
2
  import type { LocaleKey, Localization, PluginContext } from "./index";
3
- import { EventAnnotation, EventCore } from "./enumerators";
3
+ import { EventAnnotation, EventCore, AnnotationType } from "./enumerators";
4
4
  export declare const PLUGIN_ID: {
5
5
  ANNOTATIONS: string;
6
6
  };
@@ -64,3 +64,5 @@ export declare const DEFAULT_UNDERLINE_COLOR: Record<(typeof UNDERLINE_COLOR)[ke
64
64
  export declare const DEFAULT_STRIKETHROUGH_COLOR: Record<(typeof UNDERLINE_COLOR)[keyof typeof UNDERLINE_COLOR], string>;
65
65
  export declare const DEFAULT_FREE_TEXT_FONT_COLOR: Record<(typeof FREE_TEXT_FONT_COLOR)[keyof typeof FREE_TEXT_FONT_COLOR], string>;
66
66
  export declare const EDITOR_PREFIX: "pdfjs_internal_editor_";
67
+ export declare const XFDF_ELEMENT_TO_ANNOTATION_TYPE: Record<string, AnnotationType>;
68
+ export declare const ANNOTATION_TYPE_TO_XFDF_ELEMENT: Record<number, string>;
package/dist/const.js CHANGED
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * For commercial licensing inquiries, contact: support@vue-pdf-viewer.dev
12
12
  */
13
- import { EventAnnotation, EventCore } from "./enumerators";
13
+ import { EventAnnotation, EventCore, AnnotationType } from "./enumerators";
14
14
  import en from "./locales/en_US.json";
15
15
  import cn from "./locales/zh_CN.json";
16
16
  import it from "./locales/it_IT.json";
@@ -124,3 +124,21 @@ export const DEFAULT_FREE_TEXT_FONT_COLOR = {
124
124
  [FREE_TEXT_FONT_COLOR.Green]: "Green",
125
125
  };
126
126
  export const EDITOR_PREFIX = "pdfjs_internal_editor_";
127
+ export const XFDF_ELEMENT_TO_ANNOTATION_TYPE = {
128
+ highlight: AnnotationType.Highlight,
129
+ underline: AnnotationType.Underline,
130
+ strikeout: AnnotationType.StrikeOut,
131
+ freetext: AnnotationType.FreeText,
132
+ stamp: AnnotationType.Stamp,
133
+ ink: AnnotationType.Ink,
134
+ text: AnnotationType.Popup,
135
+ };
136
+ export const ANNOTATION_TYPE_TO_XFDF_ELEMENT = {
137
+ [AnnotationType.Highlight]: "highlight",
138
+ [AnnotationType.Underline]: "underline",
139
+ [AnnotationType.StrikeOut]: "strikeout",
140
+ [AnnotationType.FreeText]: "freetext",
141
+ [AnnotationType.Stamp]: "stamp",
142
+ [AnnotationType.Ink]: "ink",
143
+ [AnnotationType.Popup]: "text",
144
+ };
package/dist/types.d.ts CHANGED
@@ -286,6 +286,7 @@ export interface Annotation {
286
286
  noPrint?: boolean;
287
287
  fontSize?: number;
288
288
  contents?: string;
289
+ imageDataUrl?: string;
289
290
  }
290
291
  export type AnnotationCallback<T = Annotation> = (data: T) => void;
291
292
  export interface AnnotationEventCallback {
@@ -305,8 +306,20 @@ export interface DeletedAnnotationData {
305
306
  rect?: number[];
306
307
  quadPoints?: number[];
307
308
  }
309
+ export interface XfdfSkippedEntry {
310
+ elementName: string;
311
+ page: number;
312
+ reason: string;
313
+ }
314
+ export interface XfdfImportResult {
315
+ annotations: Annotation[];
316
+ skipped: XfdfSkippedEntry[];
317
+ errors: string[];
318
+ }
308
319
  export interface AnnotationPluginApi {
309
320
  exportToPdf: (annotations: Annotation[], deletedAnnotations?: DeletedAnnotationData[] | string[]) => Promise<Uint8Array | null>;
321
+ exportToXfdf: (annotations: Annotation[], pdfFilename?: string) => string;
322
+ importFromXfdf: (xfdfString: string, pageCount: number) => XfdfImportResult;
310
323
  }
311
324
  /**
312
325
  * Programmatic API for text selection annotation tools (highlight, underline, strikethrough).
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vue-pdf-viewer/shared",
3
3
  "private": false,
4
- "version": "1.5.0",
4
+ "version": "1.6.0-rc.1",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",