meta data for this page
  •  

This is an old revision of the document!


Back to the #itlab main page

Printers and PPD files

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:

http://mediaserver.it.lut.fi/media/linux/Xrn4025p.ppd

Install the printer with command:

lpadmin -p xerox6531 -v socket:157.24.24.70:9100/ -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 <tt>enable</tt> command is with full path because <tt>enable</tt> is also a Bash builtin command. In newer installations of CUPS the command may be named <tt>cupsenable</tt>. To see what kind of options your new printer may offer, try: lpoptions -p xerox6531 -l ===== Two pages on one ===== Find and install package <tt>psutils</tt> to get <tt>psnup</tt>. psnup -2 docu.ps new_docu.ps ===== 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 file.ps For the other way: lpr -Pxerox6531 -o sides=two-sided-short-edge file.ps NOTE: It has been noticed that some Postscript files refuse to print as duplex and running through <tt>ps2ps</tt> seems to help. It is recommended to run everything, that is not produced through Ghostscript, through <tt>ps2ps</tt>. ==== 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 <tt>ps2ps</tt» ps2ps file.ps file2.ps Then, reorganize the pages to form a book: psbook -q file2.ps file3.ps Let's put two pages on one sheet, that is, make an A5 book: psnup -2 file3.ps file4.ps Print the file in duplex: lpr -Pxerox6531 -o sides=two-sided-short-edge file4.ps ===== Prettyprinting code files ===== If you put the following Bash script snippet into your e.g. <tt>~/.bashrc</tt>, you get the command <tt>m2ps</tt>, that makes PostScript from your text (code) files. <code> function m2ps { while "$1" ; do enscript –ps-level=1 -r –word-wrap -2 -C -G -j “$1” -o “$1.ps” shift done } <\/code> 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 <tt>.ps</tt>.