Skip to main content
Version: Version 1.7

Get started with Java

This guide walks you through the steps to use a sample project, and then explains how to integrate the Pdftools SDK into your application with the Java programming language.


The Pdftools SDK for Java requires Java version 8 or higher.

Getting started with a sample project

Learn how to use the Pdftools SDK using a Java sample project and convert a PDF file to an image.

Compile and run the sample

  1. Download a sample project, and then unzip the file.

  2. From the unzipped file, import the .project file into the Eclipse IDE. The source file is compiled automatically.

  3. Right-click the java file, and then select > Run As > Run configurations....

  4. Create a new configuration for a Java Application, and then add the required arguments, for example:

    PdfPrimerWhitepaper.pdf OutputPdfPrimerWhitePaper.tiff

You can apply a similar procedure as described in this tutorial for other code samples. For more information, see Code samples page.

Integrate the SDK into your application

Integrate and initialize the Pdftools SDK into your application by following the instructions in the next sections.

Add the SDK to your project

The Pdftools SDK for Java is available on Maven. To add the Pdftools SDK for Java to your project, select your operating system and system architecture and add the following to your pom.xml:


Load the SDK

The Pdftools SDK for Java requires you to load the underlying native binary files suitable for your operating system and system architecture at runtime.

There are two ways how to load the Pdftools SDK for Java with Maven:

  1. If you are consuming Java libraries directly from the local Maven repository, load the native binary files using the following code:

    System.load(System.getProperty("user.home") + "/.m2/repository/com/pdftools/pdftools-sdk/1.4.0/");
  2. Alternatively, use the system library path:

    1. Add the Pdftools SDK lib directory to the system library path.

      • Windows: Environment variable PATH
      • Linux and macOS: Defined by LD_LIBRARY_PATH
      • Or specify the path using the VM arg -Djava.library.path=.
    2. Load the library using:


Note the difference between:

  • System.load(..): Loads the library from an absolute file path.
  • System.loadLibrary(..): Load the library from the system's library path.

If you are shipping your application, ensure to ship it with the native binary files. Note that you must load the native binary files from the file system and cannot load them from within a jar file or other bundle.

Initialize the SDK

After loading the native binary files the final step before using the SDK is to initialize it with your license key. Substitute the <PDFSDK,V1,include-your-key-here> in the following method with the value of your license key:


Without a valid license key the output files are watermarked. Get in touch with the Pdftools sales team through the Contact page to get a full license.

Implement your use case

  • Find more use cases and sample projects at the Code samples page.
  • For more technical information about the Pdftools SDK for Java, consult the Java technical notes.