gettalong / hexapdf

Versatile PDF creation and manipulation for Ruby
https://hexapdf.gettalong.org
Other
1.21k stars 69 forks source link

AcroForm text field font size #260

Closed ruinunes closed 11 months ago

ruinunes commented 11 months ago

In HexaPdf, when filling a value in an AcroForm, with a single-line text field and before flattening: is it possible to have the font size to shrink so that the text fits within the width of the field?

The case in point is having an email in the text field, but the email could have a big length of characters, resulting in chopped-of text.

image
gettalong commented 11 months ago

Are you using the latest version of HexaPDF? There was a recent change that makes HexaPDF also consider the width of a single line text field when auto-sizing text.

For this to work the text field must be auto-sized, i.e. use a font size of 0. So also make sure that the text field is an auto-sized one.

ruinunes commented 11 months ago

I can confirm that it does work using the latest hexapdf 👍

image