Some test text!

Add license key

In this document
chevron_rightAdd license key in AndroidManifest.xml
chevron_rightAdd license key directly in your code
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 See sign in for more details.

In order to automatically initialize PDFTron in your app, you'll need to add a valid license key in the AndroidManifest.xml file of your Android project. Alternatively, you can add the key by manually calling the static initialization methods. Before moving forward, please make sure you have added the PDFTron libraries to your project.

linkAdd license key in AndroidManifest.xml

The PDFTron Android SDK is auto-initialized only if there is a key defined in the AndroidManifest.xml file named pdftron_license_key. If you prefer to initialize PDFTron manually, see the next section for more information.
  1. Find your file in the root folder of your project and add your license key:

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

    android {
        defaultConfig {
            // ...
            manifestPlaceholders = [pdftronLicenseKey:PDFTRON_LICENSE_KEY]
  3. Add a placeholder for the license key to your AndroidManifest.xml file, inside the <application> tag:

        <!-- Add license key in meta-data tag here -->

    This tag will inject a build variable containing our license key into the manifest file. You can learn more about how this works here.

    You're now ready to start using PDFTron classes! Next let's try opening a document in an activity.

linkAdd license key directly in your code

Please ensure that you do not have pdftron_license_key defined in your AndroidManifest.xml file, otherwise PDFTron will be auto-initialized using this key.

Depending on the package you are using, you will need to call different initialization methods. In your main application's or main activity's onCreate method (and before setContentView in your activity) call one of the following:

  • Demo package:

    If you are using a com.pdftron:demo dependency (i.e. using implementation "com.pdftron:demo:6.9.5" in your app/build.gradle file), make sure you are using the full version of PDFTron library and call:

    The PDFTron demo library requires the full version of PDFTron library. See PDFTron full or standard? for more details.
  • Tools package:

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

  • PDFTron package:

    If your application requires greater flexibility and you are using classes in the PDFTron package directly, you can initialize using the following method instead:

    If you are also using a the Tools library (i.e. com.pdftron:tools) call:

    Please note that if you use PDFNet.initialize, you will have to set up the PDFTron library manually (for more information see the PDFTron class documentation).

You're now ready to start using PDFTron classes! Next let's try opening a document in an activity.