On Thu, 07 Oct 2004 20:32, Ryan Lea wrote: > Hi, > > Have just read on another thread that velocity has been used to produce > custome PDF's. I had been thinking of using something like cocoon and > xslt. > > Sooo .... was just wondering how many people have used velocity to > create PDF's and probably more to the point, how?
We have used Velocity to create both PDF's and OpenOffice documents. In fact the same template now creates both HTML and PDF. The template defines the structure but not the layout. The first stage our system goes through is rendering XML from the template through velocity. This process imbeds the data into the template. The second stage is a XSLT transform depending on the target format. If the required result is HTML the XML is moved directly into HTML using our HTML Transform. If the target format is PDF we have a XSLT transform which turns it into an intermediate XML. This is then put through a final third transform to create XSL:FO - Formatting Objects. We then use a open source FO Engine to render the XSL:FO into a PDF. We also have a more simple approach which will mean you have to write special XML format in order to create PDF's - essentially we drop the intermediate few stages and go directly to the final two transforms before rendering. There are also different ways of handling the output. The simple way is that it is output from a servlet - the user just gets the PDF. However, in our line of work we often need to also store the document. We have other utilities which can generate the document, save it in a database, and also return it to the user. We also generate multiple documents all in the same request - although we obviously don't open them for the user all at the same time. What even better - we will be making all of this open source. I'm thinking about dropping it into velocity tools - although what we have now would be much more than just velocity tools. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
