Set font of a FreeText annotation

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

prosozial_schmitt
User
Posts: 49
Joined: Tue Dec 28, 2004 9:49 am

Set font of a FreeText annotation

Post by prosozial_schmitt »

Hello,

I want to create a FreeText annotation by JavaScript. I Need to create this annotation with a monospaced font. My script is working - but the annotation is always drawn in font.Helv(?) and not in font.Cour.
How can I change this to the needed behaviour?

Greetings
Hans-Peter

Script:

var annot = this.addAnnot
({
type: "FreeText",
page: 0,
textFont: font.Cour,
textSize: 12,
rect: [235.4114,631.2243,308.9114,644.7243],
width: 0,
fillColor: color.transparent,
strokeColor: ["RGB", 0.00,0.00,0.00],
alignment: 0,
opacity: 1,
rotate: 0,
contents: "_iMi_"
});
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19868
Joined: Mon Jan 12, 2009 8:07 am

Re: Set font of a FreeText annotation

Post by Stefan - PDF-XChange »

Hello prosozial_schmitt,

Your code worked for me in the stand alone portable Viewer, though the font used for the annotation was CourierPS.
Please try changing the following line:

Code: Select all

textFont: "Courier New",
And see if using the non post script uniform font will work better for your needs?

Also please make sure that you have the latest version of the dlls to make sure this is not an issue with an older build.

Regards,
Stefan
prosozial_schmitt
User
Posts: 49
Joined: Tue Dec 28, 2004 9:49 am

Re: Set font of a FreeText annotation

Post by prosozial_schmitt »

Hi Stefan,

I've tried it with textFont: "Courier New" and it works. Using "Arbitrary font" font.Cour seems not to work - but this is now not a real problem for me.

Great :)


Thank you very much
Hans-Peter
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19868
Joined: Mon Jan 12, 2009 8:07 am

Re: Set font of a FreeText annotation

Post by Stefan - PDF-XChange »

Glad I could assist Hans-Peter!

Cheers,
Stefan