velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "bluejoe" <bluejoe2...@gmail.com>
Subject Re: Can velocity be used for generating reports in PDF
Date Fri, 17 Oct 2008 02:22:05 GMT
I know less about iText, and i am not sure if iText supports PDF creation based on PDF template.
If someone has developed a WriterAdapter for iText, i think it will be welcome:)

bluejoe

----- Original Message ----- 
From: <Peter_Ford@blm.gov>
To: "Velocity Users List" <user@velocity.apache.org>
Sent: Friday, October 17, 2008 5:09 AM
Subject: Re: Can velocity be used for generating reports in PDF


> The problem is that the Velocity Engine pushes its output to a Writer (an
> argument to the mergeTemplate() method) but iText doesn't include a Writer
> class that can be used for the purpose - creating a PDF in iText means
> creating a Document object then calling methods of that class to add
> "chunk" objects, each of which contains the text along with the font/style
> settings that apply to that text. So the Writer class I developed was a
> bridge between the Writer interface that Velocity needs, and the call-based
> interface that iText uses.
> 
> As I mentioned this was a while ago. It's possible that by now the
> developers of iText have added a Writer interface that would make things
> simpler, and it's also possible that there's a third-party package to do
> this. Also bear in mind that iText isn't the only PDF generation package
> (the page you linked mentions several) and it's possible that one these has
> a Writer that will work with Velocity.
> 
> Adrian Tarau <adrian.tarau@gmail.com> wrote on 10/16/2008 02:54:48 PM:
> 
>> Why not using iText directly (or some other library) to generate PDF?
>> Using Velocity to generate PDF is not a good way to go...
>>
>> http://java-source.net/open-source/pdf-libraries
>>
>>
>> Peter_Ford@blm.gov wrote:
>> > The way I did this was to have my Velocity templates generate output
> text
>> > that was sent to a PDFWriter class that I wrote. This class detected
>> > special markers in the input stream that indicated new paragraphs,
>> > bold/underline/italic sections, font changes, images etc., and made
> calls
>> > to iText to create the "chunks" that iText uses and add them to the PDF
>> > output document on the fly. It could handle basic stuff (paragraph
> styles,
>> > multiple fonts, tables, background colours and images, embedded images)
> and
>> > was adequate for what I needed it for. It couldn't handle more advanced
>> > stuff like floating sidebars, but that wasn't something I needed.
>> >
>> > That was a while ago. If I was going to do the same thing again I'd
> have
>> > the Velocity templates produce XML and base the Writer on
> Commons-Digester.
>> >
>> > It's always possible that there is a direct PDF Writer class out there
>> > already that accepts input text in some handy form like XML - I just
> did a
>> > quick Google and didn't find anything, but it's such an obvious thing
> I'd
>> > be surprised if there isn't *something*.
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> > For additional commands, e-mail: user-help@velocity.apache.org
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: user-help@velocity.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
Mime
View raw message