使用 pdfbox 调用 acroform.getFields() 时获取 null [英] getting null when call acroform.getFields() using pdfbox

查看:108
本文介绍了使用 pdfbox 调用 acroform.getFields() 时获取 null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图以 pdf 格式获取所有可用字段,但在使用 PDFBox 调用 acroform.getFields() 时遇到了 NullPointerException.

I tried to get All the fields available in pdf form but I'm encountering a NullPointerException when calling acroform.getFields() using PDFBox.

示例:

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

this is because your pdf if not contain any acroform

这篇关于使用 pdfbox 调用 acroform.getFields() 时获取 null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆