Skip to main content
Participant
Jul 10, 2018 10:05 PM UTC
Answered

Annotation - set font not working

Acrobat DC on PC or mac.  I am adding an annotation to a page via a Custom Command.  The text color, size, and alignment all are working.  However, the typeface is always Helvetica.  I have tried font.Times , font.Cour, "Times", "Courier" as the argument after textFont:    Any suggestions?

var annot = this.addAnnot(

{ 

     page: msgOnThisPage,

     type: "FreeText",

     rect: [36,36, 612-36,72],

     textFont: font.Times,

     strokeColor: color.white

}

); 

spans[0] = new Object();

spans[0].text = theMessage[0];

spans[0].textColor = color.black;

spans[0].textSize = 14;

spans[0].fill = "invisible";  // no background color

spans[0].alignment = "center";

annot.richContents = spans;

   

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Jul 10, 2018 11:02 PM UTC

Add this line:

spans[0].fontFamily = ["Times"];

By the way, there's no "fill" property to a Span object. You should remove that line.

3 replies

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Jul 10, 2018 11:02 PM UTC

Add this line:

spans[0].fontFamily = ["Times"];

By the way, there's no "fill" property to a Span object. You should remove that line.

Translate
try67
Community Expert
Community Expert
Jul 10, 2018 11:03 PM UTC

Instead of "fill" you can use the fillColor property of the annotation itself. And the value should be "color. transparent" (without the quotes).

Translate