hi Tony Gallo, Thank you so much for the response, few queries below
1. i dont have adove acrobat 2. The PDFs are generated by another application, so i cannot do the setField stuff 3. i am not sure whether this point will be of any help, but the PDF's from which i am trying to read, are written from a template. I mean there is PDF tempalte available, the first application populated the Data into those PDFs and forwards them to my application(second). In my application i have to verify the data populated in the PDF is correct or not. My peice of code works properly in case the purple strip / balloon with the message comes up saying "Please fill out the following form. You cannot save data ......". The problem is only with PDF's which dont have the purple strip / balloon. Hope i am clear my about the problem i am facing. Do let me know in case any additional details are required. -Regards Funny 2010/1/5 <itext-questions-requ...@lists.sourceforge.net> > Send iText-questions mailing list submissions to > itext-questions@lists.sourceforge.net > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/itext-questions > or, via email, send a message with subject or body 'help' to > itext-questions-requ...@lists.sourceforge.net > > You can reach the person managing the list at > itext-questions-ow...@lists.sourceforge.net > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of iText-questions digest..." > > Today's Topics: > > 1. Problem Reading Interactive Form Values / Acro Fields from > PDF using iText (Phani Kumar Reddy Pamulapati) > 2. Re: Problem Reading Interactive Form Values / AcroFields from > PDF using iText (Tony Gallo) > 3. Encrypting and editing with PdfStamper (Lloyd) > > > ---------- Forwarded message ---------- > From: Phani Kumar Reddy Pamulapati <phanikumarredd...@gmail.com> > To: itext-questions@lists.sourceforge.net > Date: Tue, 5 Jan 2010 16:43:52 -0500 > Subject: [iText-questions] Problem Reading Interactive Form Values / Acro > Fields from PDF using iText > hi, > > i am having a problem reading the interactive field values from PDF, it > works with some and doesnt work with others. > > PDF's which have "Please fill out the following form. You cannot save data > typed into this form. Please print your completed form if you would like a > copy for your records." are working properly, but the PDF's which do not > have the same information return null. > > The PDF's are generated using iText jar. I am not sure what is the problem. > Any help would be greatly appreaciated. Below is the code i am using in main > method > > > PdfReader reader = *new* PdfReader("Test2.pdf"); FileOutputStream fos = * > new* FileOutputStream"Test3.pdf"); PdfStamper stamper = > *new*PdfStamper(reader, fos); AcroFields form1 = stamper.getAcroFields(); > System.out.println(form1.getField("FirstName")); stamper.close(); > reader.close(); fos.close(); > > > > > -Regards > Funny > > > ---------- Forwarded message ---------- > From: "Tony Gallo" <tga...@inforealtime.com> > To: "'Post all your questions about iText here'" < > itext-questions@lists.sourceforge.net> > Date: Tue, 5 Jan 2010 17:36:47 -0500 > Subject: Re: [iText-questions] Problem Reading Interactive Form Values / > AcroFields from PDF using iText > > Perhaps the fields are not created properly in the PDF. Check it with Adobe > Acrobat. > > > > I don’t understand why you use the following line. > > System.out.println(form1.getField("FirstName")); > > Substitute the fields and then print entire PDF. > > > > All of the other lines look correct. Try replacing the line with the > following two lines. > > form1.SetField(“FirstName”, “funny”); > > stamper.FormFlattening = true; > > > > Note: my syntax may be in error, but the idea is correct. My experience is > with the C#.NET implementation of iTextSharp. The following is working code. > Hope it helps and you can translate between C#.NET and java.. > > > > Tony > > > > private void btnDan_Click(object sender, EventArgs e) > > { > > string sFileTemplate = "c:\\temp\\tonytest.pdf"; > > string sFileToUser = "c:\\temp\\99TG01-20081225-S.pdf"; > > > > string sDateStamp = "18 January 2009"; > > > > try > > { > > DateTime t = DateTime.Now; > > string sPrintText = t.Day.ToString() + " " + > t.ToString("MMMM") + " " + t.Year.ToString(); > > > > System.IO.FileStream fileStream = > System.IO.File.Open(sFileToUser, System.IO.FileMode.Create); > > > > PdfReader reader = new PdfReader(sFileTemplate); > > PdfStamper stamper = new PdfStamper(reader, fileStream); > > > > AcroFields form = stamper.AcroFields; > > foreach (DictionaryEntry de in reader.AcroFields.Fields) > > { > > string sAcroFieldName = de.Key.ToString(); > > > > if (sAcroFieldName.StartsWith("mfg")) > > { > > form.SetField(sAcroFieldName, sDateStamp); > > } > > else if (sAcroFieldName.StartsWith("prn")) > > { > > form.SetField(sAcroFieldName, sPrintText); > > } > > } > > stamper.FormFlattening = true; > > stamper.Close(); > > reader.Close(); > > } > > catch (Exception ex) > > { > > MessageBox.Show("Problem setting AcroFields in PDF, error = > " + ex.Message); > > } > > } > ------------------------------ > > *From:* Phani Kumar Reddy Pamulapati [mailto:phanikumarredd...@gmail.com] > *Sent:* Tuesday, January 05, 2010 4:44 PM > *To:* itext-questions@lists.sourceforge.net > *Subject:* [iText-questions] Problem Reading Interactive Form Values / > AcroFields from PDF using iText > > > > hi, > > > i am having a problem reading the interactive field values from PDF, it > works with some and doesnt work with others. > > PDF's which have "Please fill out the following form. You cannot save data > typed into this form. Please print your completed form if you would like a > copy for your records." are working properly, but the PDF's which do not > have the same information return null. > > The PDF's are generated using iText jar. I am not sure what is the problem. > Any help would be greatly appreaciated. Below is the code i am using in main > method > > PdfReader reader = *new* PdfReader("Test2.pdf"); FileOutputStream fos = * > new* FileOutputStream"Test3.pdf"); PdfStamper stamper = > *new*PdfStamper(reader, fos); AcroFields form1 = stamper.getAcroFields(); > System.out.println(form1.getField("FirstName")); stamper.close(); > reader.close(); fos.close(); > > > > > > > > -Regards > Funny > > > ---------- Forwarded message ---------- > From: Lloyd <lloydgold2...@gmail.com> > To: itext-questions@lists.sourceforge.net > Date: Tue, 5 Jan 2010 20:33:17 -0800 (PST) > Subject: [iText-questions] Encrypting and editing with PdfStamper > > I'm modifying an existing PDF, setting the encryption, and adding fields. > After spending over an hour debugging why when I set the encryption the > fields would disappear, I realized it's because the permissions I'm setting > on the PDF doesn't allow the modification of annotations. What I don't > understand is how setting the encryption level would effect it since it's > in > the same PdfStamper "instance". First of all, I'm setting the encryption > right before adding the fields so PdfStamper should know I have have > permissions to add it, even though the encryption says otherwise. > > Is there a way for me to add fields AND set the encryption where other > users > cannot modify the annotations AFTER I've saved the PDF without the owner > password? It looks like I'm going to have to save the PDF without > encryption, then initialize a new PdfReader and PdfStamper just to set the > encryption afterwards. Is there a reason for this? > > Thanks in advanced, > Lloyd > -- > View this message in context: > http://old.nabble.com/Encrypting-and-editing-with-PdfStamper-tp27026774p27026774.html > Sent from the iText - General mailing list archive at Nabble.com. > > > > > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and > easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > _______________________________________________ > iText-questions mailing list > iText-questions@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/itext-questions > > -- -Regards Funny
------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/