For many years I have been using LPRng as my printer spooler. It is not the easiest one to use, but has a lot of features and is used in heavy-duty situations such as the main spoolers for University student printers.
In the early days, all printouts were simple ASCII text and all printers understood simple ASCII text, so there were no problems. Now printouts can be a number of forms, such as PDF, Postscript, png, jpg, tex plus many
others. Not only that, all printers have a different way of explaining how to print complex figures or graphics, or just even change the colour. A printing filter is the program that, say, converts the PDF command “now use red and write a line like this” into a language the printer itself understands. The filters have to also work out what thing is being sent to it; is that a PDF coming down the line or a Postscript file? Maybe it is nroff text?
The first filter I used was magicfilter. I then tried turboprint, which is non-free and also whatever lprngtool uses. I now use the foomatic scripts, which appear to be the most successful.
This document describes how I setup my LPRng program running on a Debian GNU/Linux system to talk to my Epson Stylus Color 600 that is attached to a networked print server (some Netgear thingy). The instructions should work for other distributions and of course with the exception of a different
You may also want to read another LPRng installation document too.
The general idea is to use the Foomatic program called foomatic-rip as the LPRng input filter. This filter will convert the incoming file into something my Epson understands correctly. Ideally, I just tell my system “print this” and it does it, without any further input.
The steps in setting the printing up are:
- Getting the right packages
- Finding your printer PPD
- Checking your ghostscript works
- Installing and customizing the PPD
- Change or create printcap file
Getting the right packages
There are some packages you will need, or are quite useful to have. I just
apt-get install ‘ed them and they all went in fine. Some of the files are
dependent on what printer you have and what drivers it will be using.
- The printer spooler. You could use other printer spoolers, but they are setup differently.
- This holds the printer filters. Most importantly,
it is the package with foomatic-rip.
- Ghostscript comes in a variety of flavours. I needed this
flavour because it had the output device I needed. Make sure you check you get t
he right one for you.
- Fonts for Ghostscript. Handy package to have.
- Converts ASCII text into postscript.
- Converts lots of things into postscript.
Finding your printer PPD
The PPD file is a Postscript Printer Description. It describes your printer to the postscript and ghostscript programs. You need to get this first before doing anything else because this will determine if your printer
is supported and also what other packages you might need.
Previously you could get the PPD from Linux Printing.org website. But they have changed things around so they are no longer available.
You have to get them out of the printer database, the problem is they are shipped in xml.
A program called foomatic-ppdfile is the magic gap filler between XML and ppd. It can be used to find what PPD to use and how to generate them. For example, I try to find my Epson Stylus Color 600, with
$ foomatic-ppdfile -P ‘Epson.*Color 600’
Epson Stylus Color 600 Id=’Epson-Stylus_Color_600′ Driver=’gimp-print’ Compatibl
eDrivers=’gutenprint-ijs.5.0 gimp-print omni stc600ih.upp stc600p.upp stc600pl.u
pp stcolor stp ‘
The Id= is used to extract the printer definition. Generally there are many drivers you can use for each printer, check the Linux printing website for details of each.
For my printer, the default driver is called gimp-print, but I don’t have that one. foomatic-ppdfile complains:
$ foomatic-ppdfile -p ‘Epson-Stylus_Color_600’ > /etc/lprng/Epson-Stylus_
There is neither a custom PPD file nor the driver database entry contains suffic
ient data to build a PPD file.
If you get that message, try another printer driver. gutenprint is the new name of gimp-print, so we can use that:
$ foomatic-ppdfile -d gutenprint-ijs.5.0 -p ‘Epson-Stylus_Color_600’ > /
Checking your ghostscript works
Debian ships various ghostscript interpreters. The question is which is
the right one for you? Most printer drivers will need either the Gimp-Print
driver but a lot of the HP printers will need the ijs driver. The trick
is to look at the PPD file. For example, my file has the following lines:
*FoomaticRIPCommandLine: “gs -q -dPARANOIDSAFER -dNOPAUSE -dBATCH -sDE&&
VICE=stp %A%Z -sOutputFile=- -”
The important thing is unfortunately line-wrapped but it is trying to say -sDEVI
CE=stp. This is your output device and may or may not be supported by your
version of ghostscript. Grep for it with the command.
gonzo$ gs -h | grep stp
uniprint xes cups ijs omni stp nullpage
You can see that we grepped for stp and there is a string showing
stp. If your ghostscript doesn’t show the right driver for you, try one of
the other ghostscripts (gs, gs-aladdin, gs-esp). Also be careful as gs is
an alternative and you might have the wrong one pointing in the alternatives
file. To check you can do the following:
gonzo$ gs -h | head -2
ESP Ghostscript 7.05.6 (2003-02-05)
Copyright (C) 2002 artofcode LLC, Benicia, CA. All rights reserved.
gonzo$ ls -l /usr/bin/gs
lrwxr-xr-x 1 root root &nb
sp; 20 May 2 2002 /usr/bin/gs -> /etc/alternatives/gs
gonzo$ ls -l /etc/alternatives/gs
lrwxrwxrwx 1 root root &nb
sp; 15 Aug 9 15:16 /etc/alternatives/gs -> /usr/bin/gs-esp
Installing and customizing the PPD
It doesn’t really matter where you put your PPD file. You just specify it
in the printcap so the foomatic-rip file can find it. I put mine in
/etc/lprng but it is really up to you where to put it.
I also needed to adjust my PPD. Like most of the world, I do not have
Letter sized paper but A4. The PPD uses the default of Letter and making
sure you remember to type “-Z PagerSize=A4” every time you print gets old
Fortunately it is easy to fix it. Find the two lines that start with
*DefaultPageSize: and *DefaultPageRegion: and change them both from Letter
to A4. I’m sure someone who understands Postscript (I don’t) can explain
why you need to change both but the printing complains if you only change one.
Also remember to change the permissions so the printer filter program can
read the file. I had it setup originally so it couldn’t and then wondered
why my filters thought they had a “Raw” printer.
Change or create printcap file
The printcap file will need to be created or changed so that it uses the
input filter (if= clause) of foomatic-rip. In turn the filter has to be
told it is run from LPRng and the location of the PPD file. The rest of
the information is the usual thing you would see for a remote printer.
epson600|Epson Stylus Color 600:
:filter_options= –lprng $Z /etc/lprng/Epson-Stylus_Color_600-gute
Foomatic has a special flag that spits out all the other flags you can use.
It’s a good test to see if everything is working ok. The command is just
gonzo$ echo x | lpr -Z docs
The file you try to print is irrelevant, just make sure it exists. You
should then get a few pages of documents showing all the flags you can use
to change the printing. The -Z docs flag means to print the documentation
of the driver rather than the file itself. The foomatic documentation talks
about using the demo file of /proc/cpuinfo but I get “nothing to print”
If you do not get some document with the title “Documentation for (printer
name) (printer driver)” then check the permissions of the PPD file and
also the printcap file. If all else fails, edit the file
/etc/foomatic/filter.conf and change the relevant line to filter: 1.
The debug will then be found in /tmp/foomatic-rip.log. Do not keep the
debugging on all the time as it is a security risk.
Central print servers and multiple queues
In another installation I had a HP OfficeJet 155 which was used by several
pc Linux clients. I wanted several “printers” depending if the user wanted
draft or colour. The -Z flags seemed a little too hard.
The idea is to have multiple printers on the central print server which then
bounces to a real print queue which spools off the jobs. Do not have all
the “printers” going directly to the real printer as it generally handles
The central printcap just adjusts what extra -Z options are appended and
then bounces the job to the real print queue which spools all jobs through
the filter and onto the printer.
hpoj155| HP OfficeJet D155xi remote printer
:filter_options= –lprng $Z /etc/foomatic/lpd/HP-OfficeJ
The print queues are now setup on the main server. Next is to make it
easier on the client pcs by setting up the queues and the aliases.
I called my queues hpoj155* so that if another printer comes along. It makes
big and confusing printer names so I created two lots of printer queues on
the clients. One with the printer name and one without. The first name
in the printcap is the one that is used by default.
:client:lp=%[email protected]:[email protected]
That way users can just print to -P colourduplex and it understands that
it should go to the hpoj155 queue and that the printout is in colour and
duplex mode. The user doesn’t need to know what magic -Z flags are
required for this to happen either. They are different for different
i cant share this link : https://enc.com.au/2007/08/lprngfoo
am i doing it wrong ?
Maybe put a trailing slash at the end? It looks ok to me by going to https://enc.com.au/2007/08/lprngfoo/