Some test text!

How to integrate the PDFTron libraries from source

Contents

Integrate PDFTron libraries from source
Prerequisites
Next Steps

The source code for the Tools and Demo libraries can be integrated into your Android app and further customized to meet your needs.

linkIntegrate PDFTron libraries from source

linkPrerequisites

  • An existing Android Studio project running in the latest version of Android Studio
  • Minimum API: 16 (using Android Support Libraries)
  • Recommended target API: 28
  • Downloaded the PDFTron Android SDK:

    A trial key is needed to use and download the SDK.

    Get Your Free Trial License Key

This guide will help you integrate the Tools and Demo libraries with your Android Studio project.

  1. Add the following lines in your project's root-level build.gradle file.

    allprojects {
        repositories {
            // ...
            flatDir {
                dirs '../libs'
            }
        }
    }
    
    // ...
    ext.mySupportVersion = "28.0.0"
    ext.myBuildToolsVersion = "28.0.2"
    ext.myMinSdkVersion = 16
    ext.myTargetSdkVersion = 28
    ext.myCompileSdkVersion = 28
    
    ext.pdfnetGroup = { dependencyHandler ->
        delegate = dependencyHandler
    
        implementation "com.pdftron:pdftron@aar"
        implementation "com.pdftron:floatingactionbutton@aar"
        implementation "com.pdftron:pagecropper@aar"
    }
    
    ext.supportLibGroup = { dependencyHandler ->
        delegate = dependencyHandler
    
        implementation "com.android.support:support-v4:$mySupportVersion"
        implementation "com.android.support:appcompat-v7:$mySupportVersion"
        implementation "com.android.support:recyclerview-v7:$mySupportVersion"
        implementation "com.android.support:design:$mySupportVersion"
        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"
    
        // RxJava
        implementation "io.reactivex.rxjava2:rxjava:2.2.2"
        implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
    }
  2. Create a new folder named libs in your project's root directory, then copy the following files from the SDK package to this folder:

  3. Open your project in Android Studio and go to File > New > Import Module...

    Individually import the lib\src\PDFViewCtrlTools and lib\src\pdfnet-demo-utils library modules from the SDK package into your project.

  4. Finally, add the MultiDex and PDFTron library dependencies to your app by adding the following to your app's module level build.gradle file:

    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 project(':pdfnet-demo-utils')
        implementation project(':PDFViewCtrlTools')
        implementation 'com.android.support:multidex:1.0.3'
    }

Your project is now running PDFTron from source and you can start modifying the PDFTron Android libraries in your project.

linkNext Steps

Get the answers you need: Support

Contents

Integrate PDFTron libraries from source
Prerequisites
Next Steps