[Zope] htmltopdf

Christoph Berendes berendes at netalyst.com
Mon Nov 14 10:52:08 EST 2005


Asad Habib wrote:

> Has anyone successfully used htmltopdf, a PHP script written by Jason 
> Rust (www.rustyparts.com) to convert an HTML file to PDF, with Zope? 
> In particular, I wanted to find out if anyone had used the python 
> equivalent of this PHP script.


We've been looking into this recently. Raw notes on various tools and 
links below, first on HTML to pdf/ps, and then on HTML to image 
(jpeg/png) directly, which is ultimately what we need to do.


The main thing is that many of the html to ps/pdf tools don't handle CSS 
well, if at all. The big exception there is shown (with a live demo) at 
http://www.tufat.com/script19.htm. It's fabulous - handles pages from 
csszengarden quite well.

At the moment, we're going with a simpler approach to our problem 
(watermarks), but if we went the HTML to PDF/image route, I'd look at 
the tufat.com script, or the approach noted at the hackdiary.com link.


HTML TO PDF/PS CONVERSION
"html2ps":http://user.it.uu.se/~jan/html2ps.html

"html to pdf in php":http://www.rustyparts.com/pdf.php

"python script for html to pdf 
conversion":http://www.rustyparts.com/scripts/HTML_ToPDF/contrib/html2pdf.py

"html2doc":http://www.easysw.com/htmldoc , a proprietary tool

"denature":http://denature.sourceforge.net/, html to pdf via xsl/fo in Perl

other "html to pdf":http://tinyurl.com/a8u7q tools at Freshmeat

____________
Zope cookbook has a "recipe":http://zopelabs.com/cookbook/1069611008
using (yum-able) "recode":http://www.gnu.org/software/recode/recode.html 
and "html2doc":http://www.htmldoc.org/ aka a "product from 
ESP":http://www.easysw.com/htmldoc/ (under GNU license)

* there's also the apparently very simple
"ZpdfDocument":http://www.zope.org/Members/gaaros/ZpdfDocument



****************

There is a "php version of html2ps":http://www.tufat.com/script19.htm 
which handles background images, e.g. from here 
"http://www.netmechanic.com/news/vol5/HTMLTest_background.htm":http://www.netmechanic.com/news/vol5/HTMLTest_background.htm


HTML TO IMAGE CONVERSION

* "html2jpg":http://freshmeat.net/projects/html2jpg/ "project 
page":http://marginalhacks.com/Hacks/html2jpg/ (requires mozilla)

* "khtml2png":http://directory.fsf.org/webauth/misc/khtml2png.html (not 
maintained) also used 
"here":http://www.michaelhoover.org/work/2004/07/khtml2png.html

* "another python-based 
app":http://www.hackdiary.com/archives/000055.html(may be the most 
promising)"http://www.pygtk.org/":http://www.pygtk.org/

* "webkit2png":http://www.paulhammond.org/webkit2png/


* "Easy capture":http://www.perturb.org/display/entry/728/ for the PHP 
environment (not HTML, just images)

* "HTML/CSS/javascript 
approach":http://www.electropubs.com/watermark_install.htm


* using "PHP and GD":http://www.sitepoint.com/print/watermark-images-php


More information about the Zope mailing list