From 5442492c2651b09a5d42ad30884ec10f2cffd405 Mon Sep 17 00:00:00 2001 From: SF4524LogeshKumar Date: Fri, 3 Jan 2025 15:50:54 +0530 Subject: [PATCH] 380623: Samples on Export and Import Annotation --- .../Export and Import Annotation/index.html | 43 +++++++++++++++++++ How to/Export and Import Annotation/index.js | 29 +++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 How to/Export and Import Annotation/index.html create mode 100644 How to/Export and Import Annotation/index.js diff --git a/How to/Export and Import Annotation/index.html b/How to/Export and Import Annotation/index.html new file mode 100644 index 0000000..0736bbc --- /dev/null +++ b/How to/Export and Import Annotation/index.html @@ -0,0 +1,43 @@ + + EJ2 PDF Viewer + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + + \ No newline at end of file diff --git a/How to/Export and Import Annotation/index.js b/How to/Export and Import Annotation/index.js new file mode 100644 index 0000000..2d3ae7f --- /dev/null +++ b/How to/Export and Import Annotation/index.js @@ -0,0 +1,29 @@ +var pdfviewer = new ej.pdfviewer.PdfViewer({ + documentPath: 'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf', + resourceUrl:'https://cdn.syncfusion.com/ej2/28.1.33/dist/ej2-pdfviewer-lib' +}); +ej.pdfviewer.PdfViewer.Inject(ej.pdfviewer.TextSelection, ej.pdfviewer.TextSearch, ej.pdfviewer.Print, ej.pdfviewer.Navigation, ej.pdfviewer.Toolbar, + ej.pdfviewer.Magnification, ej.pdfviewer.Annotation, ej.pdfviewer.FormDesigner, ej.pdfviewer.FormFields, ej.pdfviewer.PageOrganizer); +pdfviewer.appendTo('#PdfViewer'); + +document.getElementById('ExportXfdf').addEventListener('click', function () { +// export the annotation in XFDF format. +pdfviewer.exportAnnotation('Xfdf'); +}); + +document.getElementById('ExportJSON').addEventListener('click', function () { +// export the annotation in JSON format. +pdfviewer.exportAnnotation('Json'); +}); + +//Export annotation as object. +document.getElementById('export').addEventListener('click', () => { + pdfviewer.exportAnnotationsAsObject().then(function(value) { + exportObject = value; + }); +}); + +//Import annotation that are exported as object. +document.getElementById('import').addEventListener('click', () => { + pdfviewer.importAnnotation(JSON.parse(exportObject)); +});