Advanced Scripting

Brother MFD Embedded
March 12, 2015
If you require more power than PaperCut's in-built filters and restrictions you can leverage Advanced Scripting. To make it easy to get started, advanced scripting comes with dozens of pre-written recipes. Looking at these is a great way to understand their power. Examples include:
  • Display a popup message if a user forgets to select duplex on large jobs.
  • Show a dialog displaying environmental impact statistics about their job, such as, the amount of carbon dioxide equivalent greenhouse gases produced.
  • Prompt the user to confirm large jobs before printing.
  • Automatically route large jobs to more efficient high volume printers.
  • Giving discounts during off-peak times.
  • Least-cost routing - suggesting a more cost effective printer.
  • And much more...

How Easy Is It To Write A Script?

Considerable effort has been made to make life easier to write a script. The scripting language used is the most popular scripting language, JavaScript. To get started we have provided over 20 complete best practice recipes to import and over 30 code snippets to use in your own scripts.
To modify scripts an inbuilt JavaScript editor is provided with syntax highlighting and clear error reporting if your script contains an error.

Powerful!

The power of scripts is nearly limitless with the number of input variables and possible actions provided. We know that only geeks would read this far down on a page about advanced scripting, so here's a diagram for you:
Check out the manual for full API reference documentation and tips on how to write your own print scripts.

Do you have an idea for a script? Take a few moments to hit the Share button in the application and let us know about it!

Standard Recipies (Example Scripts)

Here is a summary of some of the pre-built best practice recipes (examples) included:

Color print jobs require user confirmation

Color printing is expensive so users should be encouraged to print in grayscale whenever they print in color. No confirmation is required for grayscale jobs.

Print Policy Enforcement

Enforce a company/corporate print policy designed to reduce toner and save paper by discouraging bad habits. The policy script reminds users to print double-sided and not print emails and web pages in color. This recipe also demonstrates advanced HTML dialog layout.

"Go Green" with environmental warnings

If a user attempts to print a large job, educate them with the organization's "Go Green" initiative. The message displayed adapts to the job's duplex setting.

Confirm jobs with a high number of pages

Users printing jobs with many pages are asked via the client tool whether they meant to print such a large document, giving them the opportunity to cancel. This can be useful for users who forget to enter a page range when printing and instead send the whole document.

Offer to convert jobs with a high number of pages to duplex

When jobs with a high number of pages are printed (e.g. >50), users will be asked via the client tool if they would like their job converted to duplex, thereby saving paper. Users who are not running the client tool will have their jobs printed without any changes.

Route the job to the cheapest compatible printer (least-cost routing)

An organization has a fleet of compatible printers, each with different operating costs. This recipe calculates the cost of the job on the candidate printers and redirects the job to the cheapest with the user's confirmation.

Convert jobs with a high number of color pages to grayscale (or cancel)

Users may accidentally (or without thinking) print multi-page documents with many color pages. When printing jobs with a high number of colour pages (e.g. >20), users will be given a choice to either convert their job to grayscale or cancel it. Users who are not running the client software will have their jobs canceled automatically.

Redirect color jobs to black & white printer with confirmation

Color printing is expensive so users should be encouraged to print in grayscale. When a job is color prompt the user to send the job to a grayscale print queue. Please note: This script does not change the job to grayscale the job may still print in color on color printers.

Redirect large jobs with confirmation

A user printing a large job is requested to redirect the job to a printer dedicated for large batch printing. Users will be asked to confirm the redirection via the client software.

Redirect large jobs without confirmation

Users printing jobs larger than the defined number of pages have their jobs automatically redirected to another printer. This can be used to redirect large jobs from slower or high cost printers to more efficient or faster high volume printers.

Cancel large print jobs sent by students

Members of the Students group are only allowed to print up to 100 pages. Jobs larger than this will be canceled with a notification. This recipe demonstrates group-level restrictions.

Charge printing during class time to the department

Members of the Students group get free printing to engineering lab printers during lab time (9:00am to 11:00am weekdays).

Free printing during class time

Members of the Students group get free printing to science lab printers during lab time (2:00pm to 5:00pm Mondays).

Inform user when printer is in error

If a user sends a print job to a printer that is in error (e.g. offline, paper jam, out of paper) they will be informed via the client tool and given the opportunity to cancel and print to another printer.

Discounted printing for large print jobs

Reduce the cost per page when print jobs are larger than 100 pages. Any pages above 100 are charged at a 50% discount.

Discount printing during off-peak

Encourage users to print during periods of low activity by offering a discount of 25% during the period before 8:00am and after 6:00pm.

Discount for staff

Staff are charged less for printing than other users. This recipe also demonstrates the use of debug logging.

Confirm printing emails in color (from Outlook)

Implement an organization wide policy to discourage printing of emails in color. Users printing emails in color will be informed via the client software of the policy and they will need to confirm their action.

Convert all email printing to grayscale

Implement an organization wide policy that no emails should be printed in color. Often emails contain color in links or headers that adds no value. This script automatically converts all emails (printed from Outlook) to grayscale.

Confirm printing of emails (from Outlook)

Implement an organization wide policy to discourage printing of emails. Users printing emails will be informed via the client software of the policy and the print job's environmental impact. Users will need to confirm their action.

Hold color jobs in a release queue

Color printing is expensive so users should be encouraged to print in grayscale. When a job is color the job is held in a release queue and the user it notified. They must then release the job from one of the release station interfaces. Grayscale jobs print as normal.

Hold jobs in a release queue during peak times

During peak hours printers can get very busy. When many users are printing sometimes people pickup other peoples print job resulting in frustration and waste. This recipe enables the hold/release queue during the peak hours of 9:00am to 6:00pm weekdays. When printing at off-peak times, users are not inconvenienced by using a hold/release queue.

Ask the user if the job should be held in a release queue

Hold/release queues allow private and confidential documents to be held and only released when the user has confirmed that they are physically at the device (e.g. authenticated at a release station). Holding all jobs may be a burden on users. This script asks the user if a job is confidential and will only hold these jobs.

Require approval code

Users are required to enter a valid approval code to print their job. Approval codes are pre-defined and known only by privileged users, e.g. teachers. Users who do not enter a valid approval code will have their jobs canceled.

Bypass Hold/Release Queue for selected users

Selected users print very large batch jobs and it's frustrating to have to attend the printer twice: once for release and then again later to collect the job. Selected users will be given the option to print direct bypassing the Hold/Release queue.

Prompt for comment

The user is prompted via the a client popup to enter a comment about their print job. This could be used to describe what is being printed or provide a justification for printing.

Copyright and attribution sampling and tracking

Sample of a percentage of all jobs printed between a given period checking copyright and attribution. Users are prompted via the client software to see whether someone else holds the copyright to the job they are printing. If so, they are prompted to attribute the work via title and author. This is then recorded in the database so it can be extracted into Microsoft Excel via the CSV Print Job Log export report (stored in Comment field).

Add a watermark on pages printed a group of users (students but not staff)

Adds the date, time and name of the user to the bottom of all pages printed by students. This is done by checking if the user is a member of the defined students group. Watermarking is disabled for staff (users not in the student group).

Prompt for security classification

The user is prompted via the a client software popup for the document's security classification. The classification is then associated with the job as a comment for reference and reporting.

Restrict jobs to a subnet

Jobs sent from workstations in a specified subnet are allowed, other jobs are canceled. This script demonstrates network level restrictions.

Send email alert on disallowed printer access

IT Department is protective of their new printer and they are keen to catch any non-IT staff using it. If anyone outside of IT is found using the printer, the job should be denied and the IT staff alerted via email of the attempted use.

Trap and warn users if they print known problem documents

Some organizations have known problem documents such as large spreadsheets that if accidentally printed will print thousands of pages. This recipe will check for a known problem document and alert the user and ask them to confirm their actions.

Discounted printing for selected shared account

When printing is charged to a selected shared account (e.g. a school fund-raising group) a discount is applied to the job cost. This also demonstrates the use of the "post account selection hook".

Change personal accounts available for printing

When using a printer that belongs to the "Science Faculty", users can only use credit from their "Science Quotas" or "Cash" accounts. Users cannot use other faculty quotas on these printers.

This also demonstrates the use of printer groups to simplify script maintenance.

Daily color page limit

This recipe imposes a fixed limit on the number of color pages a user can print per day. A color page quota is a better solution than separate balances for color and black & white. Separate balances are more confusing (two accounts to manage), and also can lead to waste, as users with no black & white credit remaining will simply revert to color printing.

Prevent overuse of lab printers (rate limiting)

By placing a reasonable rate limit on printers during lab times (a rate large enough to support printing of lab work only), you'll ensure the resource is available to all students.

Reward regular use of grayscale/duplex

It's always a good idea to reward good behavior. This recipe help you implement a campaign to discourage color printing and encourage the use of duplex (double-sided) printing. It will track a users usage and if they hit the target of 10 continuous days of printing without using any color and/or duplex will be rewarded.