Details
Description
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); } }