Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
322 views
in Technique[技术] by (71.8m points)

java - PDFBOX Flatten Acro-form causes displaced text from original location

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

question from:https://stackoverflow.com/questions/65838686/pdfbox-flatten-acro-form-causes-displaced-text-from-original-location

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...