如何使用iTextSharp从PDF文档中的字段确定字段类型?

时间:2011-11-29 20:11:30

标签: c# visual-studio itextsharp

我正在使用C#和VisualStudio试验iTextSharp库。我正在尝试从AcroFields对象获取字段名称和字段类型(TextBox,RadioButton,ComboBox,CheckBox)。

字段名称很容易找到,但我正在努力使用字段类型。我已经检查了iText javadoc,因为这里有人说iTextSharp中的方法和功能应该类似但是没有发现情况。

这是我的代码,它是字段名称:

FormObject fo = new FormObject();
List<FormField> form_fields = new List<FormField>();

PdfReader reader = new PdfReader(file_name);
AcroFields reader_fields = reader.AcroFields;

foreach (KeyValuePair<String, iTextSharp.text.pdf.AcroFields.Item> entry in reader_fields.Fields)
{
    FormField ff = new FormField();
    ff.Field_name = entry.Key.ToString();
    form_fields.Add(ff);
}

关于如何从AcroFields对象中提取字段类型的任何想法?我知道它必须在某处......

0 个答案:

没有答案