Javascript: possible bug in how PDF-Xchange returns gestures  SOLVED

Forum for the PDF-XChange Editor - Free and Licensed Versions

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Mathew
User
Posts: 239
Joined: Thu Jun 19, 2014 7:30 pm

Javascript: possible bug in how PDF-Xchange returns gestures

Post by Mathew »

While trying to make a script to mirror comments, I ran into a possible bug: If you get gestures from an Ink annotation, the array of coordinates it returns duplicates the x coordinates in the the y coordinate position. The easiest way to demonstrate it is to use one of the example scripts that adobe wrote, and then get the gestures property of the drawn annotation:

Code: Select all

// A fancy ink annotation in the shape of a three-leaf rose.
var inch = 72, x0 = 2*inch, y0 = 4*inch;
var scaledInch = .5*inch;
var nNodes = 60;
var theta = 2*Math.PI/nNodes;
var points = new Array();
for (var i = 0; i <= nNodes; i++) {
Theta = i*theta;
points[i] = [x0 + 2*Math.cos(3*Theta)*Math.cos(Theta)*scaledInch,
y0 + 2*Math.cos(3*Theta)*Math.sin(Theta)*scaledInch];
}
var annot = this.addAnnot({
type: "Ink",
page: 0,
name: "myRose",
author: "A. C. Robat",
contents: "Three leaf rose",
gestures: [points],
strokeColor: color.red,
width: 1
});
console.println("The x coordinates are duplicated in the gestures output:");
console.println(annot.gestures);
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8624
Joined: Wed Jan 03, 2018 6:52 pm

Re: Javascript: possible bug in how PDF-Xchange returns gestures

Post by TrackerSupp-Daniel »

Hello, Mathew

I have brought this to the attention of the Dev team and am just waiting on a reply from them, hopefully they have some feedback about another way to perform this for you, or they may offer a promise of resolution in a future release.

Kind regards,
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3556
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada

Re: Javascript: possible bug in how PDF-Xchange returns gestures  SOLVED

Post by Ivan - Tracker Software »

fixed in next build
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.