Change border color of Field widget annotation from RED to anything else

Product:

Product Version:

Please give a brief summary of your issue:
I am trying to change the default border color for field annotations from RED to something other than RED once they have a value. The sample code provided in the online doc

fun changeAnnotBorderColor(annot: Annot, @ColorInt color: Int)

does not do anything. The annotations borders remain red.

Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)
In the sample app you will see I have included the sample source for the PDFTron online doc for changing the border color for an annotation. I simply call that on every annotation in the form (just to test it). Once the form loads, all annotations have a RED border. Nothing I seem to do changes it.

Please provide a link to a minimal sample where the issue is reproducible:

Hi Mark, as we discussed in our other ticket, you can find demo here:

Demo gif:
demo-border

This will change field border color based on user input.
Thanks.

Thank you. That works. I find it very interesting that you can set the default color for the PDFViewCtrl as a whole but you cannot set it on each annotation. Why does the annotation and Widget have a setColor method if you cannot use them? Creating separate views that sit over every field works but seems like there should be a better solution. I do thank you very much for helping me solve this.

Regards,
Mark

Hi Mark, the tricky part is that different vendors deal with widgets differently and have their own field highlighting logic. I want to make it clear that when you see the red outline in Adobe for example, that isn’t the widget color defined on it. That’s the software’s interpretation (you can even change this color in preference)

So most annotations the color fill/border color is defined by the annotation itself. But for Widgets, if Field Highlighting is turned on, then the viewer controls the colors, not the widget. That’s why here we want to work with it by overlays.

Hope this helps.