Post the PDF. Paulo
----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[email protected]> Sent: Thursday, June 15, 2006 2:45 PM Subject: [iText-questions] Filling Pdf Form Problem > Hi, > > I need to create a new PDF from an existing PDF that contains PDF form. I > need to fill the data into the form dynamically. > The code creates a new PDF nicely. but when i open the new file with PDF > reader ( i am using acrobat reader 7.0), i get the following error > > "Wrong type parameter supplied to a PDS procedure." > > After this error the document opens up with filled in data. Now, when i > print the file, PDF reader crashes. > > I am using iText 1.4. > > The code that i am using is:- > > /** > * Fills data into an existing pdf form. > * @param fileToRead The Pdf file to be filled. > * @param fileToWrite The Pdf file to be created. > * @param formData HashMap containing field names and values. > */ > public static void fillPdfForm(String fileToRead,String > fileToWrite,HashMap formData) > { > try > { > PdfReader reader = new PdfReader(fileToRead); > PdfStamper stamp1 = new PdfStamper(reader, > new FileOutputStream(fileToWrite)); > stamp1.setEncryption(true,null,null,PdfWriter.AllowPrinting); > AcroFields form2=stamp1.getAcroFields(); > > HashMap fields = form2.getFields(); > > Set keys = formData.keySet(); > > for(Iterator i > =keys.iterator();i.hasNext();) > { > String key = (String)i.next(); > System.out.println("key =" + key); > if(fields.containsKey(key)) > { > String value = > (String)formData.get(key); > System.out.println("value > =" + value); > form2.setField(key,value,value); > } > } > stamp1.setFormFlattening(true); > stamp1.close(); > } > catch(Exception e) > { > e.printStackTrace(); > } > } > > Regards, > Ravi Mukund Bhatt > Tata Consultancy Services Limited > Mailto: [EMAIL PROTECTED] > Website: http://www.tcs.com > ForwardSourceID:NT0000509A > =====-----=====-----===== > Notice: The information contained in this e-mail > message and/or attachments to it may contain > confidential or privileged information. If you are > not the intended recipient, any dissemination, use, > review, distribution, printing or copying of the > information contained in this e-mail message > and/or attachments to it are strictly prohibited. If > you have received this communication in error, > please notify us by reply e-mail or telephone and > immediately and permanently delete the message > and any attachments. Thank you > > > -------------------------------------------------------------------------------- > -------------------------------------------------------------------------------- > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions > _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
