我试图以 pdf 形式获取所有可用字段,但在使用 PDFBox 调用 acroform.getFields()
时遇到了 NullPointerException
。
示例:
pdDoc = PDDocument.load(fileName);
PDAcroForm form = pdDoc.getDocumentCatalog().getAcroForm();
if(form!=null)
{
List<PDField> field = form.getFields(); //here I am getting null pointer exception
}
最佳答案
这是因为如果您的 pdf 不包含任何 acroform
关于java - 使用 pdfbox 调用 acroform.getFields() 时获取 null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16420509/