Run Java Script to all open pdf documents

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

docu-track99
User
Posts: 518
Joined: Thu Dec 06, 2007 8:13 pm

Run Java Script to all open pdf documents

Post by docu-track99 »

Hi,

I would like to run a java script to all open pdf documents. If I try the line below:

oTrackerControl.RunJavaScript(sJavaScript)

It only applies the script to the active document. Please help.

Thank you.
User avatar
Patrick-Tracker Supp
Site Admin
Posts: 1645
Joined: Thu Mar 27, 2014 6:14 pm

Re: Run Java Script to all open pdf documents

Post by Patrick-Tracker Supp »

Hi DocuTrack99

JS code gets an active document as 'this'. but it is possible to modify any JS code to work with any document and also there is a way to get all opened documents

Code: Select all

Console print n(this path);

Function f(doc)
cov.... Print (doc.path)
for (doc in app. activeDocs)
f(doc);
I hope this example makes sense. Please note that my knowledge of JS is extremely limited.

I hope this helps!
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.

Cheers,

Patrick Charest
Tracker Support North America