我可以使用 pdfbox 获取大多数 pdf 文件的字段名称,但我无法获取字段所得税表。它是那种形式的限制。
尽管它在表单中包含多个字段,但它只显示一个字段。
这是输出:
最上面的子窗体[0]。
我的代码:
PDDocumentCatalog docCatalog = pdfDocument.getDocumentCatalog();
PDAcroForm acroForm = docCatalog.getAcroForm();
List fields = acroForm.getFields();
@SuppressWarnings("rawtypes")
java.util.Iterator fieldsIter = fields.iterator();
System.out.println(new Integer(fields.size()).toString());
while( fieldsIter.hasNext())
{
PDField field = (PDField)fieldsIter.next();
System.out.println(field.getFullyQualifiedName());
System.out.println(field.getPartialName());
}
用于
public static void main(String[] args) throws IOException {
PDDocument pdDoc = null;
try {
pdDoc = PDDocument.load("income.pdf");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Ggdfgdgdgf feilds = new Ggdfgdgdgf();
feilds.printFields(pdDoc);
}