Back to the #itlab main page

Printers and PPD files

The old Xerox printer at 6531 (not the copier)

  • setting A3 paper size: lpoptions -p xerox6531 -o PageRegion=A3 -o InputSlot=Tray2

HP Color Laser outside

Installing with CUPS

You might already know the http://localhost:631 web configuration interface, but there are also command line tools. Let's install the old Xerox printer located in the copy room 6531.

Get root. Go get the PPD file and save it somewhere:

Unpack zip file and install the printer with command:

 lpadmin -p xerox6531 -v socket:// -D "the old xerox" -L "mail room 6531" -P Xrn4025p.ppd

You can check your available printers as a user with:

lpstat -t

If it says your new printer is rejecting jobs and/or disabled, the following commands should be of help (as root):

/usr/bin/enable xerox6531
accept xerox6531

The enable command is with full path because enable is also a Bash builtin command. In newer installations of CUPS the command may be named cupsenable.

To see what kind of options your new printer may offer, try:

lpoptions -p xerox6531 -l

Two pages on one

Find and install package psutils to get psnup.

psnup -2

Duplex printing

At least the Xerox in the mail room can print duplex. For the “normal” way:

lpr -Pxerox6531 -o sides=two-sided-long-edge

For the other way:

lpr -Pxerox6531 -o sides=two-sided-short-edge

NOTE: It has been noticed that some Postscript files refuse to print as duplex and running through ps2ps seems to help. It is recommended to run everything, that is not produced through Ghostscript, through ps2ps.

An example

You have a PDF where you want to nicely print selected pages. Open the PDF in Acrobat reader and print the wanted pages into a Postscript file. The file will likely “compress” if you run it through ps2ps>


Then, reorganize the pages to form a book:

psbook -q

Let's put two pages on one sheet, that is, make an A5 book:

psnup -2

Print the file in duplex:

lpr -Pxerox6531 -o sides=two-sided-short-edge

Prettyprinting code files

If you put the following Bash script snippet into your e.g. ~/.bashrc, you get the command m2ps, that makes PostScript from your text (code) files.

function m2ps {
        while [ "$1" ]; do
                enscript --ps-level=1 -r --word-wrap -2 -C -G -j "$1" -o "$"

The print is landscape, two-column, with line numbers, long lines word-wrapped, fancy header and borders drawn. The command can handle multiple files at one invocation and output file name is input file name appended with .ps.