Flatten does not format multiline field correctly
Hi,
i have a template with a textfield, which is being filled. template.pdf
After being filled, this is the result: without flatten.pdf
After calling flatten, it looks like this: with flatten.pdf
I took a quick look into flatten, but i don't have enough experience with the internals of PDF.
I think it's the same as #953
I just tried with some more lines of text. It's just half a line added to the top position.
Looks like the text field's line height is too large. pdf-lib should use whatever formatting is configured for a field when flattening it. You can decrease the line height in acrobat. I suspect that will fix this issue for you:
Large Line Height
Small Line Height
In theory pdf-lib could override the configured formatting if it detects that doing so would allow the text to fit within the field's bounds. But I'm not sure how widely used such a capability would be. If anybody is interested in working on this, I'm happy to accept PRs!