Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Auto-adjust font size to fit

Avatar

Not applicable
Does anyone know of a way to auto-adjust the font size of a text field to prevent scrolling? I am binding data to the field, and if the incoming xml data causes the field to scroll I would like to adjust the font size so that the text will fit in the field without scrolling.



Before anyone suggests counting the number of characters...this is not an acceptable solution because I am not using a fixed-width font.



Any ideas?
5 Replies

Avatar

Not applicable
You can put the following line of javascript on "initialize" event of the text field. This should automatically sizing your font.



this.font.size = "0pt";

Avatar

Not applicable
Jimmy,

I attempted to do this with no luck. Is there anything else that needs to be done? Can you provide a working example demonstrating this?

Avatar

Not applicable
Did you save your form as dynamic PDF?

Avatar

Not applicable
You can find an example here. Key in the text field. As you content grows, the font fize will be reduced automatically to fit the content in that text field.



http://66.34.186.88/LiveCycleSamples/.3bbd0d52.pdf

Avatar

Not applicable
Now I see the problem. This only works with plain text. It does not work for rich text, which is what my field is set to use. Thanks for the advice.