Can I add text to file by scripts?

When open the file in PDF Viewer (Angular), can I add a stamp or text to previewed pdf by scripts? 

If so, can you provide me a sample of how I can achieve it? 

Thank you 


1 Reply 1 reply marked as answer

DM Dhivyabharathi Mohan Syncfusion Team April 15, 2021 10:45 AM UTC

Hi Iris, 
 
In our PDF Viewer, we can use the setAnnotationMode to add the annotations programmatically. We have shared the sample and code snippet for your reference. Please find the sample from the below link. 
 
 
 
Code snippet:  
 
<button (click)="freeText()">freeText</button> 
  <button (click)="stamp()">stamp</button> 
 
freeText() { 
    var viewer = (<any>document.getElementById("pdfViewer")).ej2_instances[0]; 
    viewer.annotation.setAnnotationMode("FreeText"); 
  } 
  stamp() { 
    var viewer = (<any>document.getElementById("pdfViewer")).ej2_instances[0]; 
    viewer.annotationModule.setAnnotationMode("Stamp", null,  SignStampItem.Witness 
    ); 
  } 
 
 
 
Kindly try this and revert us, if you have any concerns. 
 
Regards, 
Dhivya. 


Marked as answer
Loader.
Up arrow icon