AW: Using Turbine's tools for assembling PDF output (using FOP): how to?
"Alexander Zimmer" <[email protected]>
| Newsgroups | gmane.comp.jakarta.turbine.user |
|---|---|
| Message-ID | <[email protected]> |
Thank you both for your answers.
Anyway, I just would like to stress that the conversion FO->PDF and the streaming (via a RawScreen-like Screen) is not a problem and is already solved.
What I do not know (yet) is, how I can use Velocity plus all the nice Turbine pull tools for the Velocity template to assemble the FO input, such a template would look just like this (as you can see, a valid FO file, except the VTL sequences, which should be taken care of by Velocity):
<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="simpleA4" page-height="29.7cm" page-width="21cm" margin-top="2cm" margin-bottom="2cm" margin-left="2cm" margin-right="2cm">
<fo:region-body/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simpleA4">
<fo:flow flow-name="xsl-region-body">
<fo:block>Hello World, my name is $!{name}!</fo:block>
#foreach ($entry in $names)
<fo:block>Next name: $entry.Firstname $entry.Lastname</fo:block>
#end
</fo:flow>
</fo:page-sequence>
</fo:root>
How can I use template functionality? The problem involved are:
1. I want to use the Velocity engine and capture its output in a String/ByteArray. The output will be a valid FO file.
2. I want to be able to use all (at least: some) pull tools Turbine provides for screen templates
I think that I've solved the other problems (how to do the streaming, how to convert into PDF, ...).
I try to dive into the VelocityOnlyLayout (as Peter Courcoux pointed out), but if you have additional clues for me, I would be very happy to hear from you!
Cheers,
Alex
-----Ursprüngliche Nachricht-----
Von: Jeffery Painter [mailto:[email protected]]
Gesendet: Freitag, 18. Jänner 2008 15:21
An: Alexander Zimmer
Betreff: Re: Using Turbine's tools for assembling PDF output (using FOP): how to?
I haven't looked at this stuff in quite some time, but I had posted
a PdfScreen that might give you a start on how to do things.
http://kiasoft.com/opensource/PdfScreen.java
I was using it with the iText library back in the day, but I believe your
options are more varied now.
http://www.lowagie.com/iText/
good luck!
--
Jeffery Painter
Knowledge Engineer
Semantic Technologies Group
Statistical and Quantitative Sciences
GlaxoSmithKline Research and Development
http://www4.ncsu.edu/~jlpaint2/
> Hello list,
>
>
>
> I am trying to extend an existing Turbine application by a "Download"
> link which should result in a PDF file being served, containing the same
> data as in the screen template counterpart.
>
>
>
> Take a video database for instance, I can browse through the video
> titles and have a look at specific videos by looking at their
> "Details.vm" screen template which would output detail information.
> Alternatively, I would like to offer a "Download as PDf" link which
> should resemble the screen output, but was assembled via FOP, presenting
> the video details as a sort of "video data sheet".
>
>
>
> With regards to the PDF generation, I am presented with the same
> problems as in the course of the template screen generation:
>
> - using the l10n mechanism
>
> - possibly using other pull tools
>
>
>
> Therefore it would be very reasonable to use these template services in
> a page which does NOT output to the HTTPServlet-request-OutputStream,
> but instead is able to
>
> - set a MIME-Type
>
> - gather the output of the template (in which I can use the
> beloved set of pull tools, e.g. for internationalization), which
> delivers a FO String
>
> - pipe the generated FO String (or Stream) through a FO->PDF
> converter
>
> - stream the PDF byte stream into the servlet output
>
>
>
> How can I achieve this in Turbine? The FO->PDF conversion poses no
> problem (in fact: is already working), but how can I tell Turbine to use
> the template mechanism with all pull tools but capturing the output in
> order to send it into the FO->PDF converter and stream it back?
>
>
>
> I suppose, this has to be a special Page class capable of doing this.
> Could you point me in the right direction?
>
>
>
> TIA,
>
> Alex
>
>