Integrating the PSPDFKit Java Library
This guide explains the process of integrating PSPDFKit into your project.
The preferred method of integrating PSPDFKit is via the PSPDFKit Maven repository, which will be the topic of this guide. If you’d prefer to manually integrate the packaged JAR, please refer to the Manually Integrating the PSPDFKit Java Library guide.
Please select the build system you are using:
Integrating with the Gradle Build System
Step 1: Adding PSPDFKit to Your Project
- In your top-level
build.gradle
file, add the PSPDFKit Maven repository:
build.gradle | 1 2 3 4 5 6 7 | allprojects { repositories { maven { url 'https://customers.pspdfkit.com/maven/' } } } |
- In the depending module’s
build.gradle
file, add the PSPDFKit dependency:
myProject/build.gradle | 1 2 3 | dependencies { implementation 'com.pspdfkit:libraries-java:1.3.0' } |
Step 2: Getting the License Key
PSPDFKit is a commercial product and requires a license key during framework initialization. Make sure you have either a demo license or a full license before continuing.
- Requesting a demo license key takes only a few minutes. To get one, visit https://pspdfkit.com/try and follow the steps there.
- If you own a full license of the PSPDFKit Java Library, log in to the PSPDFKit Customer Portal and retrieve your license key from there.
Step 3: Initializing PSPDFKit
Now that the PSPDFKit Java Library is added, you can use the SDK in your application. You will have to call the initialize
method prior to calling any other PSPDFKit method:
1 2 3 | public void initializePSPDFKit() throws PSPDFKitInitializeException { PSPDFKit.initialize("YOUR_LICENSE_KEY_GOES_HERE"); } |
Integrating with the Maven Build System
Step 1: Adding PSPDFKit to Your Project
- In your top-level
pom.xml
file, add the PSPDFKit Maven repository:
pom.xml | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <project ...> ... <repositories> <repository> <id>pspdfkit</id> <name>PSPDFKit Maven</name> <url>https://customers.pspdfkit.com/maven/</url> </repository> </repositories> ... </project> |
- In the depending module’s
pom.xml
file, add the PSPDFKit dependency:
myProject/pom.xml | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <project ...> ... <dependencies> <dependency> <groupId>com.pspdfkit</groupId> <artifactId>libraries-java</artifactId> <version>1.3.0</version> </dependency> </dependencies> ... </project> |
Step 2: License Key and Initialization
Now you can follow the steps from the Gradle build system, beginning with Step 2.
For more examples on how to use the SDK, please refer to both the Catalog example in PSPDFKit-Java-binary-*.*.*.zip
and the API documentation.