@vue-pdf-viewer/shared 1.5.0-rc.1 → 1.6.0-rc.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/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
@@ -305,8 +305,20 @@ export interface DeletedAnnotationData {
305
305
  rect?: number[];
306
306
  quadPoints?: number[];
307
307
  }
308
+ export interface XfdfSkippedEntry {
309
+ elementName: string;
310
+ page: number;
311
+ reason: string;
312
+ }
313
+ export interface XfdfImportResult {
314
+ annotations: Annotation[];
315
+ skipped: XfdfSkippedEntry[];
316
+ errors: string[];
317
+ }
308
318
  export interface AnnotationPluginApi {
309
319
  exportToPdf: (annotations: Annotation[], deletedAnnotations?: DeletedAnnotationData[] | string[]) => Promise<Uint8Array | null>;
320
+ exportToXfdf: (annotations: Annotation[], pdfFilename?: string) => string;
321
+ importFromXfdf: (xfdfString: string, pageCount: number) => XfdfImportResult;
310
322
  }
311
323
  /**
312
324
  * 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-rc.1",
4
+ "version": "1.6.0-rc.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",