Some test text!

Getting started

keyboard_arrow_down
Running samplesTry demo in your projectDownloading PDFTronIntegrating PDFTron via GradleManually integrating PDFTronUpgradingAdding PDFTron license keyUsing ProGuardTroubleshooting integration

Fundamentals

keyboard_arrow_down
Document lockingSaving PDF documentsUnderstanding coordinates

Basics

keyboard_arrow_down
Using an ActivityUsing a FragmentUsing PDFViewCtrlViewer configConverting and viewing other document typesConverting HTML to PDF

Viewer

keyboard_arrow_down
PDFViewCtrl color modesPDFViewCtrl page view modePDFViewCtrl page presentation modeGenerating thumbnails in PDF

Features

keyboard_arrow_down
Day/Night themesUndo and redoText searchAnnotation syncingRotating PDF pagesPDFViewCtrl read onlyUsing PDFViewCtrl with minimum memory

Tools

keyboard_arrow_down
Tools overviewSetting Up ToolManagerChanging and disabling toolsIntercepting annotation handlingToolManager eventsDefault annotation propertiesTool subclasses

Annotations

keyboard_arrow_down
Deleting annotationsAnnotation styleShow/hide annotations

UI components

keyboard_arrow_down
Quick menuAnnotation toolbarAnnotation style dialogThumbnail sliderAnnotations listOutline listUser bookmarks listBookmarks dialogPage thumbnails dialogAdd page dialogRotate pages dialogView mode dialogCrop page dialogReflow

Advanced

keyboard_arrow_down
Adding a custom view to a PDF pageCustom toolCustomizing quick menuCustomizing annotation style dialog

FAQ

keyboard_arrow_down
Running project in Android StudioSystem RequirementsPDFTron full vs. standardLocalizationIcon cheat sheetRunning sample with sourceReducing size of APKEnable multidexOut of memory when rotating device multiple timesDetachCurrentThread warning

PDF Processing API

keyboard_arrow_down
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
Adding PDFTron license keykeyboard_arrow_down

Adding a PDFTron license key

In this document
chevron_rightOption 1
chevron_rightOption 2
chevron_rightOption 3
Warning
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.

It is important that you initialize the PDFTron library with a valid license key before using any PDFTron classes. There are a few ways to include a license key in your application.

linkOption 1

(Full version required) Include the license key directly in your code. In your MainApplication.java or MainActivity.java file's onCreate method (before setContentView of your Activity), add:

If you are using a com.pdftron:demo dependency (i.e. using implementation "com.pdftron:demo:6.8.+" in your app/build.gradle file):



Otherwise:

If you are only using a com.pdftron:tools dependency (i.e. using implementation "com.pdftron:tools:6.8.+" and not using implementation "com.pdftron:demo:6.8.+" in your app/build.gradle file):



linkOption 2

(Full version required) Define the license key in gradle.properties, where you can inject build variables into the manifest. First, add your PDFTron license key to your project's gradle.properties file:

PDFTRON_LICENSE_KEY=YOUR_PDFTRON_LICENSE_KEY_GOES_HERE

Then, in your module's Gradle file (usually app/build.gradle), add:

android {
    defaultConfig {
        ...
        manifestPlaceholders = [pdftronLicenseKey:PDFTRON_LICENSE_KEY]
    }
}

After that, add a placeholder for the license key to your AndroidManifest.xml file, inside the <application> tag:

<meta-data
    android:name="pdftron_license_key"
    android:value="${pdftronLicenseKey}"/>

Lastly, in your MainApplication.java or MainActivity.java file's onCreate method (before your Activity's setContentView), add one of the following depending on the dependency used by your project:

If you are using a com.pdftron:demo dependency (i.e. using implementation "com.pdftron:demo:6.8.+" in your app/build.gradle file):



Otherwise:

If you are only using a com.pdftron:tools dependency (i.e. using implementation "com.pdftron:tools:6.8.+" and not using implementation "com.pdftron:demo:6.8.+" in your app/build.gradle file):



linkOption 3

Include the license key directly in your code, but in a way that offers greater flexibility than Options 1 and 2. In your MainApplication.java or MainActivity.java file's onCreate method (before your Activity's setContentView), add:



If you are also using a com.pdftron:tools dependency, add:



Please note that option 1 and 2 will set up various recommended presets for using PDFTron SDK. If you choose to go with option 3, you will have to setup the options manually (For more information see PDFTron class documentation).

You are set to go! Now, it is time to open a document in an Activity.