Caron van Schalkwyk wrote:

Hi,

Our J2EE application needs to generate pdf invoices.
The idea is to have some sort of HTML template with placeholders.
The placeholders need to be populated from a database.
The user can either view the merged document in HTML or pdf version.

I have read the XML chapter in the tutorial. Unfortunately I am limited
to using an HTML template provided by our client.

Could you please let me know if this is possible using iText.  If so,
could you please list the objects I should be looking at.

First of all: the HTML needs to be XHTML, otherwise you
will encounter parsing errors.
Secondly: you need to agree on the tags that will be used,
for the layout as well as for the placeholders.
Then you can start writing your SAX Handler.

For instance: at Ghent University, we make diploma supplements
where the source looks somewhat like this:
<div class="clausule1"><student /> has received his diploma on <date /></div>
The handler maps a div with a Paragraph,
looks in the database is clausule1 applies for the student,
replaces the student and date tag with data from the database.

Before you ask: this is a closed source example.
I can't send it to you. You should experiment with
a SAX parser and handler yourself.
br,
Bruno


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to