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 15:54pm
Edited 26-Jun-12 18: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 389
1 Nirav Prabtani 268
2 Richard Deeming 250
3 _Amy 185
4 CHill60 170
0 OriginalGriff 8,104
1 Sergey Alexandrovich Kryukov 7,067
2 Maciej Los 4,039
3 Peter Leow 3,738
4 CHill60 2,912


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 27 Jun 2012
Copyright © CodeProject, 1999-2014
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