Some test text!

Get started

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

Document Viewer

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

Document Viewer components

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

Annotation and collaboration

OverviewSet up ToolManagerRead only modeDisable annotation creation/editingDefault annotation propertiesAnnotation propertiesEventsOverride annotation handlingShow and hide existing annotationsUndo and redoRealtime collaboration

Advanced customization

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


Convert documents to PDFConvert HTML to PDF



Other Frameworks

XamarinReact Native

Advanced topics

Understand coordinatesDocument savingDocument lockingGenerate page thumbnailsTool class hierarchy


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

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 toolbarkeyboard_arrow_down

Annotation toolbar

In this document
chevron_rightShow/hide annotation toolbar
chevron_rightHide annotation toolbar items
chevron_rightAnnotation toolbar listener
chevron_rightUndo/Redo listener
chevron_rightContinuous annotation edit
chevron_rightAppearance styling
chevron_rightXML attributes

AnnotationToolbar is a FrameLayout consisting of various annotation creation tools. With the annotation toolbar, users are able to conveniently create and switch between different tools.

To learn about each icon, see the icon cheat sheet.
Due to space limitations, only a limited number of tools will show on portrait mode of smaller devices.
ScenarioAnnotation Toolbar
Small devices in landscape mode + Tablet devices
Small devices in portrait mode

linkShow/hide annotation toolbar

The annotation toolbar allows the user to easily switch tools when adding annotations to the document. To set up your layout with annotation toolbar, add a <AnnotationToolbar> element to your XML layout. For example, your layout may look like this:


Then, you need to attach a ToolManager to the annotation toolbar:

To close the annotation toolbar programmatically call:

Handle rotation:

linkHide annotation toolbar items

If there are tools that you would like to remove from the annotation toolbar, you can disable them via ToolManager.disableToolMode API. For example:

Then, when open the annotation toolbar, you will see:




If undo/redo is enabled in the PDFViewCtrl then the buttons for undo/redo will also be provided as popup windows when the user clicks on the three vertical dots at the right end of the toolbar.


linkAnnotation toolbar listener

You can set a listener via setAnnotationToolbarListener(AnnotationToolbarListener) to be notified when the annotation toolbar is displayed or hidden. In addition, the listener should implement onShowAnnotationToolbarByShortcut(int) in order to show the annotation toolbar starting in a given tool mode. The method is invoked when the user presses a shortcut that would bring up the annotation toolbar. This listener is useful, for example, in order to keep the annotation toolbar hidden if the document has read-only access.


linkUndo/Redo listener

To be notified when undo/redo buttons are clicked you should call AnnotationToolbar.setOnUndoRedoListener(OnUndoRedoListener).


linkContinuous annotation edit

By default the annotation toolbar returns to the pan tool after an annotation is created. If you prefer to keep the same tool mode after an annotation is created you should call

linkAppearance styling

In order to customize the appearance of UI elements in annotation toolbar, you can define annotation_toolbar style inside your style.xml file:

<style name="YourAppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
    <item name="colorPrimary">@color/app_color_primary_day</item>
    <item name="colorPrimaryDark">@color/app_color_primary_dark_day</item>
    <item name="colorAccent">@color/app_color_accent</item>

    <item name="annotation_toolbar">@style/CustomAnnotationToolbarStyle</item>

<style name="CustomAnnotationToolbarStyle" parent="AnnotationToolbarStyle">
    <item name="colorBackground">@android:color/black</item>

Alternatively, you can change the attributes inside your xml layout:


linkXML attributes


Specifies the annotation toolbar background color

Format: color

Default value: ?attr/colorPrimary


Specifies the background color of each tool in annotation toolbar

Format: color

Default value: ?attr/colorPrimaryDark


Specifies the icon color of each tool (except the close button) in annotation toolbar

Format: color

Default value: @android:color/white


Specifies the icon color of the close button in annotation toolbar

Format: color

Default value: @android:color/white