Converting the License Key to JavaScript

If you are using PSPDFKit in a JavaScript-based framework, you need to convert the licenses (which are provided in the form of Kotlin and Java examples) to JavaScript first. This article explains how to properly perform this conversion.

ℹ️ Note: To use PSPDFKit inside your JavaScript-based 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

Our license integration guides explain how to integrate the the license into an app that is written in Kotlin or Java. If you want to add the license in JavaScript, here's how to do it.

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

Copy
1
2
const val PSPDFKIT_LICENSE_KEY = "PQmgAnmE1GsqwrY8nV2Gaq4g9wcg8XDF3p9ymbsw1npPclRg9Wsd3FQZXF2s4OT9BeiKk6g9sutdcy9032sgf8afm432wkq50SrGfi71CDuJCoVdIbF6Zj+BIYeaz38ghlFfydfMOFlfd4H5t0y"

Copy
1
2
private static final String PSPDFKIT_LICENSE_KEY = "PQmgAnmE1GsqwrY8nV2Gaq4g9wcg8XDF3p9ymbsw1npPclRg9Wsd3FQZXF2s4OT9BeiKk6g9sutdcy9032sgf8afm432wkq50SrGfi71CDuJCoVdIbF6Zj+BIYeaz38ghlFfydfMOFlfd4H5t0y";

Converting for Apache Cordova

Our Apache Cordova wrapper 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. For example:

Copy
AndroidManifest.xml
1
2
3
4
5
6
7
8
9
10
11
12
<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>