Add license keys
The Apryse library is automatically initialized if you have added a valid license key to your project's AndroidManifest.xml file. Alternatively, you can add the key by manually calling the static initialization methods. Before moving forward, please make sure you have added the Apryse libraries to your project.
Auto-initialize by adding a license key in AndroidManifest.xml
Find your
gradle.propertiesfile in the root folder of your project and add your license key:
PDFTRON_LICENSE_KEY=INSERT_COMMERCIAL_LICENSE_KEY_HERE_AFTER_PURCHASEThen in your module's
build.gradlefile (usually located atapp/build.gradle) add:
android {
defaultConfig {
// ...
manifestPlaceholders = [pdftronLicenseKey:PDFTRON_LICENSE_KEY]
}
}Add a placeholder for the license key to your project's
AndroidManifest.xmlfile, inside the<application>tag:This tag will inject a build variable containing your license key into the manifest file.Next try opening a document in an activity.
Disable auto-initialization
It's also possible to disable auto-initialization altogether by adding the following to the <application> tag in your project's AndroidManifest.xml file:
Manually initialize by adding a license key directly in your code
Depending on the package you are using, you will need to call different initialization methods. In your main application's or main activity's onCreate method (and before setContentView in your activity) call one of the following:
**Tools package:**If you are using
com.pdftron:toolsdependency (i.e. usingimplementation "com.pdftron:tools:11.0.0"in yourapp/build.gradlefile):
**Apryse package:**If your application requires greater flexibility and you are using classes in the Apryse package directly, you can initialize using the following method instead:If you are also using a the Tools library (i.e.
com.pdftron:tools) call:Please note that if you usePDFNet.initialize, you will have to set up the Apryse library manually (for more information see the Apryse class documentation).
Next try opening a document in an activity.
Last updated
Was this helpful?