I used PDFBOX to fill form and then flatten it using api. Resulting PDF is not correctly displayed
Link TO PDF
I used PDFBox 2.0.21
sample code to flatten form
val sourceDocument = getTemplate(templatePath) val form = sourceDocument.documentCatalog.acroForm fillHeader(form, headerParam, currentPage, totalPages, it) fillData(form, it, currentPage) form.flatten(form.fieldTree.toList(),false)
full code is posted at Full code
I am not sure if this problem is PDFBox or Adobe
Need help
Updating to version 2.0.22 fixes this problem with flattening, which was described here. Version 2.0.22 was released at the end of 2020.
Always use the latest version, use the maven versions plugin to detect the existence of new versions.
1.4m articles
1.4m replys
5 comments
57.0k users