Call Tools from JavaScript

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

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

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

Call Tools from JavaScript

Post by kcd2015 »

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: 17818
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Call Tools from JavaScript

Post by Tracker Supp-Stefan »

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.pdf-xchange.com/produc ... editor-sdk

Regards,
Stefan
mhabubark
User
Posts: 1
Joined: Tue Aug 23, 2022 2:23 am

Re: Call Tools from JavaScript

Post by mhabubark »

Great! having the same issue with javascript but am able to solve by using Editor SDK. Thanks
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8436
Joined: Wed Jan 03, 2018 6:52 pm

Call Tools from JavaScript

Post by TrackerSupp-Daniel »

:)
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
Post Reply