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

Autosize Text within a Multiline Field - Initial Font Size

crcwebmaster
Registered: Mar 31 2009
Posts: 2

Hello,

I'm having difficulties with text fields within Acrobat.

I'd like to have a multiline text box hold text that is initially 36 point font size, but also have the text size set to 'Auto' so that the text will automatically begin to downsize once the user has begun entering in more than the textbox area can take.

In Acrobat Pro, it seems that the initial value of the text size is 12 points once 'Auto' is set on a multiline textbox and that there is on way to override this behavior.

In Livecycle version 8, I've attempted creating the same multiline box and setting the size of the text to '0' but it the text will not autosize within these PDFs either.

Is there a trick to getting around this, or am I out of luck?

Has others ran across this issue?

Searching Google and a few different forums, including this forum, doesn't seem to bring up any person with a question similar to this.

Any insight would be greatly appreciated, thank you.

-Jessee

My Product Information:
Acrobat Pro Extended 9.1, Macintosh
ebbo1983
Registered: Mar 16 2009
Posts: 93
Is anyone able to help with this, I have a similar problem.

I have a livecycle text field set to size '0' so that the text will downsize should the text not fit into the space provided.

However I would like the initial font size to be set to 10 and then downsize should the text not fit in the field so that the text does not look disparate to the rest of the fields on the page. At the moment the text is huge when I only have a few characters in that field.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Yes, this can be done, but it's tricky. It's easier to do in LiveCycle because there is greater control over the font size, but it's still tricky. Both LiveCyle and AcroForms have a property to indicating when a text field is full. In AcroForms its "event.fieldFull". So you can set the initial font size, and then when the field gets full change to font size to Auto.

Now here are the problems.
1) Once the font size is set to auto the field full indicator will always be false. So you have to treat this like a state machine, i.e., make specific sticky transitions between Auto and Non-Auto modes.

2) The actual font size won't change until the focus leaves the field, which means it can't be changed on the fly. The best you could do is to force a focus change to another field, and then bounce the focus back to the text field. The problem is figuring out some way to do this and keep the cursor position where the user expects it, so they aren't freaked out in the middle of typing.

So, it's not that it not doable. It's that it can't be done well, at least not in an AcroForm. I suspect it can be done much easier in a LC form.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

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

ebbo1983
Registered: Mar 16 2009
Posts: 93
OK so im still struggling on this:

my field is called description_t1 and the user does not actually type into the field itself. the field is automatically populated via a database connection - so be aware there are many instances of this field.

What I would like to do and I hope someone can give a written example is as follows.

When the form loads check each instance of the field, [b]if the text does not fit in the space provided then change the fontsize for that particular instance to 0 otherwise keep that fontsize at 8.5.[/b]

therefore no need to click out of the field and click etc, just simply to check whether the text fits in the space provided. I have NOT set a character limit, but I can set a suitable character limit should it be required.

Anyone?
Boon
Registered: May 5 2010
Posts: 66
How do I set auto resize in Livecycle?
Boon
Registered: May 5 2010
Posts: 66
I found answer to my question. It is just put 0 as a font size. But, I cannot do this when I have a font pallete docked at the top of my window. I need to go to Window>Font. This will open a new font pallete. And now I can change the font size to 0. Work like a charm.thanks.
Ardid
Registered: Nov 14 2010
Posts: 6
Well, what if a maximum fonts size it set (8 pt for instance) and changes to "0" if the text is longer than a given number of characters? Is this possible to write in Javascript?

Ardid
maxwyss
Registered: Jul 25 2006
Posts: 255
For PDF forms, (that's the ones using AcroForms, done in Acrobat), it is a piece of cakeā€¦

In the Format event evaluate the length of event.value, and if it is above your threshold, set the event.target.fontSize to 0, otherwise to your stanard size (8 in the example).

You may make it even more elaborate, by also counting in the number of carriage return characters.

Hope this can help.

Max Wyss.