Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save henri/9123dbcd0a3d5332303a4edd1c30a2e1 to your computer and use it in GitHub Desktop.
Save henri/9123dbcd0a3d5332303a4edd1c30a2e1 to your computer and use it in GitHub Desktop.
PaperCut Reject Jobs Not Redirected From Another Print Queue - PaperCut Application Server Printer Scripting
//
// Rejects Jobs Sent Directly, Redirected Jobs from other queues (eg. redirected from Find Me / Follow Me print queues will print as this script will not run on redirected jobs).
// Copyright Henri Shustak
// Licence : MIT <https://mit-license.org>
//
function printJobHook(inputs, actions) {
var username = inputs.job.username;
var printername = inputs.job.printerName;
var client_ip_address = inputs.job.clientIP;
var job_canceled_log_message = "Job Cancled! Job was not sent via XYZ Queue - " + username + " - " + printername + " - " + client_ip_address ;
var job_canceled_message_to_user_options = {"dialogTitle" : "Print Job Canceled", "hideJobDetails" : true, "dialogDesc" : "<HTML><H3>Please contact IT Support.</H3></HTML>"};
var job_canceled_message_to_user = "<html>Please contact IT support for installation of the print queues onto your computer. You may also <a href='http://my.domain.com/printqueues_installer.dmg'>download and install yourself</a>.</html>";
// add comment to job history
actions.job.cancelAndLog(job_canceled_log_message);
// log to papercut log
actions.log.info(job_canceled_log_message)
// message user client
actions.client.promptOK(job_canceled_message_to_user, job_canceled_message_to_user_options);
}
@henri
Copy link
Author

henri commented Aug 3, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment