Javascript examples and autocompletion
Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan
Javascript examples and autocompletion
Hello,
I was wondering if there are documented JavaScript examples in the PDF Editor. I was also wondering if I could use the autocompletion function in the JavaScript console or somewhere else. It makes life of a developer very much easier and long manuals even obsolete if autocompletion shows members and properties of a class and such stuff.
Best, sashu
I was wondering if there are documented JavaScript examples in the PDF Editor. I was also wondering if I could use the autocompletion function in the JavaScript console or somewhere else. It makes life of a developer very much easier and long manuals even obsolete if autocompletion shows members and properties of a class and such stuff.
Best, sashu
- Tracker Supp-Stefan
- Site Admin
- Posts: 17929
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: Javascript examples and autocompletion
Hello Sashu,
Before I answer the question - can you please tell me if you are a developer or an end user trying to e.g. create a form with some JS?
Also - you seem to have posted in the wrong forums. Please let me know where the correct place is for this topic and I will move it accordingly.
Regards,
Stefan
Before I answer the question - can you please tell me if you are a developer or an end user trying to e.g. create a form with some JS?
Also - you seem to have posted in the wrong forums. Please let me know where the correct place is for this topic and I will move it accordingly.
Regards,
Stefan
Re: Javascript examples and autocompletion
Hello Stefan,
I am an end user that is interested in exploring the full spectrum of PDF-Xchange editor.
Best, sashu
I am an end user that is interested in exploring the full spectrum of PDF-Xchange editor.
Best, sashu
- TrackerSupp-Daniel
- Site Admin
- Posts: 8600
- Joined: Wed Jan 03, 2018 6:52 pm
Re: Javascript examples and autocompletion
Hello Sashu,
I have moved this topic into the Appropriate (PDF-XChange Editor) Forums.
I am sorry to say that to my knowledge there is no autocomplete functionality available in the built in JS function.
As for examples and long manuals:
I do not have much at the moment, just the base utilities I've nicked off my colleagues for JS examples, but here is my little (two item) Repository of them.
As for long manuals!
https://www.adobe.com/content/dam/acom/ ... erence.pdf
Yes this is the Adobe JS API reference, we thankfully use the same calls as they do (its a compatibility thing). The only limitation I am aware of at this moment is that we cannot use calls with the security tag from this manual, yet.
I have moved this topic into the Appropriate (PDF-XChange Editor) Forums.
I am sorry to say that to my knowledge there is no autocomplete functionality available in the built in JS function.
As for examples and long manuals:
I do not have much at the moment, just the base utilities I've nicked off my colleagues for JS examples, but here is my little (two item) Repository of them.
Code: Select all
//Reorder pages:
//Reorders Pages A1, B1, A2, B2, A3, B3...
for (i = 0; i < ((this.numPages - 1)/2); i++)
{
this.movePage(Math.ceil(this.numPages/2)+i,2*i);
}
//Reverse page numbering:
// Change file ext. to .js. Then save to C:\Program Files\Tracker Software\PDF Editor\JavaScripts
function ReversePageOrder()
{
for (i = this.numPages - 1; i >= 0; i--) this.movePage(i);
}
app.addToolButton({
cName: "Reverse Page Order",
cExec: "ReversePageOrder()",
cTooltext: "Reverse pages",
cEnable: true,
nPos: 0
});
https://www.adobe.com/content/dam/acom/ ... erence.pdf
Yes this is the Adobe JS API reference, we thankfully use the same calls as they do (its a compatibility thing). The only limitation I am aware of at this moment is that we cannot use calls with the security tag from this manual, yet.
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
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
Re: Javascript examples and autocompletion
Great, thanks, Daniel. I was reading the pdf and saw the class EventListener (page 386) that probably listens for different events such as Open. Does every Pdf-Viewer support an event cycle and an event can be catched by the JS code?
Best, sashu
Best, sashu
- Will - Tracker Supp
- Site Admin
- Posts: 6815
- Joined: Mon Oct 15, 2012 9:21 pm
- Location: London, UK
- Contact:
Re: Javascript examples and autocompletion
Hi Sashu,
It's not likely that every single one will, but I suspect that all of the major readers should (e.g. Adobe)
It's not likely that every single one will, but I suspect that all of the major readers should (e.g. Adobe)
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
Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
Thank you.
Best regards
Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
Re: Javascript examples and autocompletion
Do you know how I overload an event handler or where to store JS in PDF? I am a real newbie in these matters.
Will - Tracker Supp wrote:Hi Sashu,
It's not likely that every single one will, but I suspect that all of the major readers should (e.g. Adobe)
- Will - Tracker Supp
- Site Admin
- Posts: 6815
- Joined: Mon Oct 15, 2012 9:21 pm
- Location: London, UK
- Contact:
Re: Javascript examples and autocompletion
Hi Sashu,
That really depends on how you want to use the JS and what you're doing. For example, you can apply specific JS actions to specific form fields; you can run an app/doc. wide script through the JS panel (Ctrl + J, or you can add a script to the document via the Document Properties (Ctrl + D --> Actions or Ctrl + D --> JavaScript).
Cheers,
That really depends on how you want to use the JS and what you're doing. For example, you can apply specific JS actions to specific form fields; you can run an app/doc. wide script through the JS panel (Ctrl + J, or you can add a script to the document via the Document Properties (Ctrl + D --> Actions or Ctrl + D --> JavaScript).
Cheers,
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
Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
Thank you.
Best regards
Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com
Re: Javascript examples and autocompletion
Thanks, Will, nice to know. I don't have a specific goal. Yet. Just wanted to know how I would develop a JS script that performs certain actions when a PDF is opened.
CU, Alexander
CU, Alexander
- Tracker Supp-Stefan
- Site Admin
- Posts: 17929
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
-
- User
- Posts: 83
- Joined: Fri Mar 07, 2014 9:46 am
Re: Javascript examples and autocompletion
I would like to support this feature. I use the editor as end user , but i am also an developer so autocomplete support would be very nice to script some litte stuff in the console. I know there is an api document for this from Adobe but autocomplete invites you to try and explore things, but reading such a api document does not.
Best regards
Daniel
Best regards
Daniel
Best regards
Daniel
PDF XChange pro
Daniel
PDF XChange pro
- Tracker Supp-Stefan
- Site Admin
- Posts: 17929
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: Javascript examples and autocompletion
Hello Daniel,
Thanks for adding your vote! I am sure it will be taken into account when considering this feature!
Cheers,
Stefan
Thanks for adding your vote! I am sure it will be taken into account when considering this feature!
Cheers,
Stefan