问题描述
我使用 PDFBox 填写表单,然后使用 api 将其展平。生成的 PDF 未正确显示
我使用的是 PDFBox 2.0.21
扁平化表单的示例代码
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)
需要帮助
解决方法
更新至 2.0.22 版通过展平修复了此问题,如 here 所述。 2020年底发布2.0.22版本。
始终使用最新版本,使用 maven versions plugin 来检测新版本的存在。