Using the License Key in Other Languages

Before using PSPDFKit for Android in any of the supported hybrid frameworks (e.g. Flutter, React Native, Cordova/Ionic, or Xamarin), the SDK has to be initialized using the appropriate PSPDFKit for Android license key. This article explains the required license setup and initialization steps for each hybrid framework. If you need to integrate the license into an app that’s written in Kotlin or Java, please see our license integration guide.

ℹ️ Note: To use PSPDFKit inside your hybrid project, you first need to obtain a valid license key. The license key can be obtained in the PSPDFKit Customer Portal (for existing customers) or by following the link inside the PSPDFKit demo email.

Obtaining the License Key

The license code you get from the customer center or the demo email is similar to this:

const val PSPDFKIT_LICENSE_KEY = "PQmgAnmE1GsqwrY8nV2Gaq4g9wcg8XDF3p9ymbsw1npPclRg9Wsd3FQZXF2s4OT9BeiKk6g9sutdcy9032sgf8afm432wkq50SrGfi71CDuJCoVdIbF6Zj+BIYeaz38ghlFfydfMOFlfd4H5t0y"

private static final String PSPDFKIT_LICENSE_KEY = "PQmgAnmE1GsqwrY8nV2Gaq4g9wcg8XDF3p9ymbsw1npPclRg9Wsd3FQZXF2s4OT9BeiKk6g9sutdcy9032sgf8afm432wkq50SrGfi71CDuJCoVdIbF6Zj+BIYeaz38ghlFfydfMOFlfd4H5t0y";

Using the License Key in Apache Cordova and Ionic

Our Apache Cordova SDK requires you to add the license key to the AndroidManifest.xml of your Android Cordova app. This file is usually located at <your_project>/platforms/android/AndroidManifest.xml, as shown in the example below:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.pspdfkit.example">

    <application>

        <meta-data
            android:name="pspdfkit_license_key"
            android:value="PQmgAnmE1GsqwrY8nV2Gaq4g9wcg8XDF3p9ymbsw1npPclRg9Wsd3FQZXF2s4OT9BeiKk6g9sutdcy9032sgf8afm432wkq50SrGfi71CDuJCoVdIbF6Zj+BIYeaz38ghlFfydfMOFlfd4H5t0y"/>

    </application>

</manifest>

Using the License Key in Flutter

To set the license key in Flutter, use this:

Pspdfkit.setLicenseKey("PQmgAnmE1GsqwrY8nV2Gaq4g9wcg8XDF3p9ymbsw1npPclRg9Wsd3FQZXF2s4OT9BeiKk6g9sutdcy9032sgf8afm432wkq50SrGfi71CDuJCoVdIbF6Zj+BIYeaz38ghlFfydfMOFlfd4H5t0y");

Using the License Key in React Native

Our React Native SDK requires you to add the license key to the AndroidManifest.xml of your Android React Native app. This file is usually located at <your_project>/android/app/src/main/AndroidManifest.xml, as shown in the example below:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.pspdfkit.example">

    <application>

        <meta-data
            android:name="pspdfkit_license_key"
            android:value="PQmgAnmE1GsqwrY8nV2Gaq4g9wcg8XDF3p9ymbsw1npPclRg9Wsd3FQZXF2s4OT9BeiKk6g9sutdcy9032sgf8afm432wkq50SrGfi71CDuJCoVdIbF6Zj+BIYeaz38ghlFfydfMOFlfd4H5t0y"/>

    </application>

</manifest>

Using the License Key in Xamarin

In Xamarin, you need to set the license key inside your MainActivity.cs in between the using statements and the namespace declaration, using an assembly attribute:

using System;
using PSPDFKit;

[assembly: MetaData (
	name: "pspdfkit_license_key",
	Value = "PQmgAnmE1GsqwrY8nV2Gaq4g9wcg8XDF3p9ymbsw1npPclRg9Wsd3FQZXF2s4OT9BeiKk6g9sutdcy9032sgf8afm432wkq50SrGfi71CDuJCoVdIbF6Zj+BIYeaz38ghlFfydfMOFlfd4H5t0y"
)]

namespace YourAwesomeApp { ... }