Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » iText »

Re: [iText-questions] Two fields with the same name into different page

Paulo Soares

2005-06-24

Replies:

field2.setPage(2)

----- Original Message -----
From: "wang yun" <yunwangwatlow@(protected)>
To: <itext-questions@(protected)>
Sent: Friday, June 24, 2005 4:35 PM
Subject: [iText-questions] Two fields with the same name into different page


Dear paulo,

I have two text fields with the same name. But, I want
to add the first one into page 1 and
add the second into page 2.

Here is the code to add two fields into one page. How
can I change it so that app2 will be moved into page
2.


Thanks,



PdfReader reader = new PdfReader("input.pdf");
PdfStamper stamp = new PdfStamper(reader, new
FileOutputStream("output.pdf"));
PdfWriter writer = stamp.getWriter();

PdfFormField ff = PdfFormField.createTextField(writer,
false,false,0);
ff.setFieldName("CreditCard");
ff.setValueAsName("Visa");

TextField app1 = new TextField(writer, new
Rectangle(100, 700, 100 + 200, 700 + 20), null);
app1.setText("Visa");
PdfFormField field1 = app1.getTextField();
ff.addKid(field1);

TextField app2 = new TextField(writer, new
Rectangle(100, 650, 100 + 200, 650 + 20), null);
app2.setText("Visa");
PdfFormField field2 = app2.getTextField();
ff.addKid(field2);

stamp.addAnnotation(ff,1);
stamp.close();



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
iText-questions mailing list
iText-questions@(protected)
https://lists.sourceforge.net/lists/listinfo/itext-questions
©2008 junlu.com - Jax Systems, LLC, U.S.A.