Knowledgebase: PaperCut > Scripting
Different Costing for Staff
on 15 August 2020 07:15 PM

So, you’ve got two distinct groups of users (e.g. Staff and Students) and you want to charge them at different rates. Keep reading and you may just find the answer.

While there is no “native” feature to charge Staff at a different rate to students built right into PaperCut, it can be achieved with the magic of print scripting, but we’ll get to that.

The first step is to create a new virtual print queue. Don’t worry, no one will print to this queue. We’re just going to use it as a reference for our Staff pricing.

  1. On the print server, create a new print queue in the Print Management Console. For this example, we’ll call it “Staff Prices”
  2. Set it up on the nul port with the PaperCut Global PostScript driver
    1. Creating a nul port:
  3. Once you can see the printer inside PaperCut go to the Charging tab for it
  4. Here set the costs that you want your Staff to be charged at
    1. You’ll want to do this for all paper sizes and options (greyscale, duplex etc)
    2. If you need more decimal places go-to Options>General>Display Options and check the box Change number of decimal places.

Ok, that’s the hard bit done, now comes the fun stuff, the print scripting. You’ll want to apply the script below to all print queues the Staff print to (look here for more info on creating a print script). If you just use a Find-Me queue for everything, then only it will need it.

function printJobHook(inputs, actions) {

  var StaffGroup = "Staff";
  var StaffPrinter = "Staff Prices";

  if (!inputs.job.isAnalysisComplete) {
    // Full job details are not yet available. Return and wait to be called again.

  if (inputs.user.isInGroup(StaffGroup)) {    
    var alternateCost = inputs.job.calculateCostForPrinter(StaffPrinter);
    actions.job.addComment("Staff discount applied");

Ok, let’s go through it. First of all, we’ll just use the standard print hook, as we don’t really care about shared account selection in this example.

After that, we define a couple of variables called StaffGroup and StaffPrinter, this should be pretty obvious, just make them equal to the name of the group that you want to receive this discount and the printer we set up before with alternate costing.

Then we check that the job analysis is complete. If it’s not, the script ends and tries again when it is.

Finally our if statement, this is where all the good stuff is. Here we check to make sure the user who printed this job is in the Staff group, and therefore should be charged at the alternate rate.

Then we calculate the cost of the job based on the costs of the Staff printer. That value then gets set as the costs for this job and a comment is added against the job in the job log so we can see that this job received a discount.