Apply the License Key
If you haven't get a license key, please check out how to obtain a license key.
ComPDFKit PDF SDK currently supports two authentication methods to verify license keys: online authentication and offline authentication.
Learn about:
What is the authentication mechanism of ComPDFKit's license?
What are the differences between Online Authentication and Offline Authentication?
Accurately obtaining the license key is crucial for the application of the license.
- In the email you received, locate the
XML
file containing the license key. - Copy the License.xml file into the assets directory of your Flutter project.

- Open the pubspec.yaml file of your project and configure the flutter: section to enable the assets directory.

- Initialize the SDK:
dart
// Include the license in Flutter assets and copy to device storage
// Add `license_key_flutter.xml` to your Flutter project’s assets directory;
File licenseFile = await CPDFFileUtil.extractAsset(context, 'assets/license_key_flutter.xml');
ComPDFKit.initWithPath(licenseFile.path);
Alternative methods (optional)
dart
// Android
// Copy the license_key_flutter.xml file into the assets directory of your Android project:
ComPDFKit.initWithPath('assets://license_key_flutter.xml');
// iOS
// Copy the license_key_flutter.xml file into your iOS project directory (or a readable location):
ComPDFKit.initWithPath('license_key_flutter.xml');