Click here to Skip to main content
15,896,726 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi All

Basically, I have a checkbox list, and on button click, im asking itextsharp to create a list and put it in the field based on whats checked.
here's what a i have:
C#
using li = System.Web.UI.WebControls.ListItem;
using it = iTextSharp.text;

it.List intList = new it.List(it.List.UNORDERED);
foreach (li li in cblInterior.Items)
{
    if (li.Selected == true)
       {
           intList.Add(li.Text);
                    
       }
}
pdfFormFields.SetField("InteriorText", intList);

but, i get an error at the last line saying: "The best overloaded method match for 'iTextsharp.text.pdf.AcroFields.SetField(string, string)' has some invalid arguments."

But I can't tell what im missing. Doesnt "intList.Add(li.Text)" turn it into a string already? Is it a syntax problem with itextsharp?
Posted
Updated 26-Jun-12 18:42pm
v2

1 solution

Here is a VB.net sample: Programmatically Complete PDF Form Fields using Visual Basic and the iTextSharp DLL[^]
According to it and the exception you got, you can not pass a list only string key-value pairs. If you want a formatted list you should try to convert intList to a formatted string. But I am not sure if fields support formatted text.
See also: http://www.mikesdotnetting.com/Article/83/Lists-with-iTextSharp[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900