繁体   English   中英

使用Java和IText,如何从PDF中提取AcroForm字段名称?

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM