Some test text!

Get started

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

Document Viewer

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

Document Viewer components

keyboard_arrow_down
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

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

Advanced customization

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

Conversion

keyboard_arrow_down
Convert documents to PDFConvert HTML to PDF

Search

keyboard_arrow_down
Text search

Other Frameworks

keyboard_arrow_down
XamarinReact Native

Advanced topics

keyboard_arrow_down
Understand coordinatesDocument savingDocument lockingGenerate page thumbnailsTool class hierarchy

FAQ

keyboard_arrow_down
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

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
Overviewkeyboard_arrow_down

Tools overview

In this document
chevron_rightWhat are tools?
chevron_rightAbout Tools
chevron_rightTechnical overview
chevron_rightAnnotation and creator tool table
chevron_rightAnnotation and handler tool table

linkWhat are tools?

The principal means of user interaction with the document being viewed, other than buttons, is the currently active tool. Selection, panning, and annotation creation, are all achieved using different tools. We provide many default tools to provide a full viewing experience out of the box. But fortunately API hooks for the tools appearance and logic is provided, so you can always achieve whatever customization you like using our existing API, or with your changes.

By default each annotation type has an associated tool to allow you to create those annotations. It's possible to create multiple tools for the same annotation type, for example a rectangle tool with a default color of blue and another tool with a default color of red. When creating a custom annotation you'll need to create an associated annotation tool to define how the user can create that annotation.

linkAbout Tools

PDFNet for Android has a companion package, com.pdftron:tools, that contains all of its UI functionality. The UI is highly flexible and configurable because the package is open source.

The following functionality is implemented in the com.pdftron:tools package:

  • PDF interaction:

    • Annotation creation/modification/deletion
    • Form filling
    • Signatures
    • Text selection
    • Link handling
    • Multimedia handling
    • Annotation syncing
  • UI Controls:

    • PDF outline
    • User bookmarks
    • Annotation list
    • Annotation toolbar
    • Page manipulation
    • Tabbed viewer
    • Reflow
    • Full text search
    • Page cropping

linkTechnical overview

The tools listed above handle interactions by receiving touch and gesture events forwarded from PDFViewCtrl. When touches or gestures are made, PDFViewCtrl sends corresponding events to its ToolManager.

The ToolManager is then responsible for passing the event to the current tool. If the current tool has fully handled the event, the event processing is finished. If the current tool cannot fully handle the event, the tool manager then forwards the event to the next tool.

The Tool class implements the ToolManager.Tool interface, thus handling all events passed to it from ToolManager. The ToolManager is responsible for passing the event to the current tool. If the current tool has fully handled the event, the processing of the event is finished. If the current tool cannot fully handle the event, the tool manager then forwards the event to the next tool.

linkAnnotation and creator tool table

The following table shows which tool mode is selected when a new annotation is created:

ToolToolModeAnnot
ArrowCreateARROW_CREATELine
CalloutCreateCALLOUT_CREATEFreeText
CheckboxFieldCreateFORM_CHECKBOX_CREATEWidget
CloudCreateCLOUD_CREATEPolygon
DigitalSignatureDIGITAL_SIGNATUREWidget
FileAttachmentCreateFILE_ATTACHMENT_CREATEFileAttachment
FreehandCreateINK_CREATEInk
FreeTextCreateTEXT_CREATEFreeText
LineCreateLINE_CREATELine
OvalCreateOVAL_CREATECircle
PolygonCreatePOLYGON_CREATEPolygon
PolylineCreatePOLYLINE_CREATEPolyLine
RectCreateRECT_CREATESquare
RectLinkCreateRECT_LINKLink
RubberStampCreateRUBBER_STAMPERRubberStamp
RulerCreateRULER_CREATELine
StickyNoteCreateTEXT_ANNOT_CREATEText
SignatureSIGNATUREWidget
SignatureFieldCreateFORM_SIGNATURE_CREATEWidget
SoundCreateSOUND_CREATESound
TextFieldCreateFORM_TEXT_FIELD_CREATEWidget
TextHighlightCreateTEXT_HIGHLIGHTHighlight
TextLinkCreateTEXT_LINK_CREATELink
TextSquigglyCreateTEXT_SQUIGGLYSquiggly
TextStrikeoutCreateTEXT_STRIKEOUTStrikeOut
TextUnderlineCreateTEXT_UNDERLINEUnderline

linkAnnotation and handler tool table

The following table shows which tool mode is selected when an annotation is selected for editing/handling:

AnnotToolToolMode
CircleAnnotEditANNOT_EDIT
FileAttachmentAnnotEditANNOT_EDIT
FreeTextAnnotEditANNOT_EDIT
HighlightAnnotEditTextMarkupANNOT_EDIT_TEXT_MARKUP
InkEraserINK_ERASER
LineAnnotEditLineANNOT_EDIT_LINE
LinkLinkActionLINK_ACTION
PolyLineAnnotEditAdvancedShapeANNOT_EDIT_ADVANCED_SHAPE
PolygonAnnotEditAdvancedShapeANNOT_EDIT_ADVANCED_SHAPE
RichMediaRichMediaRICH_MEDIA
SoundAnnotEditANNOT_EDIT
StrikeOutAnnotEditTextMarkupANNOT_EDIT_TEXT_MARKUP
SquareAnnotEditANNOT_EDIT
SquigglyAnnotEditTextMarkupANNOT_EDIT_TEXT_MARKUP
UnderlineAnnotEditTextMarkupANNOT_EDIT_TEXT_MARKUP

The ToolManager uses the Pan tool as its default tool. The Pan tool handles almost all user actions, such as tapping on an annotation, long-pressing to show the Quick Menu, and so forth. When the user taps on an annotation, the Pan tool is exchanged for a new tool for handling the tap event, the identity of the new tool corresponding to the selected annotation. For example, if, while using the Pan tool, the user taps on a Link annotation, the Pan tool will set the next tool to be the LinkAction tool. Then, the Link annotation will be handled by the LinkAction tool using LinkAction.onSingleTapConfirmed(MotionEvent). Besides gesture events such as onSingleTapConfirmed, onUp, and so forth, ToolManager.onQuickMenuClicked(QuickMenuItem) also follows the same flow.