Manually Integrating the PSPDFKit Java Library

This article explains the manual integration of the PSPDFKit for Java Library JAR package. We strongly advise that you integrate using the PSPDFKit Maven repository. If you do, please refer to the main Integrating PSPDFKit Java Library guide for more details. Otherwise, read on.

Please select the build system you are using:

Gradle Build System

If you’re using the Gradle build system, a good example of how to integrate the PSPDFKit Java Library can be seen in the Catalog example distributed in the downloaded ZIP.

Complete the following steps for manual Gradle integration.

  • Create a folder within your project named libs.
  • Download the PSPDFKit Java Library from the Customer Portal
  • In the downloaded ZIP file, there will be a JAR file, pspdfkit-1.3.0.jar. Copy this JAR file into the libs folder you just created.
  • In your project’s build.gradle folder, add a dependency to the copied JAR file (replace the wildcards with the version number):
Copy
1
2
3
4
5
6
7
8
9
dependencies {
    ...
    implementation files('libs/pspdfkit-1.3.0.jar')

    // Required by PSPDFKit.
    implementation 'org.json:json:20180813'
    implementation 'org.apache.httpcomponents:httpclient:4.5.9'
    ...
}

Now your Gradle project will depend upon the PSPDFKit JAR. More information about declaring dependencies can be found in the Gradle documentation.

Maven Build System

To use the PSPDFKit Java Library with Maven, it’s first necessary to install the PSPDFKit JAR to a Maven repository. Only when this is done can it be a reference for a Maven project.

  • Download the PSPDFKit Java Library from the Customer Portal
  • Extract the files from PSPDFKit-Java-binary-1.3.0.zip into a known location.
  • Within your project, using mvn on the command line, add the PSPDFKit JAR to a repository, replacing both the version (where necessary) and the path to the JAR and POM (extracted from PSPDFKit-Java-binary-1.3.0.zip):
1
mvn install:install-file -Dfile=/path/to/jar/pspdfkit-*.*.*.jar -DpomFile=/path/to/pom/pspdfkit-pom.xml

This will install the JAR to a local repository. It is also possible to publish this JAR remotely; please see the Maven guides if this is a requirement.

  • Add the PSPDFKit Java Library as a dependency of your project. In your project’s pom.xml, add the following, replacing the version with the target version:
Copy
1
2
3
4
5
6
7
8
9
...
<dependencies>
    <dependency>
        <groupId>com.pspdfkit.api</groupId>
        <artifactId>pspdfkit</artifactId>
        <version>1.3.0</version>
    </dependency>
</dependencies>
...

Now your Maven project will depend on the PSPDFKit JAR published to the chosen repository.