@vue-pdf-viewer/annotation 1.3.0-alpha.2 → 1.3.0-beta.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/index.js +2278 -2209
- package/dist/index.umd.cjs +9 -9
- package/dist/utils/pdfSerializer.d.ts +16 -2
- package/package.json +3 -3
|
@@ -1,10 +1,24 @@
|
|
|
1
|
+
import { type DeletedAnnotationData } from "@vue-pdf-viewer/shared";
|
|
1
2
|
import type { Annotation } from "../types";
|
|
2
3
|
export declare class AnnotationPdfSerializer {
|
|
3
4
|
/**
|
|
4
5
|
* Serialize annotations into a PDF document
|
|
6
|
+
* @param originalBytes - The original PDF bytes
|
|
7
|
+
* @param annotations - Annotations to add to the PDF
|
|
8
|
+
* @param deletedAnnotations - Full annotation data for removal (supports position-based matching)
|
|
5
9
|
*/
|
|
6
|
-
static serializeAnnotationsToPdf(originalBytes: Uint8Array, annotations: Annotation[]): Promise<Uint8Array>;
|
|
7
|
-
|
|
10
|
+
static serializeAnnotationsToPdf(originalBytes: Uint8Array, annotations: Annotation[], deletedAnnotations?: DeletedAnnotationData[]): Promise<Uint8Array>;
|
|
11
|
+
/**
|
|
12
|
+
* Remove annotations from the PDF
|
|
13
|
+
* Supports both ID-based matching (via /NM field) and position-based matching as fallback
|
|
14
|
+
*/
|
|
15
|
+
private static removeAnnotations;
|
|
16
|
+
/**
|
|
17
|
+
* Check if a PDF annotation matches any of the deleted annotations
|
|
18
|
+
* First tries to match by /NM (ID), then falls back to position matching
|
|
19
|
+
*/
|
|
20
|
+
private static matchesDeletedAnnotation;
|
|
21
|
+
private static addTextMarkupAnnotation;
|
|
8
22
|
/**
|
|
9
23
|
* Add a rectangle (square) annotation to the PDF
|
|
10
24
|
* Rectangle annotations are PDF annotation type 5 (Square)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue-pdf-viewer/annotation",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.3.0-
|
|
4
|
+
"version": "1.3.0-beta.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.umd.cjs",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"vue": "^3.2.37"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@pdf-viewer/pdf": "1.
|
|
34
|
-
"@vue-pdf-viewer/shared": "1.2.0-rc.
|
|
33
|
+
"@pdf-viewer/pdf": "1.1.0",
|
|
34
|
+
"@vue-pdf-viewer/shared": "1.2.0-rc.15",
|
|
35
35
|
"vite-plugin-css-injected-by-js": "^3.5.2",
|
|
36
36
|
"vue": "^3.2.37"
|
|
37
37
|
},
|