HOWTO Print from Linux at Rued Langgaards Vej

This HOWTO describes suggestions for making your life with the new ITU's printing system easier. It is written from Linux perspective, but I bet you can rely on that if you are using any other Unix clone (perhaps Mac OS X too).

1. Content

  1. Content
  2. General
  3. Printing with LPRNG
  4. Printing with CUPS
  5. Printing from opennet, out-of-house, etc

2. General

If you are having problems not getting duplex print in spite of setting duplex options, try converting your input into a PostScript file filename.ps, clean it using ps2ps filename.ps filename-clean.ps, and then submit filename-clean.ps to the printing system.

3. Printing with LPRNG

We have established that only the simplest functionality is available if you use LPRNG (AKA lpd). Being in house you can print using:

lpr -Pprint@printsrv.itu.dk filename.ps

or

lpr -Pcolourprint@printsrv.itu.dk filename.ps

This gets forwarded to a Windows based lpd server and after some more magic you get it printed on the b&w or colour printer of your choice.

You can improve it slightly by exporting a default queue in the environment (bash code):

export PRINTER=print@printsrv.itu.dk

Then you do not need to give the -P option anymore. You can also grab the newest printcap from sysadm's website (section FAQ/Linux) and place it over your own printcap in /etc/, /etc/lprng/ or whatever is the default destination in your distribution. This will define "print" and "colourprint" as local queues, and eliminate the need for giving server names in -P.

It does not get better than that though. In particular none of the known options for double-sided printing seems to have any effect.

4. Printing with CUPS

A preferred way to print from Unix-clones at ITU is by using cups. You should be able to get cups for your distribution of Linux, as it has recently been made default by all major vendors.

3.1 Configuring CUPS

To configure CUPS you will need the following PostScript Printer Driver (PPD) files:

Print queuePrinter modelsPPD file
printIR 2220 / IR 3320 (most common) cnir23u1.ppd.gz
IR 5020i (in the Copying Centre) cnir50u1.ppd.gz
GP405 (in Section {2,3,4}D) efmc7011.ppd.gz
GP605 (in Section {2,3,4}D) efmc6b20.ppd.gz
colorprint CLC 3220 (in the Copying Centre & 3A38)
(they are fitted with a 2-Cassette Feeding Unit and a Saddle Finisher N2)
cnrc322u1.ppd.gz
??? HP DesignJet 800ps (in the Copying Centre & 3A38) hp5042c1.ppd.gz

You should place the appropriate file(s) in the CUPS printer model directory, e.g. /usr/share/cups/model/.

3.1.1 Configure with web-interface

[distribution-independent, Fedora and Debian users read also below]

After installing cups and making sure that it is running (for example as root do /etc/init.d/cupsd restart), go to the web interface to configure the printers. Point your browser to http://localhost:631 and log in as root, when asked for user and password.

In the web interface choose Printers (a button on the top menu bar) and then Add printer. Choose the name of the print queue (most people would prefer to use print as a name). The location and description is less relevant (you can print on any printer in house with the new printing "solution"). Press continue and choose LPD/LPR Host or Printer and continue. Despite using CUPS you will still be communicating with an LPD server.

DEVICE URI for the new print queue (black and white) is lpd://printsrv.itu.dk/print. Continue to choose Canon as make and Canon iR2220-iR3320 as model.

You may want to tweak printer options after setting it up (for instance turn on stapling and duplex to be default).

WARNING: Sometimes cups disables print queues silently. This happens for instance when you print while being offline. Print queues do not seem to be enabled automatically. The result is that documents are staying on your local cups queue and are not forwarded to the ITU's printing system. To enable the print queue, turn root and say lpadmin -p print -E. This will also cause all documents in the current queue to be flushed for printing.

3.1.2 Configure with command line tools

[distribution-independent, Fedora and Debian users read also below]

If you, like me, dislike web interfaces, here is the above sequence realized using CUPS command line interface:

lpadmin -p print -E -P /usr/share/cups/model/cnir23u1.ppd -v lpd://printsrv.itu.dk/print

Increase the security slightly, by restricting the queue access to your own user:

lpadmin -p print -u allow:username

If for some reason the lpadmin command is not in your executable path, then try /usr/sbin/lpadmin instead.

3.1.3 Fedora

If you use the printconf tool (aka. system-config-printer) to configure your printer queues, you must first unzip the appropriate PPD file(s), then click Action->Import PPD... to import them. Then you can use printconf as usual.

Only if you do not use printconf should you use CUPS directly to install and configure your printer queues, as printconf otherwise will overwrite any changes. Configuring directly using CUPS is done by pointing your browser at http://localhost:631/.

3.1.4 Debian

On Debian one can apt-get install cupsys* and apt-get install cupsys-bsd (if you prefer the BSD-style lpr command-set) or apt-get install cupsys-client (if you prefer the old lp command-set).

You can then setup your printers using the web interface mentioned above, using lpadmin, or if, like me, you are too lazy to read the manual pages do a apt-get install gnome-cups-manager and use gnome-cups-manager for easy installation. Remember to restart your CUPS daemon after you have installed the PPD files above (/etc/init.d/cupsys restart) and before you run gnome-cups-manager as the tool will otherwise not recognize the printer correctly..

It should be possibly to get your printers working without running the CUPS daemon (in the cupsys package), but I have had no success with that yet (though, to be honest, I have only made very superficial experiments).

* of course you should rather use something like aptitude but that is another story altogether.

On Debian the init-script is named /etc/init.d/cupsys. On Debian the commands that enables and disables printing (for example, after you have been offline) are called cupsenable and cupsdisable.

3.2 Print options using CUPS

When the printer queue(s) are installed, you can issue options to lpr from the command line.

An entire and hard-to-read list of options for a queue print can be obtained by

lpoptions -p print -l

However, the most useful options are probably the following:

You can set your favorite default settings using printconf (or CUPS), or by using the lpoptions command like this:

lpoptions -p print -o sides=two-sided-long-edge -o Staple=1PLU

Tip: If you find some of the options do not seem to take effect when printing a Postscript file, try "cleaning" the file first by putting it through ps2ps.

5. Printing from opennet, out-of-house, etc

Fortunately for all of us, it seems that ssh.itu.dk is running a configured copy of cups and is able to print to standard queues (on ssh they seem to be named print (for black & white) and colour (for colour). Unfortunately, it also seems that the printer drivers are generic, reducing the number of options available.

However, all this means that you can copy your document to the server and print it from there. This works even if you are on opennet (which blocks printing protocols) or out of the house (but this is not very useful with the new system anyway).

I have succeeded printing double sided with:

scp filename.ps ssh.itu.dk:
ssh ssh.itu.dk
lpr -Pprint -o sides=two-sided-long-edge filename.ps

Omit the -o option, if you dislike duplex. It is likely that with cups we will be able to control other functionalities of this new slick printing-and-not-only machines. Watch this space for news (or extend it).

You can make it more streamlined by wrapping the 3 steps in a single script. You can even call it lpr and avoid installing cups at all (but some clever applications make break on that). This is my script:

#!/bin/sh
cat $1 | ssh ssh.itu.dk "lpr -Pprint -o sides=two-sided-long-edge $2 $3 $4 $5 $6 $7 $8 $9"

Then you just need to write lpr filename.ps. You can avoid being asked for the password each time, if you configure authenthication for ssh. A HOWTO is available in CVS note from ssyadm.

A similar script can wrap lpq, but querying the queues seems to be somewhat unstable now (works only sometimes).

Back to the PLT site.

Last updated Tuesday 5 August 2008 by Arne John Glenstrup