Choose your language

Choose your login

Support

How to Deal with Auto-Rotate on Plotters and Wide-Format printers

THE PAGE APPLIES TO:

PaperCut has a wide range of supported printers, ranging from entry level 6ppm inkjets to 100+ppm enterprise photocopiers. We also support many plotters and wide-format printers with our advanced charging.

However, many newer wide-format printers have the ability to auto-rotate once the print job has been sent to the printer. This means that when charging “by length” that users may not be charged the correct amount.

By using PaperCut’s Advanced Printer Scripting, you can override this behaviour with the following script which will charge based on some simple decisions about whether the print job is longer than wide and whether auto-rotate can still happen.

Note: This script requires testing in your environment as some print drivers will rotate the page, others will rotate the image (raster). Drivers that rotate the image but not the page may not be detected accurately. If this is the case in your environment we would recommend charging per-area rather than per-length. Our developers are looking into how to detect image auto-rotation.

/*
* Charge based on short length for Auto-Rotating printers.
*
* Some wide-format printers will auto-rotate print jobs
* to save paper. This script will charge based on short
* edge if the long edge is less than a defined length.
*/

function printJobHook(inputs, actions) {

/*

  • This print hook will need access to all job details
  • so return if full job analysis is not yet complete.
  • The only job details that are available before analysis
  • are metadata such as username, printer name, and date.
  • See reference documentation for full explanation. */ if (!inputs.job.isAnalysisComplete) { // No job details yet so return. return; }

var ROLLWIDTH = 914; // 36" in mm.
var COSTPM = 3.28; // Cost per meter

// Now find long edge and short edge var LONGEDGE = max(inputs.job.paperSizeHeightMM, inputs.job.paperSizeWidthMM); var SHORTEDGE = min(inputs.job.paperSizeHeightMM, inputs.job.paperSizeWidthMM);

// if the long edge is more than the roll width, assume auto-rotate if (LONGEDGE > ROLLWIDTH) { var PAPERUSED = LONGEDGE; } else { // assume long edge fits across roll, charge by short edge var PAPERUSED = SHORTEDGE; } actions.job.setCost(PAPERUSED * (COSTPM / 1000) * inputs.job.totalPages * inputs.job.copies);
}

“max” is not defined.

If you receive the following error: Error in "printJobHook" - ReferenceError: "max" is not defined. (printer-script#28)

Change max(...); to Math.max(...); and min(...); to Math.min(...);. This is case-sensitive.

Accounting for Copies and Pages - Early 2015

The original script did not account properly for jobs that had multiple copies or pages. This has been updated by modifying the following line:

actions.job.setCost(PAPERUSED * (COSTPM / 1000));

It now reads

actions.job.setCost(PAPERUSED * (COSTPM / 1000) * inputs.job.totalPages * inputs.job.copies);

Note: The script, can only base it’s costing on the size of the first page, and will apply that cost to all subsequent pages.


Categories: How-to Articles , Print Queues


Keywords: dealing with auto rotate , banner landscape portrait , plotter

Comments

Last updated June 13, 2024