Em Fri, 01 Jan 2010 09:11:13 -0200, Inge Solvoll <inge.tapes...@gmail.com> escreveu:

Shouldn't be too hard.

Do this in your page class:

Object afterRender(MarkupWriter writer) {
Document doc = writer.getDocument();
ITextDocument itextDoc = convertT5DocToItext(doc);
return new ITextStreamResponse(itextDoc);
}

What would do the HTML to PDF conversion in this case?
There's one project, Flying Saucer (https://xhtmlrenderer.dev.java.net/), that renders HTML to various formats, including to the screen (as a Swing component) and PDF. It uses iText internally. This article shows how you do it: http://today.java.net/pub/a/today/2007/06/26/generating-pdfs-with-flying-saucer-and-itext.html.

One example technique for making a PDF version of your pages is to subclass your page and only include the afterRender method above. I'm sure there are other (more elegant) ways to do this than the example I made here!

I guess this could be implemented as a mixin.

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, software architect and developer, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to