Some test text!

Getting started

keyboard_arrow_down
Running samplesTry demo in your projectDownloading PDFTronIntegrating PDFTron via GradleManually integrating PDFTronUpgradingAdding PDFTron license keyUsing ProGuardTroubleshooting integration

Fundamentals

keyboard_arrow_down
Document lockingSaving PDF documentsUnderstanding coordinates

Basics

keyboard_arrow_down
Using an ActivityUsing a FragmentUsing PDFViewCtrlViewer configConverting and viewing other document typesConverting HTML to PDF

Viewer

keyboard_arrow_down
PDFViewCtrl color modesPDFViewCtrl page view modePDFViewCtrl page presentation modeGenerating thumbnails in PDF

Features

keyboard_arrow_down
Day/Night themesUndo and redoText searchAnnotation syncingRotating PDF pagesPDFViewCtrl read onlyUsing PDFViewCtrl with minimum memory

Tools

keyboard_arrow_down
Tools overviewSetting Up ToolManagerChanging and disabling toolsIntercepting annotation handlingToolManager eventsDefault annotation propertiesTool subclasses

Annotations

keyboard_arrow_down
Deleting annotationsAnnotation styleShow/hide annotations

UI components

keyboard_arrow_down
Quick menuAnnotation toolbarAnnotation style dialogThumbnail sliderAnnotations listOutline listUser bookmarks listBookmarks dialogPage thumbnails dialogAdd page dialogRotate pages dialogView mode dialogCrop page dialogReflow

Advanced

keyboard_arrow_down
Adding a custom view to a PDF pageCustom toolCustomizing quick menuCustomizing annotation style dialog

FAQ

keyboard_arrow_down
Running project in Android StudioSystem RequirementsPDFTron full vs. standardLocalizationIcon cheat sheetRunning sample with sourceReducing size of APKEnable multidexOut of memory when rotating device multiple timesDetachCurrentThread warning

PDF Processing API

keyboard_arrow_down
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
Customizing annotation style dialogkeyboard_arrow_down

Customize annotation style dialog fragment

In this document
chevron_rightCustomize standard colors in color picker
chevron_rightCustomize annotation presets
chevron_rightPreset attribute table
chevron_rightCustomize icons list
chevron_rightDefault icons table

It is possible to override the default AnnotationStyleDialogFragment to fit your needs.

linkCustomize standard colors in color picker

The standard colors are the color grid in the color picker.

To change these colors, you can override the standard color list as follows:

  1. Define your own color list in arrays.xml
<string-array name="custom_standard_colors">
    <item>#f1a099</item>
    <item>#ffc67b</item>
    <item>#ffe6a2</item>
    <item>#80e5b1</item>
    <item>#92e8e8</item>
    <item>#a6a1e6</item>
    <item>#e2a1e6</item>
</string-array>
  1. In the styles.xml file, define your own style and inherit PresetColorGridViewStyle. Set your own color list custom_standard_colors to attribute color_list.
<style name="CustomPresetColorGridStyle" parent="PresetColorGridViewStyle">
    <item name="color_list">@array/custom_standard_colors</item>
</style>
  1. In the application theme, set your customized style CustomPresetColorGridStyle to attribute preset_colors_style
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
    <item name"preset_colors_style">@style/CustomPresetColorGridStyle</item>
</style>
To learn about apply your custom theme to application, see: Apply a theme to an activity or app.

linkCustomize annotation presets

Different annotation types have different presets for style editing. It allows users to change style with only one tap. You can override the existing annotation presets as follows:

linkPreset attribute table

To override an existing annotation presets, first identify which annotation presets you are interested in changing

Preset attributeAnnotation typeDefault presets preview
R.attr.free_text_presetsFreeText
R.attr.freehand_presetsInk
R.attr.line_presetsLine
R.attr.link_presetsLink
R.attr.oval_presetsCircle
R.attr.rect_presetsSquare
R.attr.signature_presetsSignature
R.attr.highlight_presetsHighlight
R.attr.squiggly_presetsSquiggly
R.attr.strikeout_presetsStrikeOut
R.attr.underline_presetsUnderline
R.attr.sticky_note_presetsText (sticky note)
R.attr.other_presetsother annotation types
  1. In the styles.xml file, create a series of customized annotation styles. For detailed annotation style attributes, see tool style attributes.
<style name="CustomPresetStyle1">
    <item name="annot_color">#ffcd45</item>
    <item name="annot_icon">Comment</item>
</style>
<style name="CustomPresetStyle2">
    <item name="annot_color">#25d2d1</item>
    <item name="annot_icon">Star</item>
</style>
<style name="CustomPresetStyle3">
    <item name="annot_color">#00cc63</item>
    <item name="annot_icon">CheckMark</item>
</style>
<style name="CustomPresetStyle4">
    <item name="annot_color">#e44234</item>
    <item name="annot_icon">CrossMark</item>
</style>
  1. In the arrays.xml file, create your customized presets array.
<array name="custom_presets">
    <item>@style/CustomPresetStyle1</item>
    <item>@style/CustomPresetStyle2</item>
    <item>@style/CustomPresetStyle3</item>
    <item>@style/CustomPresetStyle4</item>
</array>
  1. In the application theme, set your customized presets array custom_presets to the annotation presets attribute identified in presets attribute table.

For example, if you want to change Text(sticky note) annotation presets, you set custom_presets to sticky_note_presets

<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
    <item name"sticky_note_presets">@array/custom_presets</item>
</style>

linkCustomize icons list

If the style dialog is for Text(sticky note) annotation, it shows an icon list for user to change sticky note icon.

linkDefault icons table

Icon nameIcon
Comment
Help
InsertCaret
Star
LightBulb
NewParagraph
CrossMark
CheckMark
LocationPin
ThumbsUp
  1. To change the icon list, first define a string array list in arrays.xml file. Each item in the list represents the icon name.
<string-array name="custom_icons">
    <item>Help</item>
    <item>InsertCaret</item>
</string-array>
  1. Set your customized icon list array to attribute sticky_note_icons in your application theme.
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
    <item name"sticky_note_icons">@array/custom_icons</item>
</style>