Then lock the fields instead of flattening them... The results you are getting are 100% correct based on flattened vs. non-flattened.
Leonard -----Original Message----- From: Mark Bryan Yu [mailto:[email protected]] Sent: Tuesday, March 16, 2010 6:33 PM To: Post all your questions about iText here Subject: Re: [iText-questions] PDF form tab order I can't do that... the output pdf shouldn't be editable. Leonard Rosenthol wrote: > Don't flatten. > > -----Original Message----- > From: Mark Bryan Yu [mailto:[email protected]] > Sent: Tuesday, March 16, 2010 4:31 PM > To: [email protected] > Subject: [iText-questions] PDF form tab order > > Hi, > > I have a PDF form with the correct tab order if I fill it up using adobe > reader, correct tab order means when I save it as "Text (Accessible) > *.txt", the generated text would be in order, question 1 then answer 1, > question 2 then answer 2, and so on and so forth. > > But when I use iText to fill up the form field, the output PDF would > have the order wrong. Opening it with adobe reader and saving it as Text > Accessible would generate a text file with the order > > question 1 > question 2 > question 3 > answer 1 > answer 2 > answer 3 > > Any idea how to fix this? > > Here's my code: > > InputStream ffrStream = new FileInputStream("ffr.pdf"); > > PdfStamper writer = new PdfStamper(new PdfReader(ffrStream), new > FileOutputStream("ffr-filled.pdf")); > > AcroFields acroFields = writer.getAcroFields(); > > acroFields.setField("field1", answer1"); > acroFields.setField("field2", "answer2"); > > writer.setFormFlattening(true); > writer.close(); > > ______________________________________________________________________ > This e-mail has been scanned by MCI Managed Email Content Service, using > Skeptic(tm) technology powered by MessageLabs. > ______________________________________________________________________ > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > iText-questions mailing list > [email protected] > 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/ > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > iText-questions mailing list > [email protected] > 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/ > > ______________________________________________________________________ > This e-mail has been scanned by MCI Managed Email Content Service, using > Skeptic(tm) technology powered by MessageLabs. > ______________________________________________________________________ > ______________________________________________________________________ This e-mail has been scanned by MCI Managed Email Content Service, using Skeptic(tm) technology powered by MessageLabs. ______________________________________________________________________ ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ iText-questions mailing list [email protected] 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/ ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ iText-questions mailing list [email protected] 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/
