Hello,

Thank you for your quick reaction! I will give a try to those methods 
that you mentioned in your answer. However, in the same book, page 182, 
you give an example of calling getAppearanceStates method to get 
possible values, and I used that as a template. Nice to hear that there 
is a fix coming up!

Regards,
Petr

Le 05.04.2013 16:07, Michael Demey a écrit :
> Hi,
>
>
> I went ahead and fixed this problem and it should be in the next release
> (5.4.1, released in the next week). Even though the JavaDocs of
> getAppearance(fieldName) did not mention it applied to a Combobox, it
> should process it correctly. AcroFields.getAppearance(fieldName) now
> returns the display values (not the export values).
>
>
> Do note that there are other methods to retrieve the display/export
> values of a combobox:
>
> AcroFields.getListOptionDisplay(fieldName);
> AcroFields.getListOptionExport(fieldName);
>
> These return the values in an ordered array.
>
> These two methods are described in the documentation (iText in Action
> Second Edition, p255).
>
>
> Kind regards,
> Michaël.
>
>
>
> Op 2/04/2013 11:50, Petr KOKOREV schreef:
>> 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
>>
>
> ------------------------------------------------------------------------------
> Minimize network downtime and maximize team effectiveness.
> Reduce network management and security costs.Learn how to hire
> the most talented Cisco Certified professionals. Visit the
> Employer Resources Portal
> http://www.cisco.com/web/learning/employer_resources/index.html
> _______________________________________________
> 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
>


------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
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

Reply via email to