Configuring Printer Changes - PaperCutSoftware/PaperCutExamples GitHub Wiki

#Configuring Printer Changes

Set and get printer properties as follows:

server-command [get<or>set]-printer-property <print server> <printer name> [<value>]

IMPORTANT: The web services API (or server-commnand) will not validate the values you provide when setting properties. It is your responsibility to check they are correct.

List available printer properties

Here is a full list of available printer properties(Available properties for devices are [here Configuring-And-Applying-Device-Changes]).

Disabled

Boolean indicating whether or not the printer is enabled(True/False)

server-command set-printer-property laptop-alec fake_printer disabled true

Job count(Read only)

The total number of jobs the printer has processed

server-command get-printer-property laptop-alec fake_printer printer-stats.job-count

Page count(Read only)

The total number of pages the printer has printed

server-command get-printer-property laptop-alec fake_printer printer-stats.page-count

Printer ID(Read only, as of PaperCut MF/NG 18.3 and above)

The ID of the printer. Useful when using the PaperCut NG/MF System Health interface

server-command get-printer-property laptop-alec fake_printer printer-id

Custom fields

User-defined names that can represent any data that would find useful for printer management.

E.g: Asset number, lease period, device status, date of acquisition, last maintenance date, department ownership, etc.

server-command set-printer-property laptop-alec fake_printer custom-field-<1-6> "Asset Number: XXXX-XXX-XXX-XX"

Overriding user settings

Boolean indicating whether or not to override user settings for charging to a specified account.(TRUE/FALSE)

server-command set-printer-property laptop-alec fake_printer user-level-settings TRUE

Once enabled, you can opt to not show account popup and allocate the job to, either:

  • User's personal account
server-command set-printer-property laptop-alec fake_printer override-user-level-settings-charge-to "[personal]"
  • A single shared account
server-command set-printer-property laptop-alec fake_printer override-user-level-settings-charge-to "<Shared account name>"

E.g.

server-command set-printer-property laptop-alec fake_printer override-user-level-settings-charge-to "Physics"

NOTE: An exception will be thrown if the shared account cannot be found.

By default, the job is changed to the shared account. However you can charge these jobs to the user's personal account and allocate to shared account for reporting. (PERSONAL,SHARED)

 server-command set-printer-property laptop-alec fake_printer advanced-config.override-no-popup-shared-account-action "PERSONAL"

Watermarking

Boolean indicating whether or not watermarking is enabled. (Y/N)

server-command set-printer-property laptop-alec fake_printer advanced-config.watermark.enabled "Y"

The text displayed in the watermark.

server-command set-printer-property laptop-alec fake_printer advanced-config.watermark.text "Text in watermark"

The font size of the watermark text.(5,8,9,10,11,12,13,14)

server-command set-printer-property laptop-alec fake_printer advanced-config.watermark.font-size "12"

How dark the watermark text is.(BLACK,DARK,MEDIUM,LIGHT,OUTLINE)

server-command set-printer-property laptop-alec fake_printer advanced-config.watermark.gray-level "BLACK"

The position of the watermark.(TOP,BOTTOM,CROSS,CUSTOM)

server-command set-printer-property laptop-alec fake_printer advanced-config.watermark.position "BOTTOM"

NOTE: The following properties are only valid for advanced-config.watermark.position "CUSTOM"

Boolean indicating whether we want the horizontal(x-axis) position of the watermark from the left or the right of the page. Or whether we want the vertical(y-axis) position from the top or the bottom of the page. (Y/N)

Y = Bottom(y position)/Left(x position) N = Top(y position)/Right(x position)

server-command set-printer-property laptop-alec fake_printer advanced-config.watermark.position-overrride-<x<or>y> "Y"

Integer value indication how far from the x/y position to place the watermark(in millimeters)

server-command set-printer-property laptop-alec fake_printer advanced-config.watermark.position-direction-<x<or>y> "1000"

Print Archiving

Boolean indicating whether or not print archiving is enabled on the printer.(Y/N) NOTE: Check the global advanced config key archiving.enabled first.

server-command set-printer-property laptop-alec fake_printer advanced-config.archiving.enabled "Y"

Print Scripting

Boolean denoting if print scripting is enabled.(Y/N)

server-command set-printer-property laptop-alec fake_printer advanced-config.script.enabled "Y"

A string stating the reason why print scripting is disabled.

server-command set-printer-property laptop-alec fake_printer advanced-config.script.disabled-reason "Insert reason here"

You can also set the body of the print script.

There are a number of READ ONLY properties that are useful for error handling i.e:

server-command set-printer-property laptop-alec fake_printer advanced-config.script.body "function printScriptHook() {...}"

HINT: You can pipe the input of the file into this command

server-command set-printer-property laptop-alec fake_printer advanced-config.script.body $(<print-script.js)

The number of times the error occured.

server-command get-printer-property laptop-alec fake_printer advanced-config.script.error-count

The error description.

server-command get-printer-property laptop-alec fake_printer advanced-config.script.error-time

The time the error occured.

server-command get-printer-property laptop-alec fake_printer advanced-config.script.error-desc

Hide Document Names on Windows Printers

Change document names to [HIDDEN]. (Y/N)

server-command set-printer-property laptop-alec fake_printer advanced-config.queue-confidentiality-mode "Y"

Failure mode

Actions after the printer returns from an error state. i.e connection problems(PRINT_NEW_WITH_REPLAY, PRINT_NEW_NO_REPLAY or HOLD)

server-command set-printer-property laptop-alec fake_printer advanced-config.fail.action "PRINT_NEW_WITH_REPLAY"

NOTE: The following properties are only valid for advanced-config.fail.action "PRINT_NEW_WITH_REPLAY"

By default, after reconnection the job gets charged to User's personal account.

To Charge a shared account, you will need to get the shared account id

server-command get-shared-account-property <Shared account name> account-id

E.g.

server-command get-shared-account-property Physics account-id

And enter

 server-command set-printer-property laptop-alec fake_printer advanced-config.fail.reconnect.shared-acct-id <account id>

E.g.

 server-command set-printer-property laptop-alec fake_printer advanced-config.fail.reconnect.shared-acct-id 14015

By default, the job is changed to the shared account. However you can charge these jobs to the user's personal account and allocate to shared account for reporting. (PERSONAL,SHARED)

 server-command set-printer-property laptop-alec fake_printer advanced-config.fail.reconnect.charge-to "SHARED"

Furthermore, after reconnection, the job(by default) logs the job as The user reported by the print queue. You can override this value by specifying a particular user.

 server-command set-printer-property laptop-alec fake_printer advanced-config.fail.reconnect.log-user-name "ryanr"

To set back to The user reported by the print queue, you can use

server-command set-printer-property laptop-alec fake_printer advanced-config.fail.reconnect.log-user-mode "USER_FROM_PRINT_QUEUE"

NOTE: If your printer is a Virtual Queue, you need to override the recommended failure mode to use the above options. (Y/N)

 server-command set-printer-property laptop-alec fake_printer advanced-config.fail.virtual-queue.override "Y"

Hardware checking

Boolean indicating whether or not hardware checking is enabled.(Y/N)

 server-command set-printer-property laptop-alec fake_printer advanced-config.hw-check.enabled "Y"

Text values indicating whether or not to apply differences in cost.(DONT_ADJUST, ADJUST)

 server-command set-printer-property laptop-alec fake_printer advanced-config.hw-check.adjust-mode "ADJUST"

By default, Only apply cost adjustments that reduce the job cost (e.g. jobs canceled at the device) is enabled. To override this:

server-command set-printer-property laptop-alec fake_printer advanced-config.hw-check.auto-adjust.only-if-less "N"

There is a READ ONLY value you can use check if the hardware check has comppleted

server-command get-printer-property laptop-alec fake_printer advanced-config.hw-check.received

Email to Print

If Email to Print is enabled you can set the printer email address and the anonymous printing email address

server-command set-printer-property laptop-alec fake_printer advanced-config.email-printing.email "[email protected]"
server-command set-printer-property laptop-alec fake_printer advanced-config.email-printing.guest-email "[email protected]"

Cost adjustments

String that applies printer cost adjustments. Check here for how to define cost adjustments.

 server-command set-printer-property laptop-alec fake_printer advanced-config.charge-rates "Full:100%, ColorPaper:0.20pp, Binding:2.00pc, Postage:4.00pj"

Boolean indicating whether or not the user is required to select a cost adjustment. (Y/N)

  server-command set-printer-property laptop-alec fake_printer advanced-config.charge-rates.user-must-select "Y"

Filter

Boolean indicating if documents should be filtered by their document name.

  server-command set-printer-property laptop-alec fake_printer advanced-config.filter.docnames.active "Y"

Once enabled, you can specify blocking rules.

NOTE: To define individual filter patterns by assigning values to config keys advanced-config.filter.docnames.names.<n>, where n is the value "0" for the first filter, "1" for the second and so on.

To use a Regex, enclose the pattern in forward slashes. For example: /.*.pdf/

  server-command set-printer-property laptop-alec fake_printer advanced-config.filter.docnames.names.0 "/.*\.pdf/"

Miscellaneous

String representing the printer alias:

 server-command set-printer-property laptop-alec fake_printer advanced-config.alternate-id "Library Printer"

Boolean indicating whether or not the printer is unauthenticated.(Y/N)

 server-command set-printer-property laptop-alec fake_printer advanced-config.unauthenticated "Y"
⚠️ **GitHub.com Fallback** ⚠️