This post from last year indicates that AcroFields.setListSelection works
since version 5.0.1.1 (or thereabouts):
http://itext-general.2136553.n4.nabble.com/SetFields-Issue-Using-iTextSharp-td2161551.html
I have spent many hours trying several techniques to fill a form, but cannot
get the list options selected. The weirdest part is if I e-mail the file as
an e-mail attachment and preview it in MS Outlook, it shows the value with
the highest index selected and all the values above it missing/hidden, but
when I open it with Acrobat, it shows none selected. The second weirdest
thing is when I dump the form to XFA, the multi-select list boxes are empty
(<Reasons xfa:dataNode="dataGroup"/>). Please tell me what is wrong
with my current attempt using iText v5.0.6.
public void fillDataFromXfdf( String src, InputStream xml, OutputStream
dest, byte[] ownerPassword )
throws IOException, DocumentException, ParserConfigurationException,
SAXException
{
PdfReader reader = new PdfReader( src, ownerPassword );
PdfStamper stamper = new PdfStamper( reader, dest, '\0', true );
XfdfReader xfdf = new XfdfReader( xml );
AcroFields fields = stamper.getAcroFields();
fields.setFields( xfdf );
stamper.close();
reader.close();
dest.flush();
}
<?xml version="1.0" encoding="UTF-8"?>
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">
<fields>
<field name="form1">
<field name="Page1">
<field name="Info1">
<field name="FirstName">
<value>Mark</value>
</field>
<field name="LastName">
<value>Young</value>
</field>
<field name="Numbers">
<value>5</value>
<value>11</value>
<value>14</value>
</field>
<field name="Reasons">
<value>Reason
#2</value>
<value>Reason
#4</value>
</field>
</field>
</field>
</field>
</fields>
</xfdf>
Thanks in advance,
Mark M. Young
[email protected]
--
View this message in context:
http://itext-general.2136553.n4.nabble.com/AcroFields-setListSelection-and-or-setFields-XFDF-does-not-set-list-options-tp3344463p3344463.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
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