How to remove all annotation in pdf viewer

I used

let obj = (<any>document.getElementById('pdfviewer')).ej2_instances[0];

obj.deleteAnnotations();

but when I try download the document again the service(APS.NET Core) failure with a NullReferenceError.



3 Replies

VS Vasugi Sivajothi Syncfusion Team August 20, 2021 03:13 PM UTC

Hi David, 
 
We have tried to reproduce the reported issues with the provided details, but we were unable to reproduce it. 
We have shared the sample in which we have tried to reproduce the issue, please refer to the below links. 
 
 
 
Kindly try the sample we have provided and revert to us with a PDF document, modified sample and more details about your issue if you have any concerns about this. And could you please share the console error details, and network tab details while downloading the document, and please ensure whether you have updating the same version for both client and server? This will be helpful to investigate further and provide the solution at the earliest. 
 
Regards, 
Vasugi. 



DR David Restrepo August 20, 2021 03:52 PM UTC

Hello, 


I Just need remove all annotation in pdf viewer usign Angular or JS



VS Vasugi Sivajothi Syncfusion Team August 23, 2021 11:20 AM UTC

Hi David,  
 
You can delete all the annotations in the PDF Viewer using the deleteAnnotations() method. We have shared the video, code snippet and sample for your reference. Please refer to the below links. 
 
Code Snippet  
 
   <button (click)="deleteAnnotations()">DeleteAnnotations</button> 
 
 
  deleteAnnotations() { 
    var pdfViewer = (<any>document.getElementById('pdfViewer')) 
      .ej2_instances[0]; 
    pdfViewer.deleteAnnotations(); 
  } 
 
 
 
 
 
Kindly try this and revert to us with more details about your issue if you have any concerns about this. 
 
 
Regards, 
Vasugi. 


Loader.
Up arrow icon