How to change the inside color of a Square annotation?

50 views
Skip to first unread message

Ryan

unread,
Jul 5, 2016, 1:31:00 PM7/5/16
to PDFTron PDFNet SDK
Question:

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?

Answer:

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.
Reply all
Reply to author
Forward
0 new messages