Hello Bruno,

Please ignore my prevous mail.

In a console application, I am able to see Fields Text1, Text2 so the way I 
have created the PDF is correct and I am able to see Text1 and Text2 through 
iText!

So now the only problem is to write the stamper to the HttpResponse.

PdfReader reader = new PdfReader("c:\test.pdf");
PdfStamper stamper = new PdfStamper(reader, response.getOutputStream());

stamper.getAcroFields().setField("Text1", "Abhishek1 ");
stamper.getAcroFields().setField("Text2", "Abhishek2 ");
Response.End();

When I run the above line of code I don't see anything in my browser.

Regards,
Abhishek.

-----Original Message-----
From: bruno [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 23, 2006 6:47 PM
To: Abhishek Srivastava
Cc: itext-questions@lists.sourceforge.net
Subject: Re: [iText-questions] [NewBie] Feature equivalent of MS Word Bookmarks

Abhishek Srivastava wrote:

>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
>  
>
Try it in a standalone application first.

>3) on the reader I called getAcroFields() and then called setField 
>  
>
Where is the Stamper? You need a Stamper instance too.
Ask the Stamper for the AcroFields and list the fields and field names 
first.
That way you will know for sure if you created the form correctly.

>Now after setting the field how do I write the resulting pdf document with
>newly created values on the http response stream?
>  
>
When creating the Stamper, you need to pass an OutputStream.
You could use a ServletOutputStream, but there are some browser
issues, please read: http://itextdocs.lowagie.com/tutorial/general/webapp/

>Also, is my method of creating the AcroForm correct? (In the Acrobat 7 tool it 
>always was taking me to the LiveCycle designer).
>
I am 99% sure you are creating the TextField correctly.
I think you have an option in LiveCycle Designer to create
Acrobat 6 forms, but doing it the way you did is less confusing.
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&kid0709&bid&3057&dat1642
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to