June 08, 2004

Manipulating PDF files in Mac OS X without Adobe

iText - a JAVA-PDF library. I wanted to install this iText java library (not to be confused with Apple's iText tool), in a Mac (OS X 10.2) and was having a heck of a time trying to find in google what was required to get it up and running. In the end, it was so simple, that I wondered why it's wasn't easier to find. Anyhow, all you need to do is install the .jar files in the /Library/Java/Extensions folder and you're set! There are a bunch of examples of what you can do with this iText library found in the site above or at sourceforge. If you ever wanted to merge fdf files with the original pdf file, this is the tool for you. Just download the examples zip file from the sourceforge site and extract the merge_fdf.java file. Once you've copied the iText jar files and placed them into the /Library/Java/Extensions directory, you'll then need to compile the merge_fdf.java file with the command (in the Terminal utility/console):

javac merge_fdf.java

It'll create a merge_fdf.class file that you can you use to merge the fdf and pdf files. Copy a pdf file and fdf file in the same directory as the class file and create the merged pdf like so:

java merge_fdf sample.pdf outputpdf.pdf sample.fdf

Merging fdf files is one useful tool; however, iText is chocked full of useful tools beyond this simple example. I'm sure some of you java pros can probably create a jar program that could be run from the gui desktop or create a front-end for it and the many other utilities from iText. Some of these tools are great tools to integrate into a web application (using PHP or Perl scripts) to generate dynamic PDF files. Lots of potential with it, too bad the typical newbie (like me) has to spend so much time trying to figure simple things out, like how to install the dang library just to start out.

Posted by johnvu at June 8, 2004 03:23 PM
Comments
Post a comment