Change Auto font size to be smaller with Javascript

New Here ,
Mar 14, 2018 Mar 14, 2018

Copy link to clipboard

Copied

Hello!  So the need for this code stems from a long line of problems with solutions that only somewhat work.  I need a text box in a fillable PDF form that someone can type any amount of characters into and have it fill the text box.  Solution: Use Auto text size.  Works great.  Problem is, I'm using a font that cuts off some decendors (like j, g, y) when the text box is set to Auto, and I need to use this font.  I have tried changing the text box size and adding spaces after the words.  Adding spaces does work (it keeps things centered and just makes the font smaller) but it also results in the Text Overflow Indicator ( + ) on the text box, which unfortunately prints.  To make the + stop printing, you have to change your acrobat preferences, and I am not interested in including instructions with this pdf for all my clients to change this setting locally on their computers.  This PDF should just work for them seamlessly without adding unnecessary steps.

So my next attempt to fix this will be using some kind of Javascript code on these text boxes that will shrink the Auto text size down by about 10% to avoid cutting off decendors and which will work automatically for my clients.  Multiplying the current textSize by 0.9 should do the trick, I just don't know how to phrase the code  to make this work; I have never worked with Javascript before.  I have been researching this issue for days, and I need a solution as soon as possible.  If anyone can help me with the code, or has another solution to the main problem, please let me know.  I feel like I could be missing a very simple step.  Thank you.

TOPICS
Acrobat SDK and JavaScript, Macintosh, Windows

Views

240

Likes

translate

Translate

Translate

Report

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
no replies

Have something to add?

Join the conversation