[英]Using Java and IText, how to extract AcroForm field names from a PDF?
我正在寻找一个简单的API示例,它将PDF文件/模板作为输入读取,并迭代PDF表单中定义的字段(我认为它被称为AcroForm)
Ok, I have found the solution 好的,我找到了解决方案
public static void scanFields(String path) throws IOException {
PdfReader pdfReader = new PdfReader(path);
AcroFields acroFields = pdfReader.getAcroFields();
HashMap<String,AcroFields.Item> fields = acroFields.getFields();
Set<Entry<String, Item>> entrySet = fields.entrySet();
for (Entry<String, Item> entry : entrySet) {
String key = entry.getKey();
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.