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.

ComPDFKit PDF SDK currently supports two types of verification methods: Online License and Offline License.

Online License: Online licensing supports dynamically updating license information. If we provide you with new services, you can obtain updates in real-time without any modifications.

Offline License: Offline licensing is suitable for scenarios with high security requirements and restricted network access. It allows you to use ComPDFKit PDF SDK when unable to connect to the internet.

Obtaining the License Key

If you want to use the ComPDFKit license for your application, we offer two types of licenses: trial license and full license. The full license must be bound to your developer device ID (How to Find the Developer Device ID).

  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.

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 based on the <type> field. If <type>online</type> is present, it indicates an online license. If <type>offline</type> is present or if the field is absent, it indicates an offline license.

**Online License: **

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

**Offline License: **

xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<license version="1">
    <platform>windows</platform>
    <starttime>xxxxxxxx</starttime>
    <endtime>xxxxxxxx</endtime>
    <key>LICENSE_KEY</key>
</license>
  1. Copy the value located at the LICENSE_KEY position within the <key>LICENSE_KEY</key> field. This is your license key.

Apply the License Key

Before using any classes from the ComPDFKit PDF SDK, you need to choose the corresponding scheme from the following two options based on the license type and apply the license to your application.

Online License

You can perform online authentication using the following method:

C#
public static bool LicenseVerify()
{
	if (!CPDFSDKVerifier.LoadNativeLibrary())
	{ 
		return false;
	}
	LicenseErrorCode status = CPDFSDKVerifier.OnlineLicenseVerify("Input your license here.");
	return status == LicenseErrorCode.E_LICENSE_SUCCESS;
}

Furthermore, if you need to confirm the communication status with the server during the current online authentication, you can achieve this by implementing the CPDFSDKVerifier.LicenseRefreshed callback.:

C#
CPDFSDKVerifier.LicenseRefreshed += CPDFSDKVerifier_LicenseRefreshed;

private void CPDFSDKVerifier_LicenseRefreshed(object sender, ResponseModel e)
{
	if(e != null)
	{
		string message = string.Format("{0} {1}", e.Code, e.Message);
		Trace.WriteLine(message);
	}
	else
    {
    	Trace.WriteLine("Network not connected."); 
    } 
}

Offline License

You can perform offline authentication using the following method:

c#
bool LicenseVerify()
{
    if (!CPDFSDKVerifier.LoadNativeLibrary())
        return false;

    LicenseErrorCode verifyResult = CPDFSDKVerifier.LicenseVerify("Input your license here.", false);
    return (verifyResult == LicenseErrorCode.E_LICENSE_SUCCESS);
}