Some test text!

keyboard_arrow_down

Get started

Download PDFTron SDKIntegrate with GradleIntegrate manuallyRun samplesAdd license keyQuick start - view a documentProGuardUpdate to latest versionTroubleshooting
keyboard_arrow_down

Document Viewer

OverviewShow a document in an ActivityShow a document in a FragmentViewer configurationToolManager configurationDay and Night themesOpen from online URL
keyboard_arrow_down

Document Viewer components

PDFViewCtrlReflowFloating context menuCustomize floating context menuAnnotation toolbarAnnotation style editorCustomize annotation style editorPage sliderAnnotation listDocument outlineUser bookmark listList containerThumbnail browserAdd pages dialogRotate pages dialogView mode dialogCrop pages dialog
keyboard_arrow_down

Annotation and collaboration

Read only modeDisable annotation creation/editingDefault annotation propertiesAnnotation propertiesEventsOverride annotation handlingShow and hide existing annotationsUndo and redoRealtime collaboration
keyboard_arrow_down

Advanced customization

Add a custom view to a pageCreate a custom toolPage coloring modePage fit modePage layout mode
keyboard_arrow_down

Conversion

Convert documents to PDFConvert HTML to PDF
keyboard_arrow_down

Search

Text search
keyboard_arrow_down

Other Frameworks

XamarinReact Native
keyboard_arrow_down

Advanced topics

Understand coordinatesDocument savingDocument lockingGenerate page thumbnailsTool class hierarchy
keyboard_arrow_down

FAQ

System RequirementsRun project in Android StudioRun project with source codePDFTron full vs. standardLocalizationIcon cheat sheetReduce size of APKEnable multidexOut of memory when rotating device multiple timesReduce memory consumptionDetachCurrentThread warning
keyboard_arrow_down

PDF Processing API

What is PDFNet?Opening a documentSerializing (saving) a documentWorking with pagesWorking with Page ContentWorking with BookmarksWorking with Interactive Forms (AcroForms)PDF SecurityLow-level PDF APIError handling
Annotation propertieskeyboard_arrow_down

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: changing tool.

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: