[英]Using Java and IText, how to extract AcroForm field names from a PDF?
我正在尋找一個簡單的API示例,它將PDF文件/模板作為輸入讀取,並迭代PDF表單中定義的字段(我認為它被稱為AcroForm)
好的,我找到了解決方案
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.