height and width of javascript 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

TatianaS
User
Posts: 103
Joined: Mon Mar 18, 2013 4:26 pm

height and width of javascript annotation

Post by TatianaS »

Hello,
I need to create a FreeText annotation with java script.
I know the position where this annotation should be placed, the Font name, size and color,
but I do not know the width and height of the text, so I can create a rectangle with it.
Is there a way I can calculate these values in java script?

here is my unfinished java script:

var text = "Call Smith to get help\r\r on this paragraph.";
// height and width for three lines are unknown
var width = ?
var height = ?

var annot = this.addAnnot({
page: 0,
type: "FreeText",
textFont: font.Helv,
textSize: 16,
rect: [200, 300, 200 + width , 300 +height],
width: 1,
contents: text
});


Thanks,
-Tatiana
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: height and width of javascript annotation

Post by Vasyl - PDF-XChange »

Hi, Tatiana.

Sorry, but no way for that.. :(

Cheers.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.