Import export annotation object in Vue Pdfviewer component

16 Mar 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 v-on:click="exportAnnotation">Export Annotation</button>
        <button v-on:click="importAnnotation">Import Annotation</button>

import Vue from 'vue';
import { PdfViewerPlugin, Toolbar, Magnification, Navigation, LinkAnnotation, 
         BookmarkView,ThumbnailView, Print,TextSelection, TextSearch, 
         Annotation, FormDesigner, FormFields } from '@syncfusion/ej2-vue-pdfviewer';

var exportObject;
export default {
  data () {
    return {
 provide: {
   PdfViewer: [ Toolbar, Magnification, Navigation, LinkAnnotation, BookmarkView, ThumbnailView, 
                Print, TextSelection, TextSearch, Annotation, FormDesigner, FormFields ]},

 methods: {
  //Export annotation as object.
  exportAnnotation: function() {
    var viewer = document.getElementById('pdfViewer').ej2_instances[0];
    viewer.exportAnnotationsAsObject().then(function(value) {
      exportObject = value;

  //Import annotation that are exported as object.
  importAnnotation: function() {
    var viewer = document.getElementById('pdfViewer').ej2_instances[0];

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