How to change font color and style inside of pdf file in pdf viewer?

Here I need to change the pdf file font color and style.



1 Reply

DM Dhivyabharathi Mohan Syncfusion Team December 9, 2021 08:02 AM UTC

 Hi Prathipa, 
  
 
Syncfusion PDF Viewer will not allow editing the texts present in the existing PDF document. However, you can add the text markup annotations like strikethrough, Highlight and Underline annotations for performing the highlight, underline or strikethrough the texts present in the PDF document. We have shared the screenshot of the annotation icons present in the annotation toolbar to add the annotations in the PDF document. And you can also add the text markup annotations programmatically using the setAnnotationMode. 
 
Screenshot of the text markup annotations in annotation-toolbar: 
 
 


 
Code snippet to add the text markup annotations programmatically: 
  
  <button (click)="AddHighlight()">AddHighlight</button> 
  <button (click)="AddStrikethrough()">AddStrikethrough</button> 
  <button (click)="AddUnderline()">AddUnderline</button> 
  
  
 AddHighlight() { 
    var viewer = (<any>document.getElementById('pdfViewer')).ej2_instances[0]; 
    viewer.annotationModule.setAnnotationMode('Highlight'); 
  } 
  AddStrikethrough() { 
    var viewer = (<any>document.getElementById('pdfViewer')).ej2_instances[0]; 
    viewer.annotationModule.setAnnotationMode('Strikethrough'); 
  } 
  AddUnderline() { 
    var viewer = (<any>document.getElementById('pdfViewer')).ej2_instances[0]; 
    viewer.annotationModule.setAnnotationMode('Underline'); 
  } 
  
  
 


 
 
Kindly try this and revert us, if you have any concerns. 
 
Regards, 
Dhivya. 


Loader.
Up arrow icon