Copy the License Key
Accurately obtaining the license key is crucial for applying the license.
- In the email you received, locate the XML file containing the license key.
- 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. - Copy the value located at the
LICENSE_KEYposition within the<key>LICENSE_KEY</key>field. This is your license key.
Apply the License Key
Use sdk.licenseVerify() before initializing the SDK and starting conversions.
js
const sdk = require("./lib/index.js");
const license = "LICENSE_KEY";
const deviceId = "DEVICE_ID";
const appId = "com.example.application";
const code = sdk.licenseVerify(license, deviceId, appId);
if (code !== 0) {
throw new Error(`license verification failed: ${code}`);
}
sdk.initialize();You can also read license information from environment variables in command-line tools:
js
const license = process.env.COMPDFKIT_LICENSE;
const deviceId = process.env.COMPDFKIT_DEVICE_ID || "";
const appId = process.env.COMPDFKIT_APP_ID || "com.example.application";The sample scripts also accept --license, --device-id, and --app-id. When these options are not provided, they read the same environment variables and fall back to local demo values packaged in the samples.