These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Character Count in Acrobat X Form

LOOKB4ASKING
Registered: Jan 5 2011
Posts: 4

I am designing a form where as I am asked to specify the character limit to the user (person filling out the form) right on the form. I know I can set a character LIMIT in properties but I am not quite sure how to figure out what the limit is. Meaning, there is a predetermined space (this form was imported) and how to determine what number of characters would fit in it without doing it manually.
 
I am not familiar with how to write code or use it to automate items. It's on my to learn list but this form has a deadline.
 
Thanks to all who contribute to this forum. I learn a lot!

My Product Information:
Acrobat Pro 10.0, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The thing about characters is that they vary in width, so the number or characters that will fit into a particular space depends on the exact characters used. You best bet is to either live with a scrolling multi-line text field or design the space to fit the widest character at you maximum count.

Or, since you said the text entry space is predefined, you need to find out how many characters will fit into it with a given font. Fill the field with the widest character, such as "W", at the desired font and font size, and then count them. For example, if the field was named "TextArea" then this code, run from the console window, returns the number of characters entered into the field.

this.getField("TextArea").valueAsString.count;


Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script