Skip to content

Apply the License Key

ComPDFKit PDF SDK is a commercial SDK, which requires a license to grant developer permission to release their apps. Each license is only valid for one bundle ID in development mode. ComPDFKit supports flexible licensing options, please contact our marketing team to know more. However, any documents, sample code, or source code distribution from the released package of ComPDFKit to any third party is prohibited.

Online License: We have introduced an online license mechanism for enhanced license management. Through the online approach, you can manage and update your license more flexibly to meet the specific requirements of your project.

Offline License: In scenarios with high security requirements, no internet connectivity, or offline environments, we provide the option of an offline license. The offline license allows authorization and usage of the ComPDFKit PDF SDK when internet connectivity is not available.

Obtaining the License Key

If you intend to use the ComPDFKit license for your application, we offer two types of licenses: a trial license and a formal license. The formal license requires binding to the unique Bundle ID of your application. ComPDFKit provides two methods to obtain a license, and you can choose either based on your preferences.

Method One:

  1. Initiate contact with our sales team by completing the requirements form on the Contact Sales page of the ComPDFKit official website.
  2. After receiving your submission, our sales team will reach out to you within 24 hours to clarify your requirements.
  3. Upon confirmation of your requirements, you will be issued a complimentary trial license valid for 30 days. Throughout this period, any issues you encounter will be supported with free technical assistance.
  4. If you are satisfied with the product, you have the option to purchase the formal license. Once the transaction is completed, our sales team will send the official license to you via email.

Method Two (Mobile Platforms Only):

  1. Log in to the ComPDFKit official website's Online Sales Interface to submit a trial application and receive an immediate free trial license for iOS platforms, valid for 30 days.
  2. If content with the product, you can directly purchase the formal license on the Online Sales Interface of the official website.
  3. When purchasing the formal license, ensure to bind the license to your application's Bundle ID. If uncertain about the Bundle ID, refer to How to Find the Bundle ID of Your App.
  4. Following a successful payment, the system will automatically email the official license bound to your Bundle ID.
  5. If any issues arise during the online transaction, you can submit your problems through the Technical Support page on the ComPDFKit official website. We will respond to your inquiries within 24 hours, providing free technical support services.

Copying the License Key

Accurately obtaining the license key is crucial for the application of the license.

  1. In the email you received, locate the XML file containing the license key.

  2. Open the XML file and determine the license type through the <type>online</type> field. If present, it is an online license; if absent or <type>offline</type> is present, it is an offline license.

    Online License:

    xml
    xmlCopy code
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <license version="1">
        <platform>ios</platform>
        <starttime>xxxxxxxx</starttime>
        <endtime>xxxxxxxx</endtime>
        <type>online</type>
        <key>LICENSE_KEY</key>
    </license>

    Offline License:

    xml
    xmlCopy code
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <license version="1">
        <platform>ios</platform>
        <starttime>xxxxxxxx</starttime>
        <endtime>xxxxxxxx</endtime>
        <key>LICENSE_KEY</key>
    </license>
  3. Copy the LICENSE_KEY from the <key>LICENSE_KEY</key> field.

Apply the License Key

You can contact the ComPDFKit team to obtain a trial license. Before using any ComPDFKit PDF SDK classes, you must perform the following steps to apply the license to your application:

  1. In AppDelegate.swift, import the header file ComPDFKit.
  2. Depending on the type of authentication obtained in the previous step, whether online or offline, initialize the license using the respective method based on your requirements.
  3. Initialize the license:
  • Online license:

Follow the code below and call the method CPDFKit.verify(withOnlineLicense: "LICENSE_KEY") { code, message in } in func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool. You need to replace the LICENSE_KEY with the license you obtained.

swift
  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
  // Set your online license key here. ComPDFKit is commercial software.
  // Each ComPDFKit license is bound to a specific app bundle id.
  // com.compdfkit.pdfviewe
    
    CPDFKit.verify(withOnlineLicense: "YOUR_LICENSE_KEY_GOES_HERE") { code, message in
    }
}
objective-c
#import <ComPDFKit/ComPDFKit.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  // Set your online license key here. ComPDFKit is commercial software.
  // Each ComPDFKit license is bound to a specific app bundle id.
  // com.compdfkit.pdfviewer
    
    [CPDFKit verifyLicense:@"YOUR_LICENSE_KEY_GOES_HERE" completionHandler:^(CPDFKitOnlineLicenseCode code, NSString *message) {

    }];
    
    return YES;
}
  • Offline license:

Follow the code below and call the method CPDFKit.verifyWithKey:"LICENSE_SECRET" in func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool . You need to replace the LICENSE_KEY with the license you obtained.

swift
  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
  // Set your license key here. ComPDFKit is commercial software.
  // Each ComPDFKit license is bound to a specific app bundle id.
  // com.compdfkit.pdfviewer
    
    CPDFKit.verify(withKey: "YOUR_LICENSE_KEY_GOES_HERE")
    return true
}
objective-c
#import <ComPDFKit/ComPDFKit.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  // Set your local license key here. ComPDFKit is commercial software.
  // Each ComPDFKit license is bound to a specific app bundle id.
  // com.compdfkit.pdfviewer
    
    [CPDFKit verifyWithKey:@"YOUR_LICENSE_KEY_GOES_HERE"];
    
    return YES;
}

Compile and run the project. If the console outputs "version information", it means that the license has been set successfully. Otherwise, please check the "Troubleshooting" section at Troubleshooting or check error logs in the console to quickly identify and solve the issue.