Creating your common print script
To create your common script file, you will need to create a new file in Notepad++ or something similar, and save it with the name of print-script-common.js to the [app-path]\server\custom directory on your PaperCut Application Server.
Each script you will be creating is going to be added to the print-script-common.js file. When creating your common scripts, it is always best to first create the script on a physical printer queue, testing all variables of the script and ensuring it is working as intended. Once your script is working and you are happy with how it’s running, you can edit the print-script-common.js file in Notepad++ and add the function to the end of the file.
There is one change that will need to be made for each function you are creating. When adding it to your common print script file, you will need to change the function name to something unique and memorable. Below is a function created for duplex and grayscale to be set for a certain group, you can see I’ve named this function something easy to remember.
To call this function in the printer script, you can see in the below picture that I added a line below my function, which will check the print-script-common.js script for any functions named this. Please note that any functions in your print script can not be named the same as a function you’ve already named in the print-script-common.js file.
It is best to test your common print script is working before deploying out to a live printer queue.
Please note that if there is a functionality error in your print-script-common.js, a warning will be shown on all print script windows, including scripts not calling the common script file. This is to ensure you see any errors for these common print scripts and can remedy the warning.