"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
