You must use PdfWriter to import the original page and then place the fields.
There's no way to place the fields directly in an existing document in the same way as it is done in PdfStamper for annotations.
 
Best Regards,
Paulo Soares


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nicholas Sutanto
Sent: Friday, June 25, 2004 9:15 PM
To: [EMAIL PROTECTED]
Subject: [iText-questions] Inserting Field in existing PDF file

 Hi,

I'm trying to make a new field.
What I'm doing right now is I make a new document and insert the field to the new document.
So let say I have input.pdf file which contains the original file and result.pdf which contain only the new fields. So how do I concantenate them? Is it the right way to insert the field?

Below are sample of my code.
     Document document = new Document();
      FileOutputStream file_result = new FileOutputStream("result.pdf");  
      PdfWriter writer = PdfWriter.getInstance(document, file_result);
      document.open();
      TextField field1 = new TextField(writer, new Rectangle(50, 760, 50 + 100, 760+50), "Value1");     
      PdfFormField fieldt1 = field1.getTextField();
      writer.addAnnotation(fieldt1);
      document.close();
      writer.close();
     

Then what should I do next? Is this the right step?

Thanks.
Nicholas.

Reply via email to