How to add Approved Stamp Annotation from Javascript

Hello,

I want to load the approved stamp annotation from javascript like below;


          function importAnnot() {


              var pdfViewer = document.getElementById('pdfviewer').ej2_instances[0];

               pdfViewer.importAnnotation(????)

});

Is there any way to do this ?


Thank you.



1 Reply 1 reply marked as answer

VS Vasugi Sivajothi Syncfusion Team June 24, 2021 11:59 AM UTC

Hi Mehmet, 
  
Thank you for contacting Syncfusion support. 
  
You can import annotations while loading the PDF document using documentLoad event. Please refer to the below code snippet and sample. 
  
Code Snippet: 
  
<ejs-pdfviewer id="pdfviewer" serviceUrl="/api/PdfViewer" documentPath="HTTP Succinctly.pdf" documentLoad="documentLoad" width="100%" height="600px"></ejs-pdfviewer> 
  
function documentLoad() { 
     var viewer = document.getElementById('pdfviewer').ej2_instances[0]; 
     viewer.importAnnotation('HTTP Succinctly.json'); 
} 
  
  
Note: We need to place the exported JSON document into the data folder in service project. 
  
You can also import annotations by passing JSON objects into importAnnotation method. Please refer to the below code snippet. 
  
Code Snippet: 
  
<button type="button" onclick="importAnnot()">ImportAnnotation</button> 
  
function importAnnot() { 
        var viewer = document.getElementById('pdfviewer').ej2_instances[0]; 
        viewer.importAnnotation(“Exported JSON data”); 
    } 
  
  
  
  
Documentations: 
  
Kindly try this and let us know if you have any concerns about this. 
  
Regards, 
Vasugi. 


Marked as answer
Loader.
Up arrow icon