Thanks...
Now I want to implement the requirement in same manner. I can create XML
myself corresponding to PDF template .
In your mail I couldn't understand "Ghent University gives me a PDF with
the background of the letter", whether this is PDF file like I sent in
earlier mail?
I gone through SAXmyHandler , SAXiTextHandler javadoc and Events.java
source but I couldn't understand much how I can use these classes
SAXmyHandler , SAXiTextHandler etc. for my requirement.

Could you please take some time send me some pseudo code for how to
generate PDF file if I have PDF template (see attachment) and one XML
file as you said ( you can give me idea how to create XML template for
given PDF template)?

Thanks
Shailesh

-----Original Message-----
From: Bruno Lowagie [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 13, 2006 5:29 PM
To: Shailesh Raj (WT01 - HLS)
Cc: itext-questions@lists.sourceforge.net
Subject: Re: [iText-questions] Replacing placeholder value in PDF

[EMAIL PROTECTED] wrote:

>Thanks for you patience in answering me :) I wanted your input 
>regarding designing  my requirement. In application, on which I 
>working, there would be lot of email template and which will be 
>generated and sent by client for whom we are working (one I sent u in 
>attachment). I am thinking to ask client to send the email in template 
>in form of AcroForm. Then I can use iTEXT to populate the fields using 
>iText.
>This would be better approach?
>
>Here in template few fields will be repetitive (in some cases we have 
>to show 2 or more Principal Investigator) like Principal Investigator 
>(see
>attachment) so can I insert(copy) portion of text in AcroForm through 
>iText?
>
I don't know if I understand the question well enough to give a good
answer.

Let me rephrase it:

If your customer gives you a form like the one you attached to your mail
and instead of placeholders marked with < > he has added form fields,
then you can fill these exact form fields (exact coordinates) with
content.
In this case the original PDF acts as a template.

If your customer gives you a form like the one you attached to your mail
and says: this is an example (NOT a template) and you have to have one
line with the date, one OR MORE blocks with principal investigator and
the TEXT OF EXEMPTION CATEGORY SELECTED BY CHAIR can be a variable
number of lines, then any PDF they send you is worthless. It can't be
used to compose a new PDF file.

As I already explained I have plenty of projects where I solved this
problem using XML. For instance: the student administration of Ghent
University gives me a PDF with the background of the letter, containing
a header and a footer. They also give me a template in XML. In this XML
there are different clauses.
I read the background letter in an onOpenDocument event, add the
background to each page in an onStartPage event and then I loop over the
database.
For every student I parse the XML file. I replace the <student_name />
and <student_address /> tag with the correct address. When I encounter a
processing instruction wiht <?years_of_study academic_year="2005" ?> I
add a list with one or more study programmes and I select the clauses
that apply for each specific student. Sometimes only one clause applies,
sometimes different clauses apply, causing the layout to differ from
student to student.

I think this is the solution you need. Before you ask: the code I am
writing for Ghent University is closed source.
br,
Bruno

Attachment: EXEMPTIONGRANTED.pdf
Description: EXEMPTIONGRANTED.pdf

Reply via email to