Some test text!

Change annotation properties

In this document
chevron_rightChanging an annotation border thickness
chevron_rightChanging an annotation border color.
chevron_rightChanging an annotation opacity
chevron_rightChanging an annotation fill color
chevron_rightChanging a Text annotation icon
chevron_rightChanging a FreeText annotation text color
chevron_rightChanging a FreeText annotation text size
chevron_rightChanging a FreeText annotation font
AnnotEdit tool class can edit the style of a selected annotation easily by using annotation style dialog. You can set AnnotEdit tool to ToolManager as described here: change tool mode.

With PDFTron library, you can change annotation styles such as border color, border thickness, fill color, etc. To change annotation style, you must lock PDF document first. For more information about locking document, see: document locking.

linkChanging an annotation border thickness

To change an annotation border thickness:

  1. Get the BorderStyle from the annotation by calling annot.getBorderStyle().

  2. Set thickness to the BorderSytle by calling borderStyle.setWidth(double).

  3. Refresh the annotation appearance by calling annot.refreshAppearance().

  4. Update the PDFViewCtrl contents by calling pdfViewCtrl.update().

To make annotation border invisible, call borderStyle.setWidth(0).

linkChanging an annotation border color.

If there is a FreeText annotation, to set the border color of the annotation, call freeText.setLineColor(ColorPt, int). To set the border color of the other annotation types, call annot.setColor(ColorPt, int).

To set the color of a Text annotation, call annot.setColor(ColorPt, int).

linkChanging an annotation opacity

To change the opacity of a Markup annotation, callMarkup.setOpacity(double):

linkChanging an annotation fill color

To set the fill color of a Markup annotation, call Markup.setInteriorColor(ColorPt, int).

linkChanging a Text annotation icon

To change a Text annotation icon, call Text.setIcon(String). After changing the icon, you must refresh the annotation appearance by calling AnnotUtils.refreshStickyNoteAppearance(Annot, PDFViewCtrl).

For available icons, see: default icons table.

linkChanging a FreeText annotation text color

To change the text color of a FreeText annotation, call FreeText.setTextColor(ColorPt, int).

linkChanging a FreeText annotation text size

To change the text size of a FreeText annotation, call FreeText.setFontSize(double).

linkChanging a FreeText annotation font

The follow code snippet shows how to set the font to a FreeText annotation: