[
https://issues.apache.org/jira/browse/PDFBOX-3586?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15686325#comment-15686325
]
Maruan Sahyoun commented on PDFBOX-3586:
----------------------------------------
Mhmm - it will be a little tricky. After updating the form using Adobe Reader
there is an AcroForm entry but it doesn't contain the fields i.e. the
{{Fields}} array has no entries. If we do the same we can't use the current
AcroForm PDModel API to get the field information as there are none. OTOH the
current Annotation PDModel doesn't have access to the field related information
only to the annotation part of the field. So you need to use the COS model to
get access to all field/annotation related information and you need to approach
it from the pages annotation side i.e. {{PDPage.getAnnotations()}} and for each
annotation you can use the PDModel for the annotation related properties but
{{PDAnnotation.getCOSObject()}} to get the {{COSDictionary}} for the annotation
which will allow you to retrieve the additional keys which are field related.
> Unable to detect form - pdCatalog.getAcroForm() return null
> -----------------------------------------------------------
>
> Key: PDFBOX-3586
> URL: https://issues.apache.org/jira/browse/PDFBOX-3586
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 2.0.3
> Environment: Latest macOS Sierra 10.12.1. Java 1.8.0_73
> Reporter: steve neo
>
> I have a PDF document which has form. I can type either from browser, Adobe
> reader, they all have an editable form. But when I use getAcroForm(), it
> return null. The PDF
> https://drive.google.com/file/d/0B3Uah3i8yt9qTUVldFVWeTFob2c/view?usp=sharing
> {code}
> PDDocument document = PDDocument.load(input);
> PDDocumentCatalog pdCatalog = document.getDocumentCatalog();
> PDAcroForm formPdf = pdCatalog.getAcroForm(); // here return null
> if (formPdf != null) {
> formPdf.flatten();
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]