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


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


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
Quick start - view a documentkeyboard_arrow_down

Quick start - view a document

In this document
chevron_rightNext Steps


  • A valid evaluation or commercial license key. If you do not have a license key, please contact sales for a commercial license key or click here to get an evaluation key.
  • The PDFTron Android SDK package.
  • The latest version of Android Studio.

In this quick start tutorial you will create a simple Android app that will open a PDF document stored in your Android project by using DocumentActivity. The sample code for this tutorial is available at our GitHub repository.

  1. On the Android welcome screen, click Start a new Android Studio project:
  1. Create a new Android Studio project with an Empty Activity and set the minimum SDK to API 16.

  2. For simplicity, we'll integrate the PDFTron SDK into our project using Gradle. You can learn more about how Gradle is used in Android Studio at the Gradle guides.

    Find your file in the root folder of your project and add your credentials to this file:

  3. Now find your project's root-level build.gradle file:

    and add the PDFTron Maven repository to the repositories tag:

    allprojects {
        repositories {
            maven {
                url "s3://pdftron-maven/release"
                credentials(AwsCredentials) {
                    accessKey AWS_ACCESS_KEY
                    secretKey AWS_SECRET_KEY

    Copy the following as is, do not import org.gradle.api.credentials.Credentials:

    Please make sure the above is added to the allprojects block, NOT the buildscript block.
  4. Then in your module's build.gradle file (usually app/build.gradle) add the following:

    android {
        defaultConfig {
            multiDexEnabled true
            vectorDrawables.useSupportLibrary = true
            manifestPlaceholders = [pdftronLicenseKey:PDFTRON_LICENSE_KEY]
        configurations.all {
            resolutionStrategy.force ""
            resolutionStrategy.force ""
            resolutionStrategy.force "android.arch.lifecycle:runtime:1.0.3"
    dependencies {
        implementation "com.pdftron:pdftron:6.9.1"
        implementation "com.pdftron:tools:6.9.1"
        implementation ''

    You should also sync your project when you make changes in your Gradle files.

    If you encountered any issue with gradle sync, check out the Troubleshooting guide.
  5. The fully-featured document viewer DocumentActivity requires all the android permissions listed in the table below, however if you decide to create your own custom document viewer you should leave out unnecessary permissions.

    android.permission.WRITE_EXTERNAL_STORAGEStorage permission for accessing local documents
    android.permission.INTERNETInternet permission for downloading online documents
    android.permission.RECORD_AUDIOAudio recording permission for creating sound annotations

    Since we are using the fully-featured reader in our sample app, we add these permissions to the AndroidManifest.xml file of our project. In this file, will also need to add a reference to our PDFTron license key and declare DocumentActivity. The resulting AndroidManifest.xml file should look something like this:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android=""
        <!-- Required permissions are added here -->
        <uses-permission android:name="android.permission.INTERNET"/>
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
        <uses-permission android:name="android.permission.RECORD_AUDIO" />
        <!-- Add multidex support and enable largeHeap -->
            <!-- Reference to our PDFTron license key -->
            <!-- Document viewer activity declaration-->
            <activity android:name="com.pdftron.pdf.controls.DocumentActivity"
  6. Also, add the following theme (referenced in AndroidManifest.xml) to your res/values/styles.xml file:

        <!-- Custom theme that will be used by the document reader -->
        <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>
    If you are using your own theme, please don't forget to add or change the theme tag of your AndroidManifest file's corresponding activity declaration.
  7. Now add a PDF file to the res\raw folder of your project (you can use our sample here) and call it sample.pdf, we are going to reference this file in the next step.

  1. In onCreate of your launcher activity, call DocumentActivity.openDocument(Context, int) to open this PDF file with the document reader:

    This launches DocumentActivity with our sample PDF document with default viewer configurations, and you should see the following:

    You can also view your document in DocumentActivity by specifiying a local file path, an HTTP/HTTPS url, or a Content Uri:

    Please note that any changes made to files opened from res\raw will not be saved on the disk.

    The source code for this tutorial can be found at our GitHub repository.

linkNext Steps