Some test text!


Get started

Quick start - view a documentDownload PDFTron SDKIntegrate with GradleIntegrate manuallyRun samplesAdd license keyUpdate to latest versionTroubleshooting


System requirementsDocument lockingDocument savingRun project in Android StudioRun project with source codePDFTron full vs. standardReduce size of APK

Document Viewer

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

Document Viewer components

OverviewPDFViewCtrlReflowQuick menuCustomize quick menuAnnotation toolbarAnnotation style editorCustomize annotation style editorPage sliderList containerAnnotation listDocument outlineUser bookmark listThumbnail browserAdd pages dialogCrop pages dialogRotate pages dialogView mode dialog

Annotation and collaboration

OverviewRead only modeDisable annotation creation and editingDefault annotation propertiesChange tool modeEventsOverride annotation handlingShow and hide existing annotationsUndo and redoRealtime collaboration

Advanced customization

OverviewAdd a custom view to a pageCreate a custom toolPage coloring modePage fit modePage layout modeScrolling directionRight-to-left support



Parsing and extraction


Digital signatures




Advanced topics

PrintUnderstand coordinatesGenerate page thumbnailsChange annotation propertiesDelete annotationsTool class hierarchy

Other frameworks






PDF Processing API

Default annotation propertieskeyboard_arrow_down

Default annotation properties

In this document
chevron_rightXML attributes
chevron_rightSet a tool's default style
chevron_rightOverride an existing tool's default style
chevron_rightTool style attributes


When creating a new annotation, the initial properties (such as line thickness, fill colour, opacity, etc.) are set to the last value that the user selected for an annotation of that type. For example, if the user changes an ellipse annotation's stroke color from green to red, the next ellipse annotation that the user creates would have a stroke color of red. These default properties are saved in the app's SharedPreferences.

These default properties can be changed programmatically and will take effect the next time when the annotation is created.

For example, to change style properties of a rectangle:

where toolManager is an instance of ToolManager.

A table for annotation type and tool mode mapping can be found here: annotation and its creation tool.

linkXML attributes

Each annotation has a default style that is defined by its creation tool. For example, when you create a Square annotation using the RectCreate tool for the first time, the default behavior to draw a rectangle with a red border and a transparent fill color. These default colors can changed through XML attributes.

However the effect will only take place when the app is first loaded.

linkSet a tool's default style

  1. Add a style to your styles.xml file. For details on supported style attributes, see Tool Style Attributes.

    <style name="ShapeProperty">
        <!-- border color -->
        <item name="annot_color">@android:color/white</item>
        <!-- fill color -->
        <item name="annot_fill_color">@android:color/white</item>
        <!-- thickness -->
        <item name="annot_thickness">1.0</item>
        <!-- opacity -->
        <item name="annot_opacity">1.0</item>
  2. Add the style resource to ToolStyleConfig by calling addDefaultStyleMap(int, int styleRes).

    The first parameter of addDefaultStyleMap is an annotation type. You can determine the annotation type from the creator tool by referring to the Table of annotations and its creation tool.

linkOverride an existing tool's default style

You can also override existing tool's default styles:

  1. Identify the tool whose style you want to override by consulting the following table.
ToolStyle attribute resourceDefault style resource
  1. Create a custom tool style that inherits from the default tool style resource in styles.xml. For example, if you want to override the FreehandCreate tool style, your custom tool style should inherit from AnnotPresetStyle4.

    <style name="CustomizedToolStyle" parent="AnnotPresetStyle4">
        <item name="annot_color">@android:color/white</item>
    To learn about style inheritance, see: Defining styles and inheritance.
  2. In your application theme, set your custom tool style (CustomizedToolStyle) to the tool style attribute that corresponds to the tool style you wish to override. For example, if you want to the override FreehandCreate tool style, set CustomizedToolStyle to the attribute freehand_default_style.

    <style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
        <item name"freehand_default_style">@style/CustomizedToolStyle</item>
    To learn about applying custom themes to your application, see: Applying a Theme to an Activity or Application.

linkTool style attributes


Annotation color. For annotations that have an annot_fill_color, it represents stroke color.

format: color


Annotation text color. Used for FreeText annotations.

format: color


Annotation fill color. Used for annotations that have fill colors, including Square, Circle, and FreeText.

format: color


Annotation font size. Used for FreeText annotations.

format: float


Represents a FreeText annotation's maximum font size.

format: float


Represents a FreeText annotation's minimum font size.

format: float


Annotation thickness for border style

format: float


Annotation maximum thickness

format: float


Annotation minimum thickness

format: float


Annotation font. Used for FreeText annotations.

format: string


Annotation opacity

format: float


Annotation icon. Used for Text annotations.

format: string