I found http://code.google.com/p/flying-saucer/
which should be the most suitable solution for my project. But the documents only seem to be able to read from file.
But I my case I want to render from code and I don't want to save a temporary XML file. For example renderToImageAutoSize
in Graphics2DRenderer
static java.awt.image.BufferedImage renderToImageAutoSize(java.lang.String url, int width, int bufferedImageType) A static utility method to automatically create an image from a document, where height is determined based on document content.
Is there any way to let the renderer read directly from HTML code in memory?
Graphics2DRenderer
is not a utility class. You should create a new instance of it.See http://today.java.net/pub/a/today/2006/10/31/combine-facelets-and-flying-saucer-renderer.html#xhtml-to-image-conversion