You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Maruan Sahyoun (Jira)" <ji...@apache.org> on 2020/10/04 17:15:00 UTC

[jira] [Resolved] (PDFBOX-4922) Missing field value after flatten

     [ https://issues.apache.org/jira/browse/PDFBOX-4922?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Maruan Sahyoun resolved PDFBOX-4922.
------------------------------------
    Resolution: Fixed

Provided an interface to plug anSignatureHandler in PDFBOX-4977. The basic implementation will set the appearance streams value to the field value i.e. without formatting.

For the form attached to this issue the JavaScript in the format action is empty anyway so no formatting would be applied

> Missing field value after flatten
> ---------------------------------
>
>                 Key: PDFBOX-4922
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4922
>             Project: PDFBox
>          Issue Type: Bug
>          Components: AcroForm
>    Affects Versions: 2.0.20
>            Reporter: Etienne
>            Assignee: Maruan Sahyoun
>            Priority: Major
>              Labels: Appearance, JavaScript
>         Attachments: a.pdf
>
>
> When I'm trying to flatten a pdf, some text become blank
>  
> Here is a code snippet
> {code:java}
> PDDocument pdfDocument = PDDocument.load(new File("a.pdf"));
> pdfDocument.setAllSecurityToBeRemoved(true);
> PDDocumentCatalog docCatalog = pdfDocument.getDocumentCatalog();
> PDAcroForm acroForm = docCatalog.getAcroForm();
> if (acroForm != null) {
>   PDField field = (PDField) acroForm.getField("nas");
>   field.setValue("test01");
>   field = (PDField) acroForm.getField("nom");
>   field.setValue("test02");
>   acroForm.flatten();
> }
> pdfDocument.save("output.pdf");
> pdfDocument.close();{code}
>  
> In this example, the field "nas" will always get filled, but the field "nom" will only be filled if I remove the acroForm.flatten(); line
>  
> I've attached the pdf.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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