Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# itextsharp
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:
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 26-Jun-12 16:54pm
Edited 26-Jun-12 19:42pm
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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[^]
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 520
1 Maciej Los 205
2 Suvendu Shekhar Giri 159
3 Peter Leow 140
4 Kornfeld Eliyahu Peter 133
0 Sergey Alexandrovich Kryukov 9,623
1 OriginalGriff 8,895
2 Peter Leow 5,044
3 Kornfeld Eliyahu Peter 3,333
4 Maciej Los 2,561


Advertise | Privacy | Mobile
Web03 | 2.8.150327.1 | Last Updated 27 Jun 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100