Adding the License Key


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

Generate the License Key

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

  1. Log into the PSPDFKit customer portal at https://customers.pspdfkit.com/ using the credentials you received when purchasing PSPDFKit. You will see the list of all your purchased licenses.
  2. Locate your license (e.g. "PSPDFKit for iOS") and click the Assign license key button right next to it. A dialog will open.
  3. Enter the Bundle ID of your production app. If you are unsure about this step, please read our online guide about Bundle Identifiers 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 cannot be changed anymore.

Download the License Key

  1. Log into the PSPDFKit customer portal at https://customers.pspdfkit.com/ using the credentials you received when purchasing PSPDFKit. You will see the list of all your purchased licenses.
  2. Locate your license (e.g. "PSPDFKit for Android") and click the License Key button right next to it. If there is 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 it is ready to use.

Using the License Key

It is important that you set the license key before using any PSPDFKit classes.

Copy
1
2
3
4
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
    PSPDFKit.setLicenseKey("YOUR_LICENSE_KEY_GOES_HERE")
    return true
}
Copy
1
2
3
4
5
6
7
8
- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Set your license key here. PSPDFKit is commercial software.
    // Each PSPDFKit license is bound to a specific app bundle id.
    // Visit http://customers.pspdfkit.com to get your demo or commercial       license key.
    [PSPDFKit setLicenseKey:@"YOUR_LICENSE_KEY_GOES_HERE"];

    return YES;
}

If you are using storyboards you may have to set the license key in main.m, so it get's called even before willFinishLaunchingWithOptions:

Copy
1
2
3
4
5
6
7
8
9
10
11
#import <UIKit/UIKit.h>
#import "AppDelegate.h"

@import PSPDFKit;

int main(int argc, char * argv[]) {
    @autoreleasepool {
        [PSPDFKit setLicenseKey:@"YOUR_LICENSE_KEY_GOES_HERE"];
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}
Was this page helpful? We're happy to answer any questions.