Adobe PDF Library

Setting up the Java samples interface to run

The Adobe PDF Library Java samples are distributed together as a Maven project. Maven is an open source software management tool provided by the Apache Software Foundation that can automate the software build process. An XML file provided for each product describes how the software is built, including conventions, dependencies on external software modules, components, and plug-ins, and the build order.  Maven also allows you to generate reports. We provide a utility with the Java Maven project that finds and runs Maven for you, so that you don’t need to install Maven locally if you don’t have it in place already. Under the /Java directory you will see the Maven script file, mvnw.cmd for Windows and mvnw for Linux.

You can import the Adobe PDF Library Java Maven project easily into your local Integrated Development Environment (IDE) tool, like Eclipse or IntelliJ.

Note that a minimum requirement is to have Java Development Kit 7 (JDK 7) installed. The Maven build will also work with Java SE 9.

We describe how to set up your Java interface so that you can run Java samples using Eclipse or IntelliJ. We also describe how to run Java samples from a command line utility.

Install the Maven artifacts

The first step is to add a set of artifacts specific to Adobe PDF Library into the Maven repository on your local machine. In Maven, an artifact is a file that is stored in a repository to be used in a project. The artifacts Datalogics provides include a pair of Adobe PDF Library JAR files for the Java sample files, each one starting with “pdfl” and the software version (such as “pdfl-15.7.37.jar”). One is labeled “Javadoc.” The artifacts also include several zip files that include resources and binary files.

The Maven repository is stored in your Windows user home directory, in a folder called /.m2. Your directory should look something like this:

C:\users\jsmith\.m2\repository

Or

C:\users\hwilliamson\.m2\repository

If you install Maven on your local machine, the installation process will build a repository for you and create an /.m2 Maven repository folder in your user home directory. But you don’t need to install Maven. We provide an installation step that will create the /.m2 folder and the Maven repository for you, if the /.m2 folder is not already in place on your machine.

Set the JAVA_HOME path by entering a set command at a command line prompt:

C:\set JAVA_HOME=C:\Program Files\Java\jdk-9.0.4

Move to the Java directory in your Adobe PDF Library installation package. That will vary depending on where you install the software, and what version you are working with, but the directory will probably look something like this:

C:\Datalogics\APDFL 15.0.4PlusP2z\Java

Find the file folder where the mvnw or mvnw.cmd and create-artifacts.xml files are stored.

Run this command:

mvnw -f create-artifacts.xml install

or this command for Mac or Linux:

./mvnw -f create-artifacts.xml install

If you are using Git Bash, use this command:

cmd "/C mvnw.cmd -f create-artifacts.xml install"

Build the Maven package

Switch to the /Sample_Source directory under the Java directory and run the package command, to package the samples:

Mac/UNIX    ./mvnw package
Windows     mvnw package

The package process in Maven compiles the code related to a project and creates a file for storing it. For Adobe PDF Library, the Maven package is a JAR file. When you run the package command it will create a new directory under Sample_Source called /target, and store the JAR file in that directory structure.  The JAR file will be named to match the release version of the Adobe PDF Library you have installed.  Your Maven package file might be named pdfl-15.7.37.jar.

Set the Environment Variables

These environment variables must be added in your operating system platform:

Windows

set DLE_INSTALL_LOCATION=target\lib
set PATH=..target\lib;%PATH%

UNIX

export DLE_INSTALL_LOCATION=target/lib
export LD_LIBRARY_PATH=..target/lib:$LD_LIBRARY_PATH

Mac

export DLE_INSTALL_LOCATION=target/lib
export DYLD_LIBRARY_PATH=..target/lib:$DYLD_LIBRARY_PATH