Bruno,

I went through your sample but I am not able to get things to work.

Basically the requirement is. In jsp app open the pdf document and set the
value of the text field. Change it to read only. And write the resultant
document on the http response stream.

Here is what I have done.

1) Went into Acrobat 7 and added a text field to the document (using Tools
-> Advanced Editing->Text Field Tool) and saved this file as test.pdf. the
name of the field is "text1".

2) Now in my jsp application, created a  PdfReader object and opened
test.pdf

3) on the reader I called getAcroFields() and then called setField 

Now after setting the field how do I write the resulting pdf document with
newly created values on the http response stream?

Also, is my method of creating the AcroForm correct? (In the Acrobat 7 tool
it always was taking me to the LiveCycle designer).

Thanks for your help.

Regards,
Abhishek.

-----Original Message-----
From: bruno [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 09, 2006 3:19 PM
To: itext-questions@lists.sourceforge.net; [EMAIL PROTECTED]
Subject: Re: [iText-questions] [NewBie] Feature equivalent of MS Word
Bookmarks

Abhishek Srivastava wrote:

> Hello All,
>
> In MS word we can define a template with bookmarks. When the word 
> document is opened, I can just search for the bookmark and assign some 
> text against the bookmark.
>
> This makes generating documents pretty easy as I don't have to write 
> pixel based insertion of text and images. I can just locate the 
> bookmark and assign a value to it.
>
> Was just wondering can this be done in PDF and iText, create a PDF 
> template with these place holders, then just open the pdf document 
> using itext search for these bookmarks and assign them values and then 
> save the document.
>
> Currently I am writing text in pixel mode, but its very complex 
> because I have to adjust the starting postion based on the length of 
> the string and size of the font.
>
Excuse me if you get this answer twice, I am working through an
enormous backlog of mail.

If you create a PDF with an AcroForm.
You can have text fields.
These field can be filled with String values very easy.
There's an example here:
http://article.gmane.org/gmane.comp.java.lib.itext.general/20066/match=setfi
eld
In the example, I even 'flatten' a field.

If you want the font size to adjust automatically so that
iText adjusts the text to fit into the field, define a text field
with font size zero.

If you want place holders for images, please take a look
at the example in this post:
http://article.gmane.org/gmane.comp.java.lib.itext.general/20873

br,
Bruno



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to