Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Setting a max text size, but shrinks when needed

New Here ,
Oct 18, 2019 Oct 18, 2019

Hello,

 

I'm building a simple form that has a few text boxes. I need the boxes to have a max text font size of 6. However, I need that size to shrink if the user inputs more text than the box size. I don't have room for wrapping or multiple lines. I found an answer on this form via google that told me to do the following

 

Properties...

Options

  • no Multiline, Chars Limit, Comb AND Allow Rich Text

Actions

  • OnFocus | Run JavaScript

add this code:

event.target.textSize = 0;
  • OnBlur | Run JavaScript

add this code:

var len = event.target.value.toString().length;
//console.println("LEN " + len);
if (len < 4) {
    event.target.textSize = 18;
}
else {
    event.target.textSize = 0;
}

 

Ref: https://answers.acrobatusers.com/Is-it-possible-to-set-minimum-and-maximum-font-sizes-in-Acrobat-PDF...

 

However, when I attempt to use this code (but with text size set to 6) it will work the first time text is entered. However, If I erase some text and try to put anything else in, the text will go bigger than 6 point. It goes back to "auto" text size. The JavaScript only seems to work one time. I'm pretty new to using JavaScripts. What am I doing wrong? Any help is appreciated.

 

I'm using Adobe Acrobat Pro DC

 

2.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Oct 19, 2019 Oct 19, 2019

Hi

 

Set the field height to 0.32 or 0.33 centimetres, so the auto-sized text begins with a size of (about) 6 pt.

😉

 

Capture_015.png


Acrobate du PDF, InDesigner et Photoshopographe

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 19, 2019 Oct 19, 2019

Hi

 

Set the field height to 0.32 or 0.33 centimetres, so the auto-sized text begins with a size of (about) 6 pt.

😉

 

Capture_015.png


Acrobate du PDF, InDesigner et Photoshopographe
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 21, 2019 Oct 21, 2019
LATEST

Well, that was an easy fix. Thank you!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines