[ https://issues.apache.org/jira/browse/PDFBOX-5877?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andreas Lehmkühler updated PDFBOX-5877: --------------------------------------- Affects Version/s: 3.0.3 PDFBox (was: 3.0.3 JBIG2) > After flattening a form pdf, the pdf loses content > -------------------------------------------------- > > Key: PDFBOX-5877 > URL: https://issues.apache.org/jira/browse/PDFBOX-5877 > Project: PDFBox > Issue Type: Bug > Components: AcroForm > Affects Versions: 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 > Attachments: beforeFalttening.pdf, flattenedPdf.pdf > > > After flattening the pdf form content changes. Pls take a look at before and > after pdf. The flattening works fine in 2.0.31. After upgrading to 3.0.3 we > started getting many issues with pdf forms after flattening. > The code that used for flattening is as follows > PDDocument pdDocument = Loader.loadPDF(file, “”); > pdDocument.setResourceCache(new PdfResourceCache()) > 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(file); > } > } -- 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