Javascript: insert text into textbox with 2 formats
Copy link to clipboard
Copied
Hey thanks for reading.
I need a textbox with two formatting types. Basically, I will insert 1 string as a title and another as a body.
For example, it should say "Acceptance of Offer: " in one font (Avenir-Black), and then "To indicate your acceptance..." in another font (Avenir-Light).
Copy link to clipboard
Copied
You'll need to use the "Rich Text" option for the field, and then set the rich field value to a spans object.
The best way to figure out the "spans" you need is to do this process manually, i.e. type text into the field (that's to be set to rich text), and then use the text properties bar (Ctrl-E) to set the font properties.
Then use the console window to see how the spans are set.
For example:
this.getField("the rich field").richValue.toSource();
Use the Acrobat JavaScript Reference early and often

