【问题标题】:Using Java and IText, how to extract AcroForm field names from a PDF?使用 Java 和 IText,如何从 PDF 中提取 AcroForm 字段名称?
【发布时间】:2010-06-22 12:33:06
【问题描述】:

我正在寻找一个简单的 API 示例,它读取 PDF 文件/模板作为输入,并遍历 PDF 表单中定义的字段(我认为它称为 AcroForm)

【问题讨论】:

    标签: java pdf itext


    【解决方案1】:

    好的,我找到了解决办法

    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();
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-01-08
      • 2018-12-14
      • 2010-10-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多