[Templates] Pretty Printing

Josh Rosenbaum josh@infogears.com
Fri, 02 Jun 2006 09:57:13 -0600


Stuart Johnston wrote:
> Bill Moseley wrote:
>> A bit off topic, but what methods are people using to get nicely
>> printed output?
> 
> LaTeX (see yesterday's thread)
> XSL-FO (Apache FOP (Java))
> PDF::ReportWriter (particular good for invoices and similar reports)
> PDF::API2

Hi Bill,

In addition to this list by Stuart, HTMLDoc is pretty slick to use. It allows you to convert HTML 3.2/4.0 to PDF, so you can create whatever HTML you want, and then use HTMLDoc to make a PDF. It probably doesn't give you as clean of a PDF as the others, but it sure as heck is easy. (It's probably more resource intensive as well.) Writing HTML is a lot easier than dealing with LaTeX and its quirks. (Yes, we use that, but also HTMLDoc for some things. These days I would try HTMLDoc first, since it is so much easier to use.) Just create a TT filter to do the work, and call it good.

http://www.htmldoc.org/

There is an example PDF-o-matic page too that you can do a quick test on. Input a page url and it will spit out a PDF.
http://www.easysw.com/htmldoc/examples.php

It doesn't support all HTML stuff, but is good enough for most things. CSS support does not exist in the stable 1.8.x series, but is being added in the 1.9.x version I believe. However, I wouldn't count on that coming out for a while since development seems to have halted to a snail's pace. Also, if using utf-8 you may need to change encoding into cp1252 or iso-8859-1 since utf-8 isn't supported in the 1.8.x series. (No big deal, though, since the Perl Encode module makes it easy.)

-- Josh