You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2017/09/27 15:25:00 UTC

[jira] [Commented] (PDFBOX-3809) PDAcroForm.flatten(PDField list, refreshAppearances boolean) flattens all form fields instead of specified ones.

    [ https://issues.apache.org/jira/browse/PDFBOX-3809?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16182736#comment-16182736 ] 

Tilman Hausherr commented on PDFBOX-3809:
-----------------------------------------

We could get a list of all widgets from the field list, and check for equality at the COS level for each PDAnnotationWidget.

The "only" problem that remains is removing a field. There's currently no way to remove a single field from the tree.

But I think this can be done recursively by going through the tree:
- on the array level, check the terminal fields if there's a match at the COS level
- if yes, then delete field from COSArray and report success
- if no, then for each non terminal field, get the kids array and do as described.

This won't be done for the next release (it could, but this would be risky), but I think it can be done.

Alternative: we do nothing and make the method private

> PDAcroForm.flatten(PDField list, refreshAppearances boolean) flattens all form fields instead of specified ones.
> ----------------------------------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-3809
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3809
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: AcroForm
>    Affects Versions: 2.0.5, 2.0.6, 2.0.7
>            Reporter: Cristin Donaher
>            Priority: Minor
>
> Thanks for the excellent PDF library.   For my use case I need to flatten a subset of the AcroForm fields.  I was attempting to use the PDAcroForm.flatten call, passing in my field list.  However, after the method is called, all the fields are gone.  
> The method itself appears to remove all PDFAnnotationWidgets from each page and at the end clears the acroform's field set.
> Is the javadoc description (This will flatten the specified form fields.) just misleading?   Could a flatten call for a subset of fields be added?
> Thanks



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org