简体   繁体   中英

Cant get a field of PDF with PDFBox

我有一个带有单个字段“pls”的 pdf,当我调用 AcroForm getFields 的方法时,输出是这样的:“COSString{pls}”,但是当我调用方法 getField("pls") 时,它返回 null 并且我不能在场上做任何事情。

I had a project where I was looking for a field through his name CustomerSignature . Maybe this example can help you.

PDField myField;
for(PDField f : ((List<PDField>) pdfAccroForm.getFields())) {
    if(f.getPartialName()!= null && f.getPartialName().startsWith("CustomerSignature")) {
        myField= f;
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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