Adobe PDF Library

Java Sample Programs

Introduction

The Adobe PDF Library (APDFL) is an Application Programming Interface (API) designed to allow programmers to work with the Adobe PDF file format.  The APDFL Software Development Kit (SDK) provides a method for software developers and vendors to build their own third-party systems that allow them to create, change, process, review, and otherwise work with PDF files.  The tools in the library are based on the Adobe Acrobat software but will run independently, so that a copy of Adobe Acrobat does not need to be installed.

Datalogics provides a Java interface to the Adobe PDF Library. This Interface offers a set of modules for the Library that allow programmers working in Java to take advantage of Adobe PDF Library tools and resources. The Java interface encapsulates the original Adobe PDF Library; the interface allows you to work with the original core library functions directly, and seamlessly, in Java.

The Sample Programs

The Adobe PDF Library supports Java and provides a set of sample Java program files.  Executable source code for these samples is provided in the Java/Binaries directory, com.datalogics.PDFL.jar and samples-common.jar. Most of the code samples in APDFL are designed to demonstrate how an API works by completing a simple programming task. You can open the sample Java program files and review them in Eclipse or a similar viewer in a Unix or Mac platform for reference, or you can copy parts of this code to use in your own programs. You can also run the executable file for any sample program from a command line.

For example, you would access this directory, where the sample program files are stored:

C:\APDFL15.0.4\Java\Sample_Source\Text\TextExtract

And look for the program file, such as TextExtract.Java.

We assume a basic level of technical understanding of the PDF file format, though we seek to review the features of each of these sample programs carefully.

Many of these sample programs automatically generate an output file or set of files.  These output files, generally PDF or graphics files (JPG or BMP), are stored in Sample_Source directory. If you run a sample program a second or third time, it will overwrite any output files that were created and stored earlier.  However, if you run a sample program, generate a PDF output file, and then open that PDF file and try to run that sample program again, you will see an error message.  The program will not be able to overwrite an existing output file if that file is currently open in Adobe Reader or Adobe Acrobat.

Note that nearly all of the Java program interfaces (and samples) match the interfaces provided for .NET, and they share the same names. That makes it easy to keep parity; you can write a program using .NET and then create a matching program in Java with little extra effort.