比方說,我已經加載使用iTextSharp的PDF文件:我如何枚舉在PDF文件中的所有字段iTextSharp的
PdfStamper p = GetDocument();
AcroFields af = ps.AcroFields;
我如何從af
文檔的所有字段名的列表?
比方說,我已經加載使用iTextSharp的PDF文件:我如何枚舉在PDF文件中的所有字段iTextSharp的
PdfStamper p = GetDocument();
AcroFields af = ps.AcroFields;
我如何從af
文檔的所有字段名的列表?
AcroFields af = ps.AcroFields;
foreach (var field in af.Fields)
{
Console.WriteLine("{0}, {1}",
field.Key,
field.Value);
}
foreach (DictionaryEntry entry in af.Fields) {
Console.WriteLine(entry.Key +" " +entry.Value);
}
這可能只是我,但我沒有得到.value的了。
foreach (var field in af.Fields)
{
Console.WriteLine(field.Key +" "+ af.GetField(field.Key));
}
PdfReader pdfReader = new PdfReader("c:\\ABC.pdf");
string TempFilename = Path.GetTempFileName();
AcroFields pdfFormFields = pdfReader.AcroFields;
foreach (KeyValuePair<string, AcroFields.Item> kvp in pdfFormFields.Fields)
{
string fieldName = kvp.Key.ToString();
string fieldValue = pdfFormFields.GetField(kvp.Key.ToString());
Console.WriteLine(fieldName + " " + fieldValue);
}
pdfReader.Close();
這個正確顯示字段值(我知道:OP沒問...) – 2015-09-30 15:02:11