FOP – xml -> PDF

I’m working on a site for a client that had strict requirements of XHTML only (no server side). I implemented this with a simple XML file trasnformed with XSLT through some simple C# glue to churn out the site. It turns out this was a lucky dicision, since the client also wanted a PDF of the site that people could print out.

Enter FOP http://xmlgraphics.apache.org/fop/index.html

A totally kick ass, works right out of the zip file, java app that takes fo-xml and creates a PDF. It allows complete desktop publishing control (margins, fonts, graphics, etc). Took me about 20 minutes to whip up anothe XSLT sheet and turn my XML into a 55 page PDF. Great tool if you need to do stuff like this.

Also comes with a simple Servlet if you’re looking for a server solution. You could, of course, also wrap the jar in J# and and do this in .Net if you were so heretically inclined.

2 Comments

matt wApril 25th, 2006 at 7:04 am

Nice. We’re still using the rather antiquated #FDF method of generating PDFs. This looks like a much better solution.

BenApril 25th, 2006 at 9:15 am

I’ve used FOP a lot for docbook -> PDF. My toolchain is Docbook XML -> xlstproc -> FOP (command line).