Pages

Sunday, 24 June 2012

HTML PDF Rendering with itext and flyingsaucer

I want to perform automatic pdf rendering from xml for helping a project I am working on. But I have not completely found out how to do this. It seems that combining flying saucer (which is a HTML renderer for java and iText should do the trick. However, I am not sure how good this will work for new html versions.

I will try to keep this up to date with new development of my experiments.


The first experiment did not work correctly with the following code:

#! /usr/bin/bash

CLASSPATH=

for a in flyingsaucer-R8/*.jar ;
do
CLASSPATH="${CLASSPATH};$a"
done
echo $CLASSPATH
java -cp $CLASSPATH org.xhtmlrenderer.simple.PDFRenderer $@

The code being called in the following way:

./render.sh http://www.google.de pdf