How to change the inside color of a Square annotation?


I am trying to change the color of a square annotation, but I am only able to change the color of the border.

Annot a1 = page.getAnnot(i); a1.setColor(new ColorPt((0/255.0), (0/255.0), (255/255.0)), 3); a1.refreshAppearance();

Also, when I set the color to blue, it appears purple?


The function Annot.SetColor sets the stroke (border) color of a square annotation. To set the interior (fill) color call Markup.SetInteriourColor().

if(a1.isMarkup()) { Annots.Markup mk = new Annots.Markup(a1); mk.setInteriorColor(new ColorPt((0/255.0), (0/255.0), (255/255.0)), 3); a1.refreshAppearance(); }

As for the “purple” color this is due to the opacity of the annotation. Annotations are always drawn over top of page content, so to see the content underneath, there must be an opacity, which will blend your color with the background color.