Martin Mirchev created PDFBOX-6345:
--------------------------------------
Summary: Auto-sized multiline text fields compute line breaks for
a width reduced by the padding
Key: PDFBOX-6345
URL: https://issues.apache.org/jira/browse/PDFBOX-6345
Project: PDFBox
Issue Type: Bug
Components: AcroForm
Affects Versions: 4.0.0, 3.0.8 PDFBox
Reporter: Martin Mirchev
In {{AppearanceGeneratorHelper.calculateFontSize}}, the multiline branch uses
{{float width = contentRect.getWidth() - contentRect.getLowerLeftX();}}.
{{contentRect}} is already the padded content area, so subtracting its lower
left x reduces the width a second time. The text is then laid out with
{{contentRect.getWidth()}} (the {{PlainTextFormatter}} in
{{insertGeneratedAppearance}}), so the font size is chosen for a narrower field
than the one the lines are drawn into: auto-sized ({{0 Tf}}) multiline fields
can get a smaller font than fits. {{contentRect.getWidth()}} would make the two
agree.
This issue was found by an LLM-assisted tool and verified manually.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]