Some test text!

Integrate with Gradle

If you prefer to include AAR files directly in your project, you can find an alternative approach here.
Android Studio is required in order to include PDFTron in your app. The Eclipse IDE is not supported.

Supported SDK versions:

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

The following are a few simple steps that will prepare your Android Studio project for integrating PDFTron libraries using Gradle. You can learn more about how Gradle is used in Android Studio at the Gradle guides.

  1. Add the following to your project's root-level build.gradle file in order to include PDFTron's Maven repository.

    allprojects {
        // ...
        repositories {
            // ...
            google()
            maven {
                url "s3://pdftron-maven/release"
                credentials(AwsCredentials) {
                    accessKey AWS_ACCESS_KEY
                    secretKey AWS_SECRET_KEY
                }
            }
        }
    }
    Please make sure the above is added to the allprojects block, NOT the buildscript block.
    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. Add credentials to your project's gradle.properties file:

    An evaluation or commercial license key is required to run PDFTron. If you are evaluating the SDK and do not have a key, please obtain one, and then visit this page via the link included in the trial email. If your company has licensed PDFTron then you already received your key in an email from team@pdftron.com. See sign in for more details.
  3. In your module's build.gradle file (usually app/build.gradle), add:

    android {
        defaultConfig {
            // ...
            multiDexEnabled true
            vectorDrawables.useSupportLibrary = true
        }
        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:6.9.1"
        implementation "com.pdftron:tools:6.9.1"
    
        implementation 'com.android.support:multidex:1.0.3'
    }
  4. To use the activities shown in the CompleteReader sample project, include the following as well:

    dependencies {
        // ...
        implementation "com.pdftron:demo:6.9.1"
    }

You are set to go! Now, it's time to add a PDFTron license key to your application and open a document in an activity.