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

Formatting text in a field

acortez
Registered: Jun 25 2010
Posts: 3

Hi all,

Need some little help here for a newbie.

I need to code a field in acrobat to specifically format a text.

what I have is:

var a = this.getField("message1");
var n = this.getField("message2");
var m = this.getField("message3");
a.value = "Text not in BOLD ";
n.value = "Words in BOLD";
m.value = (a.value + ' ' + n.value);

OUTPUT:

Text not in BOLD Words in BOLD

I want the "Words in BOLD" to be BOLD, how do I do this in acrobat using javascript?
if you could share some code that would be great, or maybe other alternatives that will generate the same output.

Thanks in advance..

alex c.

-acortez-

My Product Information:
Acrobat Pro Extended 9.3.1, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2398
You need to set the field as a Rich Text field and then use the richValue property and an array of Span objects to apply styles to the text.
This is documented in the reference files under the richValue property and Span object.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com