User Tools

Site Tools


printer_with_options

Under workstations we also define the default printer with printer name and the Linux command to be executed.

Example:

Printer Command
myPrinter lpr -P myPrinter

Using the -o option of the lpr command you can pass various options to the printer. If you have a printer which is configured to normally print double-sided then you want to use this command:

Printer Command
myPrinter lpr -P myPrinter -o sides=one-sided

The program will save this option but when reading it ends up like lpr -P myPrinter -o sides

The reason is that the default printer is saved as MyPrinter=lpr -P myPrinter -o sides=one-sided and after reading this line the program splits the string at the '=' sign into printer name (left side) and printer command (right side). As we have now two equal signs in the string '=one-sided' get's dropped.

Solution

Define a basic shell script containing the printer command.

Example:

#!/bin/sh
# printer wrapper file for ledger
`lpr -P myPrinter -o sides=one-sided $1`
exitcode=$?
exit $?

Save the file as myprinter.sh, make sure that it is executable (chmod ugoa+x myprinter.sh) and define the filename as printer command in the system.

printer_with_options.txt · Last modified: 2015/04/24 02:39 by bep