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


Convert documents to PDFConvert HTML to PDF

Parsing and extraction


Digital signatures



Text search

Advanced topics


Other frameworks

XamarinReact Native




ProGuardLocalizationIcon cheat sheet

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
Show a document in an Activitykeyboard_arrow_down

Show a document in an Activity

DocumentActivity requires the full version of PDFTron library. See PDFTron full or standard?

PDFTron ships with DocumentActivity which is an all-in-one document reader and PDF editor. In addition to PDF files, it also supports viewing of other file extensions such as .docx, .doc, .pptx, .xlsx, .md, .cbz and various image formats. It allows stream conversion of these non-pdf documents to PDF format so you can view the document while conversion happens. In this activity, you can read, annotate, sign, fill in PDF forms and more. See detailed features list here.

DocumentActivity extends Android's AppCompatActivity and follows Material design guidelines.

Please note that DocumentActivity requires the com.pdftron:tools package.

Here are a few simple steps to get started with DocumentActivity.

  1. First, add activity declarations to AndroidManifest.xml file:

        <activity android:name="com.pdftron.pdf.controls.DocumentActivity"
    If your app is targeting Android SDK version 28 or higher, please also set the android:usesCleartextTraffic="true" attribute in your application tag.
  2. Then, add theme to res/values/styles.xml:

    <style name="CustomAppTheme" 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>
        <!-- Action bar -->
        <item name="actionModeBackground">?attr/colorPrimary</item>
        <item name="windowActionModeOverlay">true</item>

    Alternatively, if you cannot use NoActionBar as a base theme:

    DocumentActivity extends AppCompatActivity and uses AppCompat Toolbar. It is important that you define a Theme.AppCompat-based theme. The recommended theme is Theme.AppCompat.*.NoActionBar. Other custom themese can also be used however, be sure to disable the action bar manually:

    <style name="CustomAppTheme" parent="Theme.AppCompat.*">
        <!-- Action bar -->
        <item name="windowActionModeOverlay">true</item>
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
  3. Then, if you would like to customize the UI of DocumentActivity, you can use ViewerConfig builder. For example:

    For details on customizing the UI interface and sample usage of ViewerConfig builder, check out the configuration tutorial.

  4. If you need storage permission for accessing local documents, add the following permission to AndroidManifest.xml in the <manifest> tag (outside the <application> tag):

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    Storage permission
    Please note that from Android 6.0, API 23, and up, application needs to request storage permission at runtime before accessing any files on device.
  5. If you need internet permission for downloading online documents, add the following permission to AndroidManifest.xml in the <manifest> tag (outside the <application> tag):

    <uses-permission android:name="android.permission.INTERNET"/>
  6. If you have sound annotation creation tool enabled, add the following permission to AndroidManifest.xml in the <manifest> tag (outside the <application> tag):

    <uses-permission android:name="android.permission.RECORD_AUDIO" />
  7. Lastly, launch the activity from anywhere in your application: