Import export annotation object in EJ2 JavaScript Pdfviewer control

8 May 20231 minute to read

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() method. Only the annotations objects that are exported from the PDF Viewer can be imported.

The following steps are used to import and export annotation as object.

Step 1: Follow the steps provided in the link to create a simple PDF Viewer sample.

Step 2: Use the following code snippet to perform import and export annotation.

<button id="export">Export Annotation</button>
<button id="import">Import Annotation</button>
//Export annotation as object.
document.getElementById('export').addEventListener('click', () => {
  viewer.exportAnnotationsAsObject().then(function(value) {
    exportObject = value;

//Import annotation that are exported as object.
document.getElementById('import').addEventListener('click', () => {

Find the Sample, how to import and export annotation as object