Skip to content

Commit 1edd575

Browse files
authored
Merge pull request #3769 from syncfusion-content/EJ2-380623-ExportandImport
380623: Updated UG documentation for Import and Export annotation
2 parents 77b2bab + 1892238 commit 1edd575

File tree

5 files changed

+86
-50
lines changed

5 files changed

+86
-50
lines changed

ej2-asp-core-mvc/pdfviewer/EJ2_ASP.MVC/how-to/import-export-annotation-object.md

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
layout: post
3+
title: Import Export Annotation in EJ2 ASP.NET MVC PDF Viewer | Syncfusion
4+
description: Learn how to Import Export Annotation in ASP.NET MVC PDF Viewer component of Syncfusion Essential JS 2 and more.
5+
platform: ej2-asp-core-mvc
6+
control: Import Export Annotation Object
7+
publishingplatform: ##Platform_Name##
8+
documentation: ug
9+
---
10+
11+
12+
# Import and Export annotation
13+
14+
The PDF Viewer library allows you to import annotations from objects or streams instead of loading it as a file. To import such annotation objects, the PDF Viewer control must export the PDF annotations as objects using the [**ExportAnnotationsAsObject()**](https://ej2.syncfusion.com/documentation/api/pdfviewer/#exportannotationsasobject) method. Only the annotations objects that are exported from the PDF Viewer can be imported.
15+
16+
The following steps are used to import and export annotations in various formats such as objects, JSON, and XFDF.
17+
18+
**Step 1:** Follow the steps provided in the [link](https://ej2.syncfusion.com/aspnetmvc/documentation/pdfviewer/getting-started/) to create a simple PDF Viewer sample.
19+
20+
**Step 2:** Use the following code snippet to perform import and export annotation.
21+
22+
```html
23+
<button type="button" onclick="exportAsJson()">Export Annotation As Json</button>
24+
<button type="button" onclick="exportAsXfdf()">Export Annotation As Xfdf</button>
25+
<button type="button" onclick="exportAnnotation()">Export Annotation</button>
26+
<button type="button" onclick="importAnnotation()">Import Annotation</button>
27+
28+
<script>
29+
var exportObject;
30+
//Export annotation as Json
31+
function exportAsJson() {
32+
var viewer = document.getElementById('pdfViewer').ej2_instances[0];
33+
viewer.exportAnnotation('Json');
34+
}
35+
//Export annotation as Xfdf
36+
function exportAsXfdf() {
37+
var viewer = document.getElementById('pdfViewer').ej2_instances[0];
38+
viewer.exportAnnotation('Xfdf');
39+
}
40+
//Export annotation as object.
41+
function exportAnnotation() {
42+
var viewer = document.getElementById('pdfViewer').ej2_instances[0];
43+
viewer.exportAnnotationsAsObject().then(function (value) {
44+
exportObject = value
45+
});
46+
}
47+
//Import annotation that are exported as object.
48+
function importAnnotation() {
49+
var viewer = document.getElementById('pdfViewer').ej2_instances[0];
50+
viewer.importAnnotation(JSON.parse(exportObject));
51+
}
52+
</script>
53+
```
54+
55+
[View sample in GitHub](https://github.com/SyncfusionExamples/mvc-pdf-viewer-examples/tree/master/How%20to)

ej2-asp-core-mvc/pdfviewer/EJ2_ASP.NETCORE/how-to/import-export-annotation-object.md renamed to ej2-asp-core-mvc/pdfviewer/EJ2_ASP.NETCORE/how-to/import-export-annotation.md

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
22
layout: post
3-
title: Import Export Annotation Object in ##Platform_Name## Pdfviewer Component
3+
title: Import Export Annotation in ##Platform_Name## Pdfviewer Component | Syncfusion
44
description: Learn here all about Import Export Annotation Object in Syncfusion ##Platform_Name## Pdfviewer component of Syncfusion Essential JS 2 and more.
55
platform: ej2-asp-core-mvc
66
control: Import Export Annotation Object
77
publishingplatform: ##Platform_Name##
88
documentation: ug
99
---
1010

11-
# Import and Export annotation as object
11+
# Import and Export annotation
1212

1313
The PDF Viewer library allows you to import annotations from objects or streams instead of loading it as a file. To import such annotation objects, the PDF Viewer control must export the PDF annotations as objects using the [**ExportAnnotationsAsObject()**](https://ej2.syncfusion.com/documentation/api/pdfviewer/#exportannotationsasobject) method. Only the annotations objects that are exported from the PDF Viewer can be imported.
1414

15-
The following steps are used to import and export annotation as object.
15+
The following steps are used to import and export annotations in various formats such as objects, JSON, and XFDF.
1616

1717
**Step 1:** Follow the steps provided in the [link](https://ej2.syncfusion.com/aspnetcore/documentation/pdfviewer/getting-started/) to create a simple PDF Viewer sample.
1818

@@ -26,6 +26,8 @@ The following steps are used to import and export annotation as object.
2626
ViewData["Title"] = "Home page";
2727
}
2828

29+
<button type="button" onclick="exportAsJson()">Export Annoatation As Json</button>
30+
<button type="button" onclick="exportAsXfdf()">Export Annoatation As Xfdf</button>
2931
<button type="button" onclick="exportAnnotation()">Export Annoatation</button>
3032
<button type="button" onclick="importAnnotation()">Import Annoatation</button>
3133

@@ -38,7 +40,17 @@ The following steps are used to import and export annotation as object.
3840

3941
<script type ="text/javascript">
4042

41-
var exportObject;
43+
var exportObject;
44+
//Export annotation as Json
45+
function exportAsJson(){
46+
var viewer = document.getElementById('pdfviewer').ej2_instances[0];
47+
viewer.exportAnnotation('Json');
48+
}
49+
//Export annotation as Xfdf
50+
function exportAsXfdf(){
51+
var viewer = document.getElementById('pdfviewer').ej2_instances[0];
52+
viewer.exportAnnotation('Xfdf');
53+
}
4254
//Export annotation as object.
4355
function exportAnnotation() {
4456
var viewer = document.getElementById('pdfviewer').ej2_instances[0];
@@ -62,6 +74,8 @@ The following steps are used to import and export annotation as object.
6274
ViewData["Title"] = "Home page";
6375
}
6476

77+
<button type="button" onclick="exportAsJson()">Export Annoatation As Json</button>
78+
<button type="button" onclick="exportAsXfdf()">Export Annoatation As Xfdf</button>
6579
<button type="button" onclick="exportAnnotation()">Export Annoatation</button>
6680
<button type="button" onclick="importAnnotation()">Import Annoatation</button>
6781

@@ -75,7 +89,17 @@ The following steps are used to import and export annotation as object.
7589

7690
<script type ="text/javascript">
7791

78-
var exportObject;
92+
var exportObject;
93+
//Export annotation as Json
94+
function exportAsJson(){
95+
var viewer = document.getElementById('pdfviewer').ej2_instances[0];
96+
viewer.exportAnnotation('Json');
97+
}
98+
//Export annotation as Xfdf
99+
function exportAsXfdf(){
100+
var viewer = document.getElementById('pdfviewer').ej2_instances[0];
101+
viewer.exportAnnotation('Xfdf');
102+
}
79103
//Export annotation as object.
80104
function exportAnnotation() {
81105
var viewer = document.getElementById('pdfviewer').ej2_instances[0];

ej2-asp-core-toc.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1951,7 +1951,7 @@
19511951
<li><a href="/ej2-asp-core/pdfviewer/how-to/display-document-without-downloading">Display document without downloading</a></li>
19521952
<li><a href="/ej2-asp-core/pdfviewer/how-to/show-bookmark">Show Bookmark</a></li>
19531953
<li><a href="/ej2-asp-core/pdfviewer/how-to/load-documents">Load the PDF documents dynamically</a></li>
1954-
<li><a href="/ej2-asp-core/pdfviewer/how-to/import-export-annotation-object">Import and Export annotation as object</a></li>
1954+
<li><a href="/ej2-asp-core/pdfviewer/how-to/import-export-annotation">Import and Export annotation</a></li>
19551955
<li><a href="/ej2-asp-core/pdfviewer/how-to/authorization-token">Include the Authorization token</a></li>
19561956
<li><a href="/ej2-asp-core/pdfviewer/how-to/open-thumbnail">Open Thumbnail pane programmatically</a></li>
19571957
<li><a href="/ej2-asp-core/pdfviewer/how-to/resolve-pdfium-issue">Resolve the Pdfium issue</a></li>

ej2-asp-mvc-toc.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1909,7 +1909,7 @@
19091909
<li><a href="/ej2-asp-mvc/pdfviewer/how-to/load-the-document">Load the PDF document</a></li>
19101910
<li><a href="/ej2-asp-mvc/pdfviewer/how-to/show-notification-dialog">Show the notification dialog in UI When form fields are empty</a></li>
19111911
<li><a href="/ej2-asp-mvc/pdfviewer/how-to/load-documents">Load the PDF documents dynamically</a></li>
1912-
<li><a href="/ej2-asp-mvc/pdfviewer/how-to/import-export-annotation-object">Import and Export annotation as object</a></li>
1912+
<li><a href="/ej2-asp-mvc/pdfviewer/how-to/import-export-annotation">Import and Export annotation</a></li>
19131913
<li><a href="/ej2-asp-mvc/pdfviewer/how-to/open-thumbnail">Open Thumbnail pane programmatically</a></li>
19141914
<li><a href="/ej2-asp-mvc/pdfviewer/how-to/redirect-to-home-page">Redirect to a home page after submitting PDF forms</a></li>
19151915
<li><a href="/ej2-asp-mvc/pdfviewer/how-to/resolve-pdfium-issue">Resolve the Pdfium issue</a></li>

0 commit comments

Comments
 (0)