Solved

Set form field text size to maximum in Acrobat

Posted on 2010-11-19
8
1,579 Views
Last Modified: 2012-05-10
Hello,

basically I want a form field that's text size is auto but the maximum size is e.g. 10pt. I know that the initial size depends on the height of the text field, but shrinking the fields height is not an option for me. Of course I would prefer a solution via GUI but javascript is also ok. My idea was to set the initial text size to 10pt and then in keystroke event set the size to 0, which means "auto" in acrobat; but I don't know how to validate the text width against field's rectangle width.

Thank you.
0
Comment
Question by:Stephan_Schrandt
  • 4
  • 4
8 Comments
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
Comment Utility
Do I understand this correctly? You want the text field to use 10pt text until the string gets too long for the field, and then switch to auto?
0
 
LVL 9

Author Comment

by:Stephan_Schrandt
Comment Utility
Yes, exactly. I know about the fieldFull event but when I use it and the user deletes some text, the text size remains 'auto'.
0
 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 500 total points
Comment Utility
The fieldFull event would have been my suggestion - with the caveat that it does not work correctly if the user deletes text or copy&pastes text.
Unfortunately the fieldFull even is only triggered on a keystroke, so we cannot just set the font size to a fixed size and see if the field fills up.
So it looks like what you want to accomplish is not possible with AcroForm fields. Sorry.
0
 
LVL 9

Author Comment

by:Stephan_Schrandt
Comment Utility
I wonder if there may be a way to dynamically create a non-visible field, set its size to "expand to fit" and fill it with the content of the desired field. This would help me to determine the width of the original field and check if it should be 10pt or autosize. Yes you are right, I'm already in LiveCyle Designer...
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 44

Expert Comment

by:Karl Heinz Kremer
Comment Utility
The problem again is that we can only test for the field full condition on a keyboard event, your invisible field would not be able to receive such events.
0
 
LVL 9

Author Comment

by:Stephan_Schrandt
Comment Utility
The idea was, to create this field on every keystroke, check it's width, compare it with the width of the original field and if it it wider, then adjust the textsize of original field to auto. I will try a bit with that and give feedback. But I think even if I reach my goal with that, it produces too much overhead. At this point it's only a question of possibility =)
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
Comment Utility
Good luck. Let me know if it works.
0
 
LVL 9

Author Comment

by:Stephan_Schrandt
Comment Utility
Ok here's the summary.

I tried to use AcroForms. I used keystroke and fieldFull event to check if the textsize is set to auto. But this does not do the job since we don't have an event to rollback the size if needed (e.g. on text deletion).

Then I read about the "expand to fit" property of LiveCycle designer. So the idea was to use XFA to access a hidden field with expandtofit = true and copy the visible field's text in hidden fields change event , then compare the widths of both and set textSize to auto if the hidden field is larger. But, wow what a surprise, the expandtofit property isn't really a property. It's just like textSize auto. When you  mark it in the designer, internally the field.w property is set to 0. So no chance to get the displayed width in javascript.

At that point I gave up and I really think, khkremer gave the right answer in his second comment. It's just not possible.

0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Update 21-May-2015: I temporarily removed the source code to make major changes to the program. Regards, Joe In a previous Experts Exchange article, How To Rename-Move a Batch of PDF Files Based on Contents of the Files (http://www.experts-exchan…
Inserting page numbers in Portable Document Files not only enhances manageability but also makes them look professional. With numbered pages, the file appears more organized and it becomes easier to search for a particular page. The size and the vol…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now