Storing custom javascript functions?

The PDF-XChange Viewer for End Users
+++ FREE +++

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

MoH2014
User
Posts: 3
Joined: Tue Dec 23, 2014 6:44 am

Storing custom javascript functions?

Post by MoH2014 »

Hi,

Can someone please let me know if there's a way to *persistently* store javascript console functions in PDFXC Viewer? I created a couple of really useful functions for myself today, but now can't seem to find a way to store them so that they are available again when I reopen the Viewer...

Do I have to store such functions in a separate text file somewhere, and *manually* paste them into the console every time I need to use them? Surely, there must be a better way...

On a related note, is it possible to assign toolbar-buttons/shortcuts to such javascript-console functions? I looked through the "Customize Toolbars/Commands" dialog, but the option to create New commands is always greyed out..?

If the Viewer doesn't directly support such functionality, is it possible for me to put in some extra effort and create an actual extension/plug-in (javascript-based?) for the program, so I can have persistent and easy access to my functions?

Please let me know, thanks,

Mo
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2476
Joined: Thu Jun 30, 2005 4:11 pm

Re: Storing custom javascript functions?

Post by Vasyl - PDF-XChange »

Hi, Mo.
Do I have to store such functions in a separate text file somewhere, and *manually* paste them into the console every time I need to use them? Surely, there must be a better way...
It is possible. You may add *.js file with necessary custom js-functions into "...\Program Files\Tracker Software\PDF Viewer\JavaScript\" folder.
On a related note, is it possible to assign toolbar-buttons/shortcuts to such javascript-console functions? I looked through the "Customize Toolbars/Commands" dialog, but the option to create New commands is always greyed out..?
This feature isn't implemented in Viewer and will be added in Editor in near future.

Also, in Editor you may create custom "..\PDF Editor\JavaScript\*.js" file with code that adds custom buttons into special 'Add-On' toolbar. Look for small example in attachment.

HTH.
You do not have the required permissions to view the files attached to this post.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
MoH2014
User
Posts: 3
Joined: Tue Dec 23, 2014 6:44 am

Re: Storing custom javascript functions?

Post by MoH2014 »

Thanks Vasyl,

Your reply was quite helpful.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19930
Joined: Mon Jan 12, 2009 8:07 am

Re: Storing custom javascript functions?

Post by Stefan - PDF-XChange »

Hello MoH2014,

Another "Print All" sample JS that will also create a button is available here:
https://forum.pdf-xchange.com/ ... 62&t=22821

Regards,
Stefan