passing quads to an annotation in JS

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

anti_g
User
Posts: 22
Joined: Thu Apr 02, 2009 9:55 am

passing quads to an annotation in JS

Post by anti_g »

While this code works

Code: Select all

myQuads = this.getPageNthWordQuads(1, 6);
var annot = this.addAnnot({page:1,
type: "Highlight",
quads: myQuads,
author: "some Author"});
and creates a highlight annotation, this similar code does not work entirely.

Code: Select all

myQuads = [334.3286271220703,779.0089462062654,
369.38308510699466,779.0089462062654,
334.3286271220703,765.2537020122346,
369.38308510699466,765.2537020122346];
var annot = this.addAnnot({page:1,
type: "Highlight",
quads: myQuads,
author: "some Author"});
It creates the annotation but not the highlighting. The numbers are valid and the same as returned by the getPageNthWordQuads function above. So obviously the issue is the incorrect format of myQuads. Can you help me with that?

Thanks,
Anton.
ugradedeveloper
User
Posts: 223
Joined: Wed Aug 22, 2007 4:40 pm

Re: passing quads to an annotation in JS

Post by ugradedeveloper »

I think that in Javascript you need to use parentheses, rather than square-brackets as in your code, to initialize an array. That might be the problem... ?

I also note that you don't have the 'var' keyword in front of the declaration of the array. Might or might not be a problem, I'm not sure how tolerant JS is of these things.
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: passing quads to an annotation in JS

Post by Corwin - Tracker Sup »

Sorry that is the problem in Viewer ActiveX. This is already fixed and fix will be available in new build.
To bypass this problem, for now, you can use next code

Code: Select all

myQuads = [[334.3286271220703,779.0089462062654,
369.38308510699466,779.0089462062654,
334.3286271220703,765.2537020122346,
369.38308510699466,765.2537020122346]];
var annot = this.addAnnot({page:1,
type: "Highlight",
quads: myQuads,
author: "some Author"});
User avatar
John - Tracker Supp
Site Admin
Posts: 5223
Joined: Tue Jun 29, 2004 10:34 am

Re: passing quads to an annotation in JS

Post by John - Tracker Supp »

A new build is now available

thanks
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
anti_g
User
Posts: 22
Joined: Thu Apr 02, 2009 9:55 am

Re: passing quads to an annotation in JS

Post by anti_g »

Thanks, guys, I am happy now. :)
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19913
Joined: Mon Jan 12, 2009 8:07 am

Re: passing quads to an annotation in JS

Post by Stefan - PDF-XChange »

anti_g,

So are we :)

If you have any other troubles in the future you know where to find the answers :D

Regards,
Stefan