Prince: XML + CSS = PDF

By Deane Barker on November 28, 2005

Prince: Overview: There’s a big gap in getting Web content into print.

I’ve had to cross the gap a couple times, and I’ve both generated PDFs server-side and used CSS to style HTML into printable format. Both methods suck.

Prince is a system that lets you take XML, style it with CSS, and then generate a PDF. It’s very good — I’ve seen demos, and their site is full of them. Look at the image with this post — that’s HTML converted to PDF, unattended.

But it’s still expensive — $3,800 for a server license? Ouch.

Prince is a computer program that converts XML into PDF documents. Prince can read many XML formats, including XHTML and SVG. Prince formats documents according to style sheets written in CSS.

What are the free alternatives? It’s a pretty bare field. There’s XML:FO, but I never had much luck with that (and I detest XSL, which doesn’t help). Recently, I was impressed with FPDF, which is a PHP class that will generate simple PDFs from HTML.

Via A List Apart which has a whole article on the problem.

What This Links To
What Links Here


  1. I am working on a project where we have letter templates in XSL:FO and merge the data using StringTemplate. We then render the resulting XSL:FO to PDF using XF Rendering Server 2005, which is a little more affordable at $995.

    I think it works pretty well. Creating the XSL:FO templates can be a bit tedious, but a companion product called XF Designer is available along with XF Rendering Server 2005.

  2. Actually, there is another solution, which is not that bad:

    The problem with html to pdf is not necessarily the actual conversion, but the layout of the pdf. For example, reading a pdf document formatted in landscape with multi-column view is not reader-friendly for the web. Or for example, producing a bibliography, or an index that is dynamic. The author of wikipublisher is on the right track.

Comments are closed. If you have something you really want to say, tweet @gadgetopia.