FreeText position does not work

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

FreeText position does not work

Post by TatianaS »

Hello,
I would like to place my FreeText annotation on specific position (where mouse been clicked), however this js does not paint
my annotation in the right place. If I change FreeText annotation to Text, then the position is working right,
but I cant use Text because it looks like a StickyNote, but I need text box. Could you please take a look, maybe there are some other properties I can use to set position right.

var annot = this.addAnnot ({
page:0,
type: "FreeText",
point: [226, 404],
rect: [0,18,157,0],
width: 0,
textFont:"Arial",
fillColor: color.transparent
});
var spans = new Array();
spans[0] = new Object();
spans[0].textSize = 12;
spans[0].text = "Test Value";
TatianaS
User
Posts: 103
Joined: Mon Mar 18, 2013 4:26 pm

Re: FreeText position does not work

Post by TatianaS »

My calculations of the rectangle were wrong, my bet :)
User avatar
John - Tracker Supp
Site Admin
Posts: 5223
Joined: Tue Jun 29, 2004 10:34 am

Re: FreeText position does not work

Post by John - Tracker Supp »

;)
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: FreeText position does not work

Post by Vasyl - PDF-XChange »

Hi, TatianaS.

Your script for adding the textboxes is incorrect. The correct script would be as follows:

var annot = this.addAnnot ({
page:0,
type: "FreeText",
rect: [0,100,200,0],
width: 1.0,
textFont:"Arial",
textSize: 20,
fillColor: color.transparent
});
if (annot != null)
annot.contents = "Test Text";


HTH.
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.