Ah. You have an XFA based form, and are using AcroForm tech to address it. Don't do that.
I'm not so sure our XFA code supports multiple list values. Lets see. Not directly, no. You /can/ get the XFA bytes and monkey with them to your heart's content however. Far from ideal, but effective. --Mark Storer Senior Software Engineer Cardiff.com import legalese.Disclaimer; Disclaimer<Cardiff> DisCard = null; > -----Original Message----- > From: Adam Field [mailto:[email protected]] > Sent: Monday, March 28, 2011 11:21 AM > To: [email protected] > Subject: [iText-questions] SetListSelection (setting > multivalued list fieldvalues) > > I'm pretty new to both itextsharp and the pdf format in > general, so I apologize if this is a dumb question; I > recently inherited responsibility for a component that writes > values to fields on an arbitrary (user-specified) pdf using > itextsharp, which for the most part worked when I got it. I > have, however, a couple examples of pdfs containing list > fields that accept multiple values. This calls > SetListSelection on the field, which returns without error, > but doesn't act as expected (in one case, the field hides the > nonselected items until you click on it; in the other, the > field is visible but nothing is selected) . Is there > something else I should be doing instead or in addition? Is > that method just particularly finicky about what sorts of > pdfs it will accept, and I found flawed pdfs? > > For convenience, I've attached a sample, though I believe it > came from an itext example originally (it was given to me by > the previous developer), so you may have seen it before. Our > component is still using an older version of itextsharp, but > I just created a small test project using 5.0.5 and got the > same results (no selected programming languages when the > output is viewed in Reader): > > using (FileStream fileStream = new > FileStream("c:\\temp\\output.pdf", FileMode.Create, > FileAccess.ReadWrite, FileShare.ReadWrite)) > { > PdfReader reader = new > PdfReader("c:\\temp\\CanWriteField.pdf"); > PdfStamper stamper = new > PdfStamper(reader, fileStream, reader.PdfVersion); > > stamper.AcroFields.SetListSelection("form1[0].#subform[0].pers on[0].Row4[0].programming[0]", > new string[] { "VB", "C" }); > stamper.Close(); > } > > Thanks! > -Adam > ------------------------------------------------------------------------------ Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf _______________________________________________ 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
