Hello, I have got a little problem with getting dropdown option values from Acro Form using iText version 5.4.0. The problem is that the above method returns values in the incorrect order. I looked inside the source code of this method and found out that there is a HashSet collection type used for storing intermediate method return value.
Method starts at the line 271 in com.itextpdf.text.pdf.AcroFields // the returned collection is created here HashSet<String> names = new HashSet<String>(); // ... // then we put everything from options // here we get a sorted array and then lose the order by putting values into a HashSet // ... PdfArray arrayOpt = vals.getAsArray(PdfName.OPT); // ... // put everything from widgets // ... String out[] = new String[names.size()]; return names.toArray(out); I propose to split this method into two parts, each part will return an array or ArrayList with possible duplicates, and in the end we can merge both collections using LinkedHashSet to keep the order of the first collection that seems to be more important to me. I was obliged to write a hack in order to override the mentioned method in the AcroFields class as its constructor is only package visible. Regards, Petr ------------------------------------------------------------------------------ Own the Future-Intel(R) Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net 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