Some test text!

menu
search

Get started integrating PDFTron Android SDK

Welcome to PDFTron. This guide will help you integrate a free trial of PDFTron Android SDK into your Android Studio projects. You can either integrate PDFTron packages automatically using Gradle, or install them manually using .aar files by downloading the SDK. Pick whichever your option you prefer, but integrating with Gradle is the recommended approach. Your free trial includes unlimited trial usage and support from solution engineers.

Manual Integration

linkPrerequisites

  • Android Studio

    linkProject Specifications

    • Minimum API: 16 (using Android Support Libraries)
    • Recommended target API: 28
  • PDFTron Android SDK
    Download

linkSetup

  1. Extract the folder from the .zip file.

    This article will assume that the path into the extracted PDFNetAndroid library bundle is called PDFTRON_BASE

    PDFTRON_BASE=path/to/your/extraction/folder/PDFNetAndroid/
  2. Create a new project on Android Studio called myApp. Find out the path to the app/libs folder. If the libs folder does not exist, create one in the module (for example, myApp/app/libs).

    For the purposes of this guide, you can start with an Empty Activity.

linkIntegrate PDFTron SDK into your Android application

  1. Copy the full version of PDFTron SDK from PDFTRON_BASE/lib/full/pdftron.aar into your app/libs directory.
The standard version can be found in PDFTRON_BASE/lib/standard/pdftron.aar. The next part of this guide will use DocumentActivity to open and view a document which requires the full version for its features. You can learn the differences between the full and standard versions here.
  1. Copy all of the following files into your app/libs directory:

    • PDFTRON_BASE/lib/floatingactionbutton.aar
    • PDFTRON_BASE/lib/pagecropper.aar
    • PDFTRON_BASE/lib/tools.aar
    • (Optional)PDFTRON_BASE/lib/demo.aar

    You can learn more about the different packages here.

    Now, your app/libs folder should look like this:

    app
    ├── ...
    └── libs
        ├── pdftron.aar
        ├── floatingactionbutton.aar
        ├── pagecropper.aar
        ├── tools.aar
        └── (Optional) demo.aar
  2. Open the build.gradle file in your project's root directory:

    Edit it to include the following inside the allprojects.repositories section:

    allprojects {
        repositories {
            // ... Anything else you already had
            flatDir {
                dirs 'libs'
            }
        }
    }
    Make sure you haven't added the above inside the buildscript section accidentally.
  3. Open the build.gradle file in your app module's directory:

    Edit it to include the following inside the android.defaultConfig section:

    android {
        defaultConfig {
            // ... Anything else you already had
            multiDexEnabled true
            vectorDrawables.useSupportLibrary = true
            manifestPlaceholders = [pdftronLicenseKey:PDFTRON_LICENSE_KEY]
        }
    }

    Also edit the dependencies section and include:

    dependencies {
        // ... Anything else you had here before
    
        implementation "com.pdftron:pdftron@aar"
        implementation "com.pdftron:tools@aar"
        implementation "com.pdftron:floatingactionbutton@aar"
        implementation "com.pdftron:pagecropper@aar"
    
        implementation "com.android.support:support-v4:28.0.0"
        implementation "com.android.support:appcompat-v7:28.0.0"
        implementation "com.android.support:recyclerview-v7:28.0.0"
        implementation "com.android.support:design:28.0.0"
        implementation "com.android.support.constraint:constraint-layout:1.1.2"
        implementation "android.arch.lifecycle:extensions:1.1.1"
    
        implementation "commons-io:commons-io:2.4"
        implementation "org.apache.commons:commons-lang3:3.5"
        implementation "com.google.code.gson:gson:2.8.0"
        implementation "io.reactivex.rxjava2:rxjava:2.2.2"
        implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
    
        implementation "com.squareup.picasso:picasso:2.5.2"
    
        implementation 'com.android.support:multidex:1.0.3'
    
        // *****Optionally Include if you added demo.arr*****
        implementation "com.pdftron:demo@aar"
        implementation 'com.facebook.fresco:fresco:1.2.0'
        // ***************************************************
    }
  4. In your project's root directory, find the gradle.properties file. Add the following line to it:

    # ... Anything else you may have here
    
    PDFTRON_LICENSE_KEY=INSERT_COMMERCIAL_LICENSE_KEY_HERE_AFTER_PURCHASE

    You do not require a valid license key for a trial.

    Your license key is confidential. Please make sure that it is not publicly available (e.g. in your public GitHub).
  5. Open your AndroidManifest.xml file and add a <metadata> tag inside the <application> tag to be a placeholder for the license key:

    <application
    ... (existing attributes)
    >
    
    <!-- Add license key in meta-data tag here. This should be inside the application tag. -->
    <meta-data
        android:name="pdftron_license_key"
        android:value="${pdftronLicenseKey}"/>
        
    </application>

linkSDK package overview

PDFTron for Android contains the following key files and folders:

File/Folder NameDescription
docsContains the PDFTron Android API reference documentation
libContains the PDFTron AAR libraries and the source files to the open-source UI
- /full: Contains full version of pdftron.aar
- /standard: Contains standard version of pdftron.aar
- /src: Contains source code for tools.aar, demo.aar, pdftron-collab.aar and pdftron-collab-wvs.aar
samplesContains the Java and Kotlin sample projects: Showcase, CompleteReader, and MiscellaneousSamples
legal.txtLegal and copyright information
license.pdfPDFTron Software License agreement

linkNext step

View a document

Get the answers you need: Support

close

Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.

PDFTron Receives USD$71 Million Growth Investment Led By Silversmith Capital Partners

Learn More
close