Skip to main content
Participant
December 11, 2023
Answered

I want auto-size of text to start with chosen size.

  • December 11, 2023
  • 4 replies
  • 1357 views

I have a document where the text size in the fields is set to 10.  I want to set the text size to Auto for when data entered excedes the length of the field so that the text will shrink.  But when I set the font size to auto, it immediately makes the text size smaller than 10.  I really want to have my cake and eat it too here.  How do I set the font size to auto size from 10 on down?  This seems like it should be an easy fix, but I can't figure it out.

 

 

Correct answer try67

You can change the font size dynamically using a script (based on the length of the text), but it won't have an effect while the user is typing into the field, only when they leave it, which kind of defeats the whole purpose of doing it. If you want it to adjust while the user is typing you need to use the Auto option for text size.

4 replies

JR Boulay
Community Expert
Community Expert
December 11, 2023

PS: these examples do not come from science or calculations, they are empirical observations made after a lot of trial and error.

Acrobate du PDF, InDesigner et Photoshopographe
JR Boulay
Community Expert
Community Expert
December 11, 2023

The initial text size depends on the height of the field.

If you want the text size to be equal to 10, the height of the field must be 0.51 cm.

If you want the text size to be equal to 12, the height of the field must be 0.58 cm.

Etc.

 

 

Acrobate du PDF, InDesigner et Photoshopographe
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
December 11, 2023

You can change the font size dynamically using a script (based on the length of the text), but it won't have an effect while the user is typing into the field, only when they leave it, which kind of defeats the whole purpose of doing it. If you want it to adjust while the user is typing you need to use the Auto option for text size.

Thom Parker
Community Expert
Community Expert
December 11, 2023

Not really possible.

But, Acrobat generally sets the initial text size to the height of the text box, up to a certain point. Probably 12 pt text.  So, set the inside height of the text field to 10 points. 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participant
December 11, 2023

That's the problem I'm having.  I can set the text size to be 10.  I've done that already.  What I'm looking for is when I set the the text size to be Auto sized, I want the text to start out at 10, and get smaller only when the text length exceeds the width of the text box.  Thank you for your reply.

Thom Parker
Community Expert
Community Expert
December 11, 2023

I didn't say to set the text size to 10. I said to set the box height to 10points. Set the text size to auto in the properties dialog.  

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often