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.

Gradle Integration

linkPrerequisites

  • Android Studio

    linkProject Specifications

    • Minimum API: 16 (using Android Support Libraries)
    • Recommended target API: 28
    • If your app is using AndroidX you will also need to add android.useAndroidX=true and android.useAndroidX=true in your gradle.properties file. You can learn more about this here.

linkSetup

Create a new project on Android Studio called myApp.

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

linkIntegrate PDFTron SDK into your Android application

  1. Open the build.gradle file in your project's root directory:

    Edit it to include the following inside the allprojects.repositories section to include PDFTron's Maven repository:

    allprojects {
        repositories {
            // ... Anything else you already had
            google()
            maven {
                url "https://pdftron-maven.s3.amazonaws.com/release"
            }
        }
    }
    Make sure you have not added the above inside the buildscript section accidentally.
    PDFTron SDK for Android is hosted on a private Maven repository in Amazon S3, so an access token is required to download it. The project only communicates with Amazon S3 in order to download PDFTron SDK for Android. Otherwise, no other communication between your environment and Amazon S3 (or any other external service) is required. If you prefer not to use Amazon S3, you can find an alternative approach here.
  2. Open the build.gradle file in your app module's directory:

    Edit it to add a dependency for the full version of PDFTron:

    android {
        defaultConfig {
            // ... Anything that was already here
            multiDexEnabled true
            vectorDrawables.useSupportLibrary = true
            manifestPlaceholders = [pdftronLicenseKey:PDFTRON_LICENSE_KEY]
        }
        configurations.all {
            // ... Anything that was already here
            resolutionStrategy.force "com.android.support:appcompat-v7:28.0.0"
            resolutionStrategy.force "com.android.support:support-v4:28.0.0"
        }
    }
    
    dependencies {
        // ... Anything that was already here
        implementation "com.pdftron:pdftron:7.0.1"
        implementation "com.pdftron:tools:7.0.1"
    
        implementation 'com.android.support:multidex:1.0.3'
    
        // ***** Optionally include the demo library ****
        implementation "com.pdftron:demo:7.0.1"
        // **********************************************
    }
    The next part of this guide will use DocumentActivity to open and view a document which requires the full version of PDFTron SDK. The standard version has lighter set of features to reduce the size of the APK. You can find out more about the differences between the two versions here.
  1. 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).
  2. Open your AndroidManifest.xml file and add a <metadata> tag inside the <application> tag to be a placeholder for the license key:

    <application
    ... (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>

You can now use PDFTron SDK to view, annotate and edit documents.

linkIntegrating Standard Version

Open the build.gradle file in your app module's directory.

Edit it to add a dependency for the standard version of PDFTron:

android {
    defaultConfig {
        // ...
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true
        manifestPlaceholders = [pdftronLicenseKey:PDFTRON_LICENSE_KEY]
    }
    configurations.all {
        resolutionStrategy.force "com.android.support:appcompat-v7:28.0.0"
        resolutionStrategy.force "com.android.support:support-v4:28.0.0"
    }
}

dependencies {
    // ...
    implementation "com.pdftron:pdftron-standard:7.0.1"
    implementation "com.pdftron:tools:7.0.1"

    implementation 'com.android.support:multidex:1.0.3'
}

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