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 ComPDFKitConversion::LibraryManager.license_verify before initializing the SDK and starting conversions.
ruby
require "compdfkit_conversion"
license = "LICENSE_KEY"
device_id = "DEVICE_ID"
app_id = "com.example.application"
code = ComPDFKitConversion::LibraryManager.license_verify(license, device_id, app_id)
unless code == ComPDFKitConversion::ErrorCode::SUCCESS
raise "license verification failed: #{code}"
end
ComPDFKitConversion::LibraryManager.initialize_sdkYou can also read the license information from environment variables in command-line tools:
ruby
license = ENV.fetch("COMPDFKIT_LICENSE")
device_id = ENV.fetch("COMPDFKIT_DEVICE_ID", "")
app_id = ENV.fetch("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 the local demo values packaged in the samples.