- Home

PDF

# PDFBox - How to build PDFBox

- Building PDFBox
- Running/Debugging PDFBox in Eclipse

## Building PDFBox

This page will describe how to build PDFBox. Most users should find the binary releases adequate, but if you are contributing to PDFBox then you will need to know how to properly build the project.

You can obtain the latest source of PDFBox from CVS, see the SourceForge site for information about how to connect to CVS. The below instructions should also work for a released/nightly distribution.

1. Install ANT, PDFBox currently uses 1.6.2 but other versions probably work as well.
2. (Optional)Setup Apache Forrest, Forrest is used for PDFBox documentation but is not required to compile PDFBox.
   1. Install Forrest
   2. In the build.properties, set the forrest.home property

      forrest.home=c:\\javalib\\apache-forrest-0.6\\src\\core

3. (Optional)Place the junit.jar file in the ANT_HOME\lib directory. This is required to run the junit tests but not to compile PDFBox.
4. (Optional)Setup IKVM, if you want to build the .NET DLL version of PDFBox.
   1. IKVM binaries
   2. In the build.properties, set the ikvm.dir property

      ikvm.dir=C:\\javalib\\ikvm-12-07-2004\\ikvm

5. Run 'ant' from the root PDFBox directory. This will create the .zip package distribution. See the build file for other ant targets.

Note
If you want to run PDFBox from an IDE them you will need to add the 'Resources' directory to the project classpath in your IDE.

## Running/Debugging PDFBox in Eclipse

In order to run PDFBox from within eclipse there is a couple things that need to be setup. Certain pieces of functionality require access to the Resources folder. Here is an example of what you need to do to run the ExtractText command line application.

1. In eclise click on "run..." or "debug..."
2. In the tree on the left select "Java Application" and click "New"
3. Name it, select the correct project, and the main class
4. Select the "Arguments" tab and enter the command line arguments to the app
5. Select the "Classpath" tab, the pdfbox project and jars should already be added in the "User Entries"
6. Select the "User Entries" item and click the "Advanced" button
7. The "Add Folder" radio button should be selected, press ok
8. Select the root of the pdfbox project, this will make the "Resources" folder available on the classpath.