- To setup the reader to a more suitable state, specific to the document being opened needs.
- To change document contents in response to some events. For example, to hide part of document before printing or pre-fill some form fields when document is opened.
- To restrict actions of the reader. For example, to validate entered form field values.
- Document events. Scripts invoked by the document opened, document will close, document will save, document saved, document will print and document printed events.
- Page opened and page closed events.
The following screenshot displays the GUI of the tool.
The left scripts list panel groups the JS actions by type. It contains a tab selector for the document level scripts, the document event JS actions and the page events JS actions. When operating in single file mode, and only if the document has related JS actions, it shows a tab selector for screen annotations and interactive form fields.
To change an already existent script there is only the need to select it, from its type group tab, and use the, at right, text editor to edit it. The top right toolbar script name field can be used to change the name of document level scripts.
Each of the tab selectors has a toolbar with buttons to create a new script and to delete the selected one. When the new script button is clicked it opens a settings sub-panel where there are options to define the JS action characteristics, such as the event that will fire it and/or to what document page it will be added.
Even in single file mode, changes are not immediately applied to the document. The bottom left preview button is used to temporally apply the changes and automatically open the default PDF reader, in order to see how the scripts are working. The run button is used to definitively apply the changes, and the cancel button can be used anytime to exit the tool without applying any changes.
|Options:|| means optional parameter|
|Template=||- Full path to a document JS template file, previously defined and saved to a template file from the tool GUI.|
|[OutputPath=]||- Full path where to put the edited files. If not specified, the file source path is used instead.|
|[-CreateBackup]||- If specified, creates a backup of the PDF file.|
|[-s]||- Silent mode. Run without showing the interface (only available for licensed users)|
|FilesList||- List of PDF files to process with the SetDocumentJS function. Separate files using the semicolon";" char. Must be the last parameter|
"C:\Program Files\PDF-ShellTools\PDFShellTools.exe" SetDocumentJS OutputPath=C:\PDFs\JSApplied Template=c:\JSTemplates\JSTemplate.jst C:\PDFs\*.pdf