复选框列表到itextsharp列表到pdf字段 [英] checkbox list to itextsharp list to pdf Field

查看:163
本文介绍了复选框列表到itextsharp列表到pdf字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

基本上,我有一个复选框列表,然后单击按钮,我要求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);


但是,我在最后一行收到错误消息:"The best overloaded method match for ''iTextsharp.text.pdf.AcroFields.SetField(string, string)'' has some invalid arguments."

但是我无法说出我错过了什么. "intList.Add(li.Text)"是否已将其转换为字符串?


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?

推荐答案

这是VB.net示例: http://www.mikesdotnetting.com/Article/83/Lists-with-iTextSharp [ ^ ]
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[^]


这篇关于复选框列表到itextsharp列表到pdf字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆