Page 1 of 1

Call Tools from JavaScript

Posted: Mon Jan 29, 2018 2:23 am
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.

Re: Call Tools from JavaScript

Posted: Mon Jan 29, 2018 1:31 pm
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

Re: Call Tools from JavaScript

Posted: Tue Aug 23, 2022 2:35 am
by mhabubark
Great! having the same issue with javascript but am able to solve by using Editor SDK. Thanks

Call Tools from JavaScript

Posted: Tue Aug 23, 2022 4:09 pm
by TrackerSupp-Daniel
:)