8
Filter scripts used by the printer spoolers to convert the incoming
9
PostScript data into the printer's native format using a
10
printer/driver specific, but spooler-independent PPD file.
12
Till Kamppeter <till.kamppeter@gmail.com>
13
Lars Uebernickel <larsuebernickel@gmx.de>
15
http://www.openprinting.org/
17
This usage documentation file is written by Till Kamppeter
23
Foomatic is a database providing information about the usage of
24
printers with Unix-like operating systems (Linux, Solaris, ...).
26
The applications of these operating systems send PostScript or PDF to
27
the printer queues. Therefore one usually hands over the PostScript
28
directly to a PostScript printer (sometimes with some inserted
29
PostScript commands for options) or uses Ghostscript for generating
30
the data format the printer needs from PostScript or PDF input. This
31
is done by the printer spooler which also stores the data in a spool
32
directory when the printer is still occupied by another job, transmits
33
the data to a print server in the network, and so on.
35
The printer drivers for non-PostScript printers are either compiled
36
into Ghostscript, a plug-in for Ghostscript (e. g. IJS drivers), or
37
they are an extra filter which converts a generic bitmap generated by
38
Ghostscript into the printer's data format. For this the spooler has
39
to call complicated command lines of Ghostscript and the extra filter
40
(if needed). The user of a Unix-like operating system normally does
41
not see these command lines because an installation program takes
42
appropriate filter scripts and/or description files from a database
43
and assigns them to the printer queue.
45
Widely used databases were the RHS-Printfilters and the APS
46
filters. Their disadvantages were that they only supported one spooler
47
(LPD/LPRng) and only a small part of the driver's options (mostly page
48
size and resolution). Foomatic supports all options of the drivers and
49
all known spoolers (LPD, LPRng, GNUlpr, CUPS, Solaris LP, PPR, PDQ,
50
CPS, direct spooler-less printing). In addition, all known free
51
software printer drivers are supported. Foomatic also supports
52
printing of various non-PostScript/PDF file types for spoolers which
53
do not support these by themselves (LPD, LPRng, GNUlpr, spooler-less
54
printing). To enable this feature you need to have "a2ps", "enscript",
57
Another problem is that the way how to install queues, to print files,
58
and to handle jobs is very different with different spoolers. LPD for
59
example requires editing of configuration files for adding a queue,
60
whereas CUPS and PPR have specialized command line utilities. Foomatic
61
puts a layer between the applications and the spoolers so that one has
62
a common, spooler-independent command line interface for all spoolers,
63
so that switching of spoolers or administration of a network with
64
different spoolers gets much easier, because for the same operations
65
there are the same commands, independent of the spooler.
67
This command line interface can also be used as a base for
68
spooler-independent graphical frontends.
74
Foomatic runs on all systems where one can run the Perl
75
interpreter and Ghostscript.
77
foomatic-filters needs the Perl interpreter for beh (Backend Error
78
Handler) and the test suite.
80
To build foomatic-rip you need a C compiler and its standard libraries.
82
To run beh (Backend Error Handler) or the test suite a Perl interpreter
83
(5.6.0 and newer) is needed.
85
To connect to remote printers with a non-CUPS printing system, you
86
need additional connectivity software (as "rlpr", "nc", "smbspool',
87
...). To print non-PostScript/PDF files with LPD, LPRng, GNUlpr, or
88
without spooler, you will need a2ps, enscript, mpage, or similar
89
filters which convert non-PostScript files to PostScript. a2ps,
90
enscript, and mpage will be automatically used by the scripts when
94
rlpr: http://freshmeat.net/projects/rlpr/ or
95
http://www.openprinting.org/download/printing/
96
netcat: http://freshmeat.net/projects/netcat/
98
This package does not require any other Foomatic package. it can be
99
used with PPD files downloaded from the OpenPrinting site, with
100
manufacturer-supplied PPDs for PostScript printers, and probably with
103
For non-PostScript printers one also needs Ghostscript (5.50 or newer,
104
GPL Ghostscript 8.63 or newer highly recommended) and the appropriate
107
For drivers which have to be compiled into Ghostscript ("Execution
108
style: Ghostscript built-in" on the driver pages on the OpenPrinting
109
site) check with "gs -h" whether the driver is in your Ghostscript. If
110
not you need to compile the driver into your Ghostscript or use a
111
Ghostscript version which already contains it (preferably GPL
112
Ghostscript 8.63 or newer).
114
If the driver page says "Execution style: Uniprint", it is much
115
easier, check whether the appropriate ".upp" file is in one of the
116
directories listed under "Search path:" in the end of the "gs -h"
117
output. Copy the ".upp" file to one of these directories when it was
120
The third type of driver is marked with "Execution style: Filter",
121
this means, that you have to install a filter executable in addition
122
to Ghostscript. Check with "which <name of the filter>" whether the
123
filter is already there, otherwise download and install the
126
foomatic-filters can be installed using these commands (if you have
127
downloaded this package from the BZR repository, run
128
"./make_configure" at first, for that you will also need the
129
"autoconf" and "aclocal" utilities, "aclocal" is in the "automake"
130
package in some distributions):
136
"make install" must be run as "root", the other commands can be run as
139
The "configure" script will auto-detect where the programs have to be
140
installed and where the Perl interpreter is located. If "configure"
141
fails because of something not being installed, do
143
rm -rf config.cache autom*.cache
145
before you run "configure" again (after installing the missing parts).
147
By default, foomatic-filters is installed into subdirectories of
148
/usr/local (e. g. /usr/local/bin/foomatic-rip), to get it into
149
subdirectories of /usr (/usr/bin/foomatic-rip), enter:
151
./configure --prefix=/usr --sysconfdir=/etc
155
There are other things which can be adjusted by options on the
156
"configure" command line, enter "./configure --help" for more
157
info. You can also modify variables in the beginning of the "Makefile"
158
after running "configure", but note that every run of "configure"
159
re-creates the "Makefile".
161
You can also run Foomatic out of its source directory (for example
162
when you want to try it out, or when you don't have root
163
access). Therefore enter (can be done as a normal user):
168
and enter the commands with "./" in the beginning
169
(e. g. "./foomatic-rip ...", "man ./foomatic-rip.1"). This also works
170
on a machine where a system-wide Foomatic is already installed.
172
In addition, if you do not use CUPS, you should install a utility to
173
make PostScript out of non-PostScript files, so that you can print
174
those non-PostScript files and also a list of available options using
175
the "docs" option. The supported utilities are "a2ps"
176
(http://www-inf.enst.fr/~demaille/a2ps/), "enscript"
177
(http://people.ssh.fi/mtr/genscript/), and "mpage"
178
(http://www.mesa.nl/pub/mpage). Recommended is "a2ps" because it
179
detects many file types (text, most image formats) and together with
180
ImageMagick (for images) and Ghostscript it converts them to
181
PostScript. The other tools convert only text files. The tool you have
182
installed is auto-detected by foomatic-rip and used automatically if
183
necessary. PPR needs this tool only for printing the option list, and
184
CUPS does not need it at all. PPR and CUPS use internal filters for
185
printing non-PostScript files.
187
If you have a printer or multi-function device from HP, install HPLIP from
189
http://hplipopensource.com/
191
before starting to set up printer queues with foomatic-filters. This
192
is needed for printing on certain USB devices and for scanning and
193
photo memory card access on all devices. It also adds maintenance
194
functionality for inkjets, reporting of ink or toner levels and
195
printer status, and also remote readout of the printers front-panel
196
LCD. CUPS is required as the printing system when HPLIP is used.
198
Note: The "hp" CUPS backend and "beh" (see below) cannot be used
206
If you have "foomatic-db-engine" installed, see the USAGE file there.
208
If not, see, depending on your spooler:
212
http://www.openprinting.org/cups-doc.html
216
http://www.openprinting.org/lpd-doc.html
220
http://www.openprinting.org/ppr-doc.html
224
http://www.openprinting.org/pdq-doc.html
228
http://www.tww.cx/cps.php
230
Direct, spooler-less printing:
232
http://www.openprinting.org/direct-doc.html
234
Usage of PPD files (for all spoolers):
236
http://www.openprinting.org/ppd-doc.html
240
beh - Backend Error Handler
241
---------------------------
243
A wrapper for CUPS backends to make error handling configurable
245
Usually, if a CUPS backend exits with an error status other than zero
246
(for example if a printer is not turned on or not reachable on the
247
network), CUPS disables the print queue and one can only print again
248
if a system administrator re-enables the queue manually. Even restarting
249
CUPS (or rebooting) does not re-enable disabled queues.
251
For system administrators this can get annoying, for newbie users
252
who are not aware of this problem it looks like that CUPS is severely
253
broken. They remove and re-install print queues, getting on the nerves
254
of distro install support, people, or even switch back to a proprietary
257
This script makes the handling of such backend errors configurable, so
258
that the problem can easily be worked around. The new possibilities are:
260
- Let queues simply not being disabled. Simple approach, but job gets
263
- Repeat a given number of times.
265
- Repeat infinitely often, until the job gets finally through. This
266
is the standard of LPRng, and it eliminates loss of the job.
268
- The interval between two attemts to run the backend can also be
271
- Configuration is done independently for each print queue. So local
272
printers and network printers can be treated differently.
277
Make sure "beh" is in the CUPS backend directory (usually
278
/usr/lib/cups/backend/) and world-readable and -executable. Restart
279
CUPS (usually "killall -HUP cupsd" or "/etc/init.d/cups restart"). If
280
all is correct "lpinfo -v" should have "beh" in its output.
282
Then activate "beh" for your print queue(s) with command(s) like this:
284
lpadmin -p <queue name> -E -v beh:/<dd>/<att>/<delay>/<originaluri>
287
<queue name>: The name of your print queue
288
<dd>: Don't Disable, if "1", beh always exits with zero
289
status, so the queue gets never disabled when the
290
original backend exits with an error. "0" carries
291
the error status of the last call of the backend
292
(after <att> retries) on to CUPS, so the queue
293
usually gets disabled.
294
<att>: Attempts, number of attempts to recall the backend
295
in case of an error. "0" means infinite retries. In
296
this case <dd> gets meaningless.
297
<delay>: Delay between two attempts to call the beckend, to
298
be given in seconds and as an integer number.
299
Meaningless if <att> is one.
300
<originaluri>: The original URI, which your queue had before. Can
301
be determined with "lpstat -v".
303
All parameters, especially, <dd>, <att>, and <delay> have always to
304
be specified, even if one of them is meaningless due to the setting of
307
beh works with every backend except the "hp" backend of HPLIP.
311
beh:/1/3/5/socket://printer:9100
313
On the network printer with host name "printer" it is tried to access
314
3 times with 5 second delays between the attempts. If the job still
315
fails, the queue is not disabled (and the job discarded).
317
beh:/0/10/60/socket://printer:9100
319
Retry 10 times in one minute intervals, disable the queue when still
322
beh:/1/0/60/usb://Brother/HL-5040%20series
324
On a Brother HL-5040 on the USB try infinitely often until the printer
325
comes back, in intervals of one minute. This way the job does not get
326
lost when the printer is turned off and one can intendedly delay
327
printing by simply switching off the printer. The ideal configuration
328
for desktop printers and/or home users.