Monday, January 11, 2010

Getting started with XSL-FO

It seems these days that a lot of people are trying to find a shortcut to a classical dilemma: How do I convert XML to PDF?
To many, the solution is to convert XML to HTML using a stylesheet, and then use some free tool to generate PDF. Which, although is sounds easy, it is also pretty silly, as I came to discover a while ago when a customer asked for a footnote to be attached to a chart in a page.
Footnotes don't have a HTML equivalent - you can implement something that may look like a footnote, but because a footnote must follow proximity rules (stay on the same page as the content it annotates) you cannot implement reliable footnotes using HTML.
This, and the absence of page numbers and page layouts in general made me look for another way to convert XML to PDF.
It turned out that the stylesheet that I was using can be adapted easily to generate XSL-FO (or FO).
FO stands for Formatting Objects; it's an XML language, which in addition to being able to create documents which contain tables, paragraphs and images, it also contains pagination related tags.

I use Ecrion's XML to PDF software because it has a pretty decent designer and it's the fastest XML to PDF engine that uses open standards that I know of.

No comments:

Post a Comment