Add a License Key

PSPDFKit is a commercial product and uses a license key to verify your copy against the package name you registered.

Alternatively, you can initialize the SDK in trial mode without a license.

Generating the License Key

To use a PSPDFKit license with your app, you have to generate a license key and bind it to the applicationId bundle ID of your app.

  1. Log in to the PSPDFKit Portal using the credentials you received when purchasing PSPDFKit. You’ll see the list of all your purchased licenses.

  2. Locate your license (e.g. PSPDFKit for Android) and click the Assign license key button next to it. A dialog will open.

  3. Enter the bundle ID of your production app. If you’re unsure about this step, please read our What Is a Bundle ID? guide first.

  4. Click next and confirm your selected bundle ID. Please double-check that the chosen identifier matches the one configured in your app, as it can no longer be changed once it’s been set.

Getting the License Key

  1. Log in to the PSPDFKit Portal using the credentials you received when purchasing PSPDFKit. You’ll see the list of all your purchased licenses.

  2. Locate your license (e.g. PSPDFKit for Android) and click the License Key button next to it. If there’s no such button, you probably need to generate the license key first.

  3. A dialog will open showing you a code snippet with your license key.

  4. After copying the license key over to your project, the PSPDFKit SDK will be ready to use.

Adding the License Key

This can be done either through editing your AndroidManifest, or calling the PSPDFKit.initialize method manually. Calling PSPDFKit.initialize without passing in a key will initialize the SDK in trial mode.

For the first option, you must add the following <meta-data> element to your application’s AndroidManifest.xml:

<application>
    <meta-data
        android:name="pspdfkit_license_key"
        android:value="YOUR_LICENSE_KEY_GOES_HERE" />
</application>

When this snippet is present, PSPDFKit will initialize itself as soon as your app starts.

In some situations, you might want to initialize the SDK manually at a later point (i.e. not during app startup). This can be done by using the PSPDFKit.initialize method and providing it with your license key:

PSPDFKit.initialize(context, "YOUR_LICENSE_KEY_GOES_HERE")
PSPDFKit.initialize(context, "YOUR_LICENSE_KEY_GOES_HERE");

More initialize options can be passed using [InitializationOptions][], instead of using only a license key string to PSPDFKit.initialize.

Since initialization can take some time (due to extraction and loading of PSPDFKit’s native libraries), make sure to initialize PSPDFKit on a background thread, in order to not block your UI.

Trial Mode

For the trial experience, you can initialize the SDK with a null license:

PSPDFKit.initialize(context, null)
PSPDFKit.initialize(context, null);

More information on trying out PSPDFKit for Android can be found on our trial page.