I tried the following method:
var annt = this.getAnnots(1)app.alert(annt.textFont)annt.textFont = "TimesNewRomanPSMT" var spans = new Array();spans = new Object();spans.text = annt.contents;spans.textColor = color.red;spans.textSize = 24;spans.alignment = "center";spans.fontWeight = 800; //set boldspans.textFont = "TimesNewRomanPSMT"annt.richContents = spans
This gave me the bold text, but the font changed to Arial and cannot set the font back to Times New Roman...
So, I tried another way...
var annt = this.getAnnots(1) var span = annt.richContents span.fontWeight = 800 //set boldannt.richContents = span
However, this does nothing...
Is this a bug?
Can anyone suggest good methods to do this? It is difficult to change the format one by one... Thank a lot!
Copy link to clipboard
You have to re-apply the spans array to the richContents property of the Annotation at the end of your code.
See the first code you found.