Mark It may be worth contacting the guys at 360works dot com as they have a plug in we use in Filemaker, based I think on some Groovy, which can do this. I spoke to one of the head guys at a recent conference in New York and they are using an older version of iText, presumably because of licensing, but he thinks that they patched one of the libraries to give the 'correct' order of fields from the PDF. At least when I use the plug in to extract field names in working files I use it gives me the order I expect rather than the seemingly random order the library gives.
Maybe you can get them to share the knowledge... john renfrew Right Way Up Office +44 1675 475341 Fax +44 1675 475342 Mobile +44 7767 443992 -----Original Message----- From: Mark Storer [mailto:[email protected]] Sent: 27 April 2011 16:59 To: Post all your questions about iText here Subject: Re: [iText-questions] How to retrieve AcroFields Items in order? "Tab" order as listed in the Items is really just their order in the annotation array. It doesn't respect the /Tabs entry in the source page[s]. The good news (such as it is) is that the annotation order is also the Z-order. That rarely matters... But when it does, it DOES. Writing a Comparator<AcroFields.Item> that took two Items and sorted them by tab order (and page number?) would be trivial. A Comparator that sorted top-to-bottom/left-to-right would be a little tougher, but manageable. Sorting by Structure is relatively involved. IIRC, you can't just sort by MCID. You have to traverse the structure tree, but at least you can use the MCID to look up where to find a given Thing in that tree. The PDF Reference spells out how you're supposed to look up such things, in chapter 14, sections 6 (Marked Content), 7 (Logical Structure) and 8 (Tagged PDF). Mostly "logical structure": http://www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/PDF32000_2008. pdf --Mark Storer Senior Software Engineer Cardiff.com import legalese.Disclaimer; Disclaimer<Cardiff> DisCard = null; > -----Original Message----- > From: Hawk Turner [mailto:[email protected]] > Sent: Wednesday, April 27, 2011 7:42 AM > To: [email protected] > Subject: [iText-questions] How to retrieve AcroFields Items in order? > > I have been searching for a way to get a list of the > AcroFields items from a PDF in order, either by their > position on the page or at least their tab order. Since they > are stored and returned as a HashMap, their natural ordering > is not preserved. Currently I am retrieving the fields using > acroForm.getFields() and then sorting them based on the field > name, but this causes some confusion. I had also started > trying to sort by tab order but this appeared to be > inconsistently available. Are there any other options? > > -------------------------------------------------------------- > ---------------- > WhatsUp Gold - Download Free Network Management Software The > most intuitive, comprehensive, and cost-effective network > management toolset available today. Delivers lowest initial > acquisition cost and overall TCO of any competing solution. > http://p.sf.net/sfu/whatsupgold-sd > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions > > iText(R) is a registered trademark of 1T3XT BVBA. > Many questions posted to this list can (and will) be answered > with a reference to the iText book: > http://www.itextpdf.com/book/ Please check the keywords list > before you ask for examples: http://itextpdf.com/themes/keywords.php > > ---------------------------------------------------------------------------- -- WhatsUp Gold - Download Free Network Management Software The most intuitive, comprehensive, and cost-effective network management toolset available today. Delivers lowest initial acquisition cost and overall TCO of any competing solution. http://p.sf.net/sfu/whatsupgold-sd _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php ------------------------------------------------------------------------------ WhatsUp Gold - Download Free Network Management Software The most intuitive, comprehensive, and cost-effective network management toolset available today. Delivers lowest initial acquisition cost and overall TCO of any competing solution. http://p.sf.net/sfu/whatsupgold-sd _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php
