How to change color of the annotation fields inside the PDF?

I want to change the color of the annotation fields from black to blue inside the PDF. How can I achieve this?
Note: I’m using Angular 12.
Please refer screenshot for more clarity.

Hello @Anurag,

In order to change the font color of the text fields you have to set this on the field itself. Each field has a font property, on which you can then set your desired strokeColor and fillColor. Here is an example of how this would be achieved programatically:

// First get your field from the field manager
const fieldManager = documentViewer.getAnnotationManager().getFieldManager()
const myField = fieldManager.getField('my-field-name')

//Set the fill color on the font
myField.font.fillColor = new Annotations.Color(255, 0, 0, 1)

// You can then trigger a major redraw of the page to reflect the new color

Alternatively, you can set the colors using our form builder. Simply enter form builder, select your text widget and set the text color through the styling options from the popup.

Here are some relevant API links for you to go over:

Best Regards,
Armando Bollain
Software Developer
PDFTron Systems, Inc.

Hi Armando,
Thanks a lot for your response. This method is working perfectly.

1 Like