Return text fields into which the text cannot be inserted completely #289
Replies: 2 comments
-
There is currently no way to determine this in HexaPDF. Due to the way your I will have a look at how to best provide that information. |
Beta Was this translation helpful? Give feedback.
-
Thanks for having a look into it! |
Beta Was this translation helpful? Give feedback.
-
If a text field of a PDF template is filled with a text, it can happen that the text does not fit completely into the field.
It would be very helpful to be informed in which fields the text has not been inserted completely.
For now I tried the following:
I use Prawn's method
width_of
to get the width of the text (based on the font and the font size).If the text width is less then the text field width the texts fits.
When I look at the generated PDF, I see that if
text_fits?
returns true, the text is inserted completely. And iftext_fits?
returns false, the text cannot be inserted completely.Do you think this is reliable way?
Is there a similar method like
width_of
in hexapdf?Or is there a better way in hexapdf to achieve this?
For example, something similar to Prawn's
formatted_text_box
which returns the text that does not fit into the box:Thanks!
Beta Was this translation helpful? Give feedback.
All reactions