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

Can I add Font Style in my JC

claytondesign
Registered: Mar 8 2007
Posts: 2

I am using Acrobat Prof 6.02 for this project,
 
Can I add font style in my Javascript?
 
I have a JC that pulls different fields to make a letter. The text field is set to Times New Roman, is there a script to change a variable in the middle of my script to Times New Roman Bold and the go back to Times New Roman?
 
Example:
 
(times New Roman) Dear sue,
 
Re: account number (times new roman bold) 1234 (times new roman),
 
Thanks in advance!

My Product Information:
Acrobat Pro 6.0.2, Macintosh
tedpadova
ExpertTeam
Registered: Dec 31 2005
Posts: 848
You can display a font by coding your JS to call out a specific font. For example, to set a text field to times roman text you would script a routine similar to:

var f = this.getField("textField");
f.textfont = "Times-Roman";

What's important is knowing the precise name for the font you want displayed.

ted

The author of numerous books on Acrobat, Photoshop, Illustrator and the Adobe Creative Suite, and an international speaker on Adobe Acrobat, Ted Padova is a well-known PDF guru.

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
I think what you are looking for is Rich Text. This is a slightly complex topic. In Acrobat JavaScript a Rich Text string is divided into a set of "Spans". Each span has different characteristics like Font, Color, Size, etc. Rich text can be applied to both form fields and markup annotations. Look up the "Spans" object in the Acrobat JavaScript Reference

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