Can you use PaperCut’s Print Scripting with Mobility Print? Of course! From PaperCut v19.0 we have made it even easier to start using Mobility Print in tandem with PaperCut’s versatile Print Scripting utility. Below we explain how to do it and provide a sample script to get you started.
Info The only “gotcha” is that some print scripts require that end users run the PaperCut Client on their workstations or devices. While there are versions of the client for MacOS and Windows, there is no installable version of the PaperCut Client for Chrome, Android, or iOS. As a result, it will be necessary to craft the script to ignore print jobs from these devices, use email alerts in the Print Script instead, or instruct users to access the Mobile Web Client. Suppress the Account Selection Popup with Mobility Print We have a new API isMobilityPrintJob, available in PaperCut 19.0 and above, which makes it simple to identify the mobility print jobs. Use the example script below to automatically charge to the user’s personal account (instead of showing an account selection popup) when a job comes from any Mobility Print source.
function printJobHook(inputs, actions) { // Automatically charge all Mobility Print jobs to a users personal account if (inputs.job.isMobilityPrintJob){ actions.job.chargeToPersonalAccount(); } } Alternative method pre PaperCut v19.0 Prior to PaperCut v19.0, a couple of extra steps are needed to get you up and running. Below we explain the steps to take and provide a sample script to get you started.
Enable the Document Name Prefix Before starting, you will need to follow these steps so that PaperCut can identify which jobs are from Mobility Print.
On your Mobility Print server, navigate to [app-directory]/PaperCut Mobility Print/data/config. In Windows, this path will be C:\Program Files (x86)\PaperCut Mobility Print\data\config\. Open the file mobility-print-conf.toml in a text editor and add this line EnableDocumentNamePrefix = true. Save the document. Finally restart the Mobility Print service for the changes to take effect. Now any jobs submitted via Mobility Print the document name will be prefixed with (mp:) where source is one of iOS, macOS, windows, android, chrome or unknown. Administrators can use this value in their scripts to extract client type.
Example Script Suppress the Account Selection Popup with Mobility Print Use the example script below to automatically charge to the user’s personal account (instead of showing an account selection popup) when a job comes from any Mobility Print source. Remove 'mp:macOS' and 'mp:windows' if these devices are actually running the PaperCut Client.
function printJobHook(inputs, actions) { // Hold the job until analysis is complete if (!inputs.job.isAnalysisComplete) { actions.job.chargeToPersonalAccount(); return; } // Automatically charge all Mobility Print jobs to a users personal account var MOBILITY = [ 'mp:iOS', 'mp:macOS', 'mp:windows', 'mp:chrome', 'mp:android']; if (matchesAny(inputs.job.documentName, MOBILITY)){ actions.job.chargeToPersonalAccount(); } } // Define the matchesAny function function matchesAny(str, matchStrs, actions) { if (str == null || matchStrs == null) { return false; } for (var i in matchStrs) { if (str.match(matchStrs[i])) { return true; } } return false; } Still have questions? Let us know! We’re definitely happy to chat about what’s going on under the hood. Feel free to leave a comment below if you have any questions at all or visit our Support Portal for further assistance.
For more information about Mobility Print, check out the Mobility Print Help Center.
Comments
0 comments
Please sign in to leave a comment.