Call Tools from JavaScript

This forum is for plugins used in the PDF-XChange Editor only.

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

Post Reply
kcd2015
User
Posts: 12
Joined: Tue Oct 11, 2016 6:55 pm

Call Tools from JavaScript

Post by kcd2015 » Mon Jan 29, 2018 2:23 am

From the JavaScript Console how would I activate the Line Tool with javascript? Or any of the tools for that matter?

My intent is to have a custom toolbar button and when the user clicks it will be prompted for a string value, I then need to set this string value as the subject property of the Line object and activate the line tool so the user can draw this line in the document.

I've already figured out how to create the custom toolbar function and get user input, I just need to figure out how to activate the line tool and manipulate it's properties.

pseudocode:

Code: Select all

var response = app.response({
	cQuestion: "What is the type?",
	cTitle: "Input Type",
	cLabel: "Type:"
});

newLine = Some_Call_That_Starts_Line_Tool;
newLine.subject = response;
something like that...??

[edit]

I've found that I can do this.addAnnot({type:'Line', etc...}); but this isn't ideal as I need the user to mouse click the start and end points of the lines.

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13136
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Call Tools from JavaScript

Post by Tracker Supp-Stefan » Mon Jan 29, 2018 1:31 pm

Hello kcd2015,

I am afraid that this is not possible with JS. You will need to use the Editor SDK to have control over the tools, and be able to activate them as needed:
https://www.tracker-software.com/produc ... editor-sdk

Regards,
Stefan

Post Reply