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

Tilman Hausherr edited comment on PDFBOX-5878 at 9/6/24 8:00 AM:
-----------------------------------------------------------------

There are so many things wrong with this PDF that I don't see a specific 
solution. I'm doing this just for fun. I was able to fix some of the fields 
(e.g. Last1) but not yet all (e.g. the multiline fields and some others), for 
some unknown reason. (I added the missing fonts to the default resources) Not 
all appearances are redrawn. Either there's a bug in my code or there is 
something in our code that skips the recreation of the appearances and I forgot 
about it.

It's not even recreated when changing to the value to something else?!


was (Author: tilman):
There are so many things wrong with this PDF that I don't see a specific 
solution. I'm doing this just for fun. I was able to fix some of the fields 
(e.g. Last1) but not yet all (e.g. the multiline fields and some others), for 
some unknown reason. (I added the missing fonts to the default resources) Not 
all appearances are redrawn. Either there's a bug in my code or there is 
something in our code that skips the recreation of the appearances and I forgot 
about it.

> pdf form field text gets blurred after flattening
> -------------------------------------------------
>
>                 Key: PDFBOX-5878
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5878
>             Project: PDFBox
>          Issue Type: Bug
>          Components: AcroForm
>    Affects Versions: 2.0.28, 3.0.3 PDFBox
>         Environment: Mac Ventura, java 18 PDFBox 3.0.3, Tomcat 9
> Linux; version: 5.15.0-105-generic, java 17, Tomcat 9.0.93
>            Reporter: Joseph Jezerinac
>            Priority: Major
>              Labels: Appearance
>         Attachments: Bildschirmfoto vom 2024-09-05 10-07-13.png, 
> beforeFlattening.pdf, flattened.pdf
>
>
> After flattening a pdf acro form, value of some fields get blurred
> {code:java}
>  PDDocument pdDocument = Loader.loadPDF(inFile, "");
>     pdDocument.setResourceCache(new DefaultResourceCache());
>     try {
>         boolean save = false;
>         if (pdDocument.isEncrypted()) {
>             pdDocument.setAllSecurityToBeRemoved(true);
>             save = true;
>         }
>         final PDDocumentCatalog pdDocumentCatalog = 
> pdDocument.getDocumentCatalog();
>         if (pdDocumentCatalog != null) {
>             final PDAcroForm pdForm = pdDocumentCatalog.getAcroForm();
>             if (pdForm != null) {
>                 pdForm.flatten();
>                 save = true;
>             }
>         }
>         if (save) {
>             pdDocument.save(outFile);
>         }
>     }
>     catch (Exception e) {}
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to