| 1 |
|
| 2 |
Foomatic 4.0.13 |
| 3 |
=============== |
| 4 |
|
| 5 |
foomatic-db-engine |
| 6 |
------------------ |
| 7 |
|
| 8 |
Foomatic's database engine generates PPD files from the data in |
| 9 |
Foomatic's XML database. It also contains scripts to directly generate |
| 10 |
print queues and handle jobs. |
| 11 |
|
| 12 |
|
| 13 |
Till Kamppeter <[email protected]> |
| 14 |
Lars Uebernickel <[email protected]> |
| 15 |
|
| 16 |
http://www.openprinting.org/ |
| 17 |
|
| 18 |
This usage documentation file is written by Till Kamppeter |
| 19 |
|
| 20 |
|
| 21 |
Intro |
| 22 |
----- |
| 23 |
|
| 24 |
Foomatic is a database providing information about the usage of |
| 25 |
printers with Unix-like operating systems (Linux, Solaris, ...). |
| 26 |
|
| 27 |
The applications of these operating systems send PostScript or PDF to |
| 28 |
the printer queues. Therefore one usually hands over the PostScript |
| 29 |
directly to a PostScript printer (sometimes with some inserted |
| 30 |
PostScript commands for options) or uses Ghostscript for generating |
| 31 |
the data format the printer needs from PostScript or PDF input. This |
| 32 |
is done by the printer spooler which also stores the data in a spool |
| 33 |
directory when the printer is still occupied by another job, transmits |
| 34 |
the data to a print server in the network, and so on. |
| 35 |
|
| 36 |
The printer drivers for non-PostScript printers are either compiled |
| 37 |
into Ghostscript, a plug-in for Ghostscript (e. g. IJS drivers), or |
| 38 |
they are an extra filter which converts a generic bitmap generated by |
| 39 |
Ghostscript into the printer's data format. For this the spooler has |
| 40 |
to call complicated command lines of Ghostscript and the extra filter |
| 41 |
(if needed). The user of a Unix-like operating system normally does |
| 42 |
not see these command lines because an installation program takes |
| 43 |
appropriate filter scripts and/or description files from a database |
| 44 |
and assigns them to the printer queue. |
| 45 |
|
| 46 |
Widely used databases were the RHS-Printfilters and the APS |
| 47 |
filters. Their disadvantages were that they only supported one spooler |
| 48 |
(LPD/LPRng) and only a small part of the driver's options (mostly page |
| 49 |
size and resolution). Foomatic supports all options of the drivers and |
| 50 |
all known spoolers (LPD, LPRng, GNUlpr, CUPS, Solaris LP, PPR, PDQ, |
| 51 |
CPS, direct spooler-less printing). In addition, all known free |
| 52 |
software printer drivers are supported. Foomatic also supports |
| 53 |
printing of various non-PostScript/PDF file types for spoolers which |
| 54 |
do not support these by themselves (LPD, LPRng, GNUlpr, spooler-less |
| 55 |
printing). To enable this feature you need to have "a2ps", "enscript", |
| 56 |
or "mpage" installed. |
| 57 |
|
| 58 |
Another problem is that the way how to install queues, to print files, |
| 59 |
and to handle jobs is very different with different spoolers. LPD for |
| 60 |
example requires editing of configuration files for adding a queue, |
| 61 |
whereas CUPS and PPR have specialized command line utilities. Foomatic |
| 62 |
puts a layer between the applications and the spoolers so that one has |
| 63 |
a common, spooler-independent command line interface for all spoolers, |
| 64 |
so that switching of spoolers or administration of a network with |
| 65 |
different spoolers gets much easier, because for the same operations |
| 66 |
there are the same commands, independent of the spooler. |
| 67 |
|
| 68 |
This command line interface can also be used as a base for |
| 69 |
spooler-independent graphical frontends. |
| 70 |
|
| 71 |
|
| 72 |
Installation |
| 73 |
------------ |
| 74 |
|
| 75 |
Foomatic runs on all systems where one can run the Perl |
| 76 |
interpreter and Ghostscript. |
| 77 |
|
| 78 |
Besides Perl and a C compiler with its standard libraries you will |
| 79 |
need the libxml C library for XML handling and one of the tools |
| 80 |
"wget" or "curl". |
| 81 |
|
| 82 |
In addition, you need the Foomatic database ("foomatic-db") and the |
| 83 |
Foomatic filters ("foomatic-filters"). It is recommended to install |
| 84 |
these packages before you install this package. Then the paths to its |
| 85 |
components get auto-detected during the build of this package. |
| 86 |
|
| 87 |
"wget" is really a standard tool which nearly every distribution |
| 88 |
includes. If yours does not include it, you find "wget" on |
| 89 |
|
| 90 |
http://www.gnu.org/software/wget/wget.html |
| 91 |
|
| 92 |
and "curl" is located on |
| 93 |
|
| 94 |
http://curl.haxx.se/ |
| 95 |
|
| 96 |
Because libxml is also used by GNOME, it is probably also part of |
| 97 |
every distribution of GNU/Linux or *BSD and one can also easily build |
| 98 |
it on any Unix-like operating system. If you distribution does not |
| 99 |
provide libxml you can get libxml from |
| 100 |
|
| 101 |
http://www.xmlsoft.org/ |
| 102 |
|
| 103 |
If your distribution contains libxml, note that besides the "libxml" |
| 104 |
or "libxml2" package you must install also a package with a name |
| 105 |
"libxml-devel" or "libxml2-devel" to be able to compile programs which |
| 106 |
use libxml. This additional package contains the needed header files |
| 107 |
and "xml(2)-config", which tells the C compiler where it finds the |
| 108 |
header files. If "xml(2)-config" or some header files in the packages |
| 109 |
of your distribution are missing, compile libxml from source. |
| 110 |
|
| 111 |
We have tested with the versions 1.8.17 and 2.4.19 of libxml, |
| 112 |
both work, but 1.8.17 requires that the XML files do not have leading |
| 113 |
blank lines. Use foomatic-fix-xml if you have such XML files (old or |
| 114 |
third-party files). libxml 1.8.9 and earlier do not work. |
| 115 |
|
| 116 |
Using libxml 2.x or newer is highly recommended. |
| 117 |
|
| 118 |
For Foomatic making sense one also needs Ghostscript (5.50 or newer, |
| 119 |
GPL Ghostscript 8.64 or newer highly recommended) if one has a |
| 120 |
non-PostScript printer. In addition, the appropriate driver for a |
| 121 |
non-PostScript printer must be installed. |
| 122 |
|
| 123 |
After installing the libxml package, Foomatic can be installed using |
| 124 |
the commands (if you have downloaded this package from the BZR |
| 125 |
repository, run "./make_configure" at first, for that you will also |
| 126 |
need libxml 2.x, the "autoconf" and "aclocal" utilities, "aclocal" is |
| 127 |
in the "automake" package in some distributions): |
| 128 |
|
| 129 |
./configure |
| 130 |
make |
| 131 |
make install |
| 132 |
|
| 133 |
"make install" must be run as "root", the other commands can be run as |
| 134 |
a normal user. |
| 135 |
|
| 136 |
The "configure" script will auto-detect where the libxml is installed and |
| 137 |
which version and also where relevant programs, files, and directories |
| 138 |
of your printer spooler are located. In addition, it is made sure that |
| 139 |
Perl will find the Perl libraries of Foomatic. If "configure" fails because |
| 140 |
of something not being installed, do |
| 141 |
|
| 142 |
rm -rf config.cache autom*.cache |
| 143 |
|
| 144 |
before you run "configure" again (after installing the missing parts). |
| 145 |
|
| 146 |
By default, Foomatic is installed into subdirectories of /usr/local |
| 147 |
(e. g. /usr/local/bin/foomatic-configure), to get it into subdirectories |
| 148 |
of /usr (/usr/bin/foomatic-configure), enter: |
| 149 |
|
| 150 |
./configure --prefix=/usr |
| 151 |
make |
| 152 |
make install |
| 153 |
|
| 154 |
There are other things which can be adjusted by options on the |
| 155 |
"configure" command line, enter "./configure --help" for more |
| 156 |
info. You can also modify variables in the beginning of the "Makefile" |
| 157 |
after running "configure", but note that every run of "configure" |
| 158 |
re-creates the "Makefile". |
| 159 |
|
| 160 |
If "configure" did not auto-detect where you have placed the database |
| 161 |
(or if you intend to install the database afterwards), do |
| 162 |
|
| 163 |
export LIBDIR=/path/to/the/database |
| 164 |
./configure |
| 165 |
make |
| 166 |
make install |
| 167 |
|
| 168 |
You have specified the path correctly, when |
| 169 |
|
| 170 |
/path/to/the/database/db/source/driver/ljet4.xml |
| 171 |
|
| 172 |
exists. |
| 173 |
|
| 174 |
You can also run Foomatic out of its source directory (for example |
| 175 |
when you want to try it out, or when you don't have root |
| 176 |
access). Therefore enter (can be done as a normal user): |
| 177 |
|
| 178 |
./configure |
| 179 |
make inplace |
| 180 |
|
| 181 |
and enter the commands with "./" in the beginning |
| 182 |
(e. g. "./foomatic-ppdfile ..."). This also works on a machine where |
| 183 |
a system-wide Foomatic is already installed. This way you can develop |
| 184 |
XML files for the database and test them in your local database |
| 185 |
without messing up the system-wide one. To have the local database you |
| 186 |
need to put the "foomatic-db" tarball into the main directory of this |
| 187 |
package or into the directory where you have also put this package for |
| 188 |
unpacking. Simply unpack the database package. You do not need to build or |
| 189 |
install it. |
| 190 |
|
| 191 |
You can use Foomatic databases from wherever you want, edit the "$libdir" |
| 192 |
line in lib/Foomatic/Defaults.pm to point to the desired database. To |
| 193 |
use the system-wide one, let the line look like: |
| 194 |
|
| 195 |
... |
| 196 |
# Library directory; typically /usr/share/foomatic or somesuch. |
| 197 |
$libdir = '/usr/share/foomatic'; |
| 198 |
... |
| 199 |
|
| 200 |
In addition, you should install a utility to make PostScript out of |
| 201 |
non-PostScript files, so that you can print those non-PostScript files |
| 202 |
and also a list of available options using the "docs" option. The |
| 203 |
supported utilities are "a2ps", "enscript", and "mpage". Recommended |
| 204 |
is "a2ps" because it detects many file types (text, PDF, most image |
| 205 |
formats) and together with ImageMagick (for images) and GNU Ghostscript |
| 206 |
6.51 or newer (for PDF) it converts them to PostScript. The other |
| 207 |
tools convert only text files. The tool you have installed is |
| 208 |
auto-detected by the filter script for your spooler and used |
| 209 |
automatically if necessary. CUPS and PPR need this tool only for |
| 210 |
printing the option list, they use internal filters for printing |
| 211 |
non-PostScript files. The PDQ configuration files only supports |
| 212 |
"mpage", with LPD, GNUlpr, LPRng, or direct, spooler-less printing you |
| 213 |
can use all tools. |
| 214 |
|
| 215 |
A default spooler can be set by putting its name into an |
| 216 |
/etc/foomatic/defaultspooler file or into ~/.defaultspooler |
| 217 |
|
| 218 |
If you have a printer or multi-function device from HP, install HPLIP from |
| 219 |
|
| 220 |
http://hplipopensource.com/ |
| 221 |
|
| 222 |
before starting to set up printer queues with Foomatic. This gives you |
| 223 |
the possibility to access all extra functions of your HP device, |
| 224 |
independent whether it is connected via parallel port, USB, or |
| 225 |
ethernet. This gives you, depending on the device, functionality, as |
| 226 |
ink/toner level check, nozzle check and cleaning, color adjustment, |
| 227 |
head alignement, scanning, memory card access, and even sending faxes. |
| 228 |
|
| 229 |
Printing through the MTink daemon from the MTink package |
| 230 |
(http://xwtools.automatix.de/) is also supported. When CUPS is the |
| 231 |
spooler the special "mtink" backend (included in the MTink package) |
| 232 |
will be used. Using the MTink daemon it is possible to check the ink |
| 233 |
levels while printing. The MTink daemon supports only Epson inkjets |
| 234 |
from the Epson Stylus Color 740 on to the current models. |
| 235 |
|
| 236 |
|
| 237 |
Easy printer setup with CUPS 1.2 or newer |
| 238 |
----------------------------------------- |
| 239 |
|
| 240 |
If you have CUPS 1.2 or newer, you do not need the command line to |
| 241 |
set up printers with Foomatic. Simply fire up the web interface entering |
| 242 |
|
| 243 |
http://localhost:631/ |
| 244 |
|
| 245 |
and click the "Administration" tab. Then click the "Add this printer" at |
| 246 |
the entry of an auto-detected printer (parallel, USB, ethernet) or click |
| 247 |
"Add printer" at the top. Follow the instructions on the following pages. |
| 248 |
|
| 249 |
If the printers of the Foomatic database do not appear, check whether the |
| 250 |
link to foomatic-ppdfile is in /usr/lib/cups/driver: |
| 251 |
|
| 252 |
lrwxrwxrwx 1 root root 25 Apr 19 18:13 foomatic -> /usr/bin/foomatic-ppdfile |
| 253 |
|
| 254 |
If not, create it manually. |
| 255 |
|
| 256 |
If you want the web interface only list entries for the recommended |
| 257 |
driver for each printer, create a file /etc/cups/foomatic.conf |
| 258 |
containing the line |
| 259 |
|
| 260 |
OnlyRecommended Yes |
| 261 |
|
| 262 |
Note: CUPS paths may be different on your system. |
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
Adding a queue |
| 267 |
-------------- |
| 268 |
|
| 269 |
To add a printer queue you use the queue administration tool |
| 270 |
foomatic-configure. You call it this way: |
| 271 |
|
| 272 |
foomatic-configure [-q] [-f] [-w] [-s <spooler>] -n <queue> -c <connection> |
| 273 |
[-p <printer ID> -d <driver ID>] [ --ppd <ppdfile> ] |
| 274 |
[-o <option>=<value> -o <option>=<value> ...] |
| 275 |
|
| 276 |
Options in [...] can be left out. The options mean: |
| 277 |
|
| 278 |
-q Quiet operation: You are not asked for anything. |
| 279 |
-f Force rebuild: If you queue uses a PPD file generated from |
| 280 |
the Foomatic database, it will be rebuilt when this option |
| 281 |
is set. Otherwise only the default settings are updated. |
| 282 |
-w Generate PPD which is compatible to the CUPS PostScript |
| 283 |
driver for Windows (GUI strings are limited to 39 characters). |
| 284 |
If you use Adobe's PostScript driver on your Windows clients, |
| 285 |
you do not need to supply this option, because Adobe's driver |
| 286 |
does not have this bug. Usage of Adobe's driver is recommended |
| 287 |
as you do not need to live with crippled GUI strings then. |
| 288 |
This applies only to PPDs built from the Foomatic database, it |
| 289 |
has no influence on PPDs supplied with the "--ppd" option. |
| 290 |
-s <spooler> The spooler to be used. If this option is left out, the |
| 291 |
spooler is auto-detected and the user is asked whether |
| 292 |
the auto-detection is correct (unless -q is given). Possible |
| 293 |
choices are: "lpd", "lprng", "cups", "pdq", "ppr", "direct". |
| 294 |
-n <queue> The queue name. This argument is required. |
| 295 |
-c <connection> The way how the printer is connected (also required, |
| 296 |
These are exactly the URIs as one uses them for CUPS): |
| 297 |
|
| 298 |
parallel:<device> : Printer connected to local parallel |
| 299 |
port, for example "parallel:/dev/lp0". |
| 300 |
usb:<device> : Printer connected to local USB port, |
| 301 |
for example "usb:/dev/usb/lp0". With |
| 302 |
CUPS 1.1.17 or newer the URI is |
| 303 |
automatically converted to an URI |
| 304 |
referring to the printer model and |
| 305 |
serial number. So if one has plugged |
| 306 |
the printers in a different order |
| 307 |
and reboots, they are still found |
| 308 |
even if they are assigned to other |
| 309 |
/dev/usb/lp? device files. |
| 310 |
usb://<make>/<model>?serial=<ser. num.> URIs referring |
| 311 |
to printer models/serial numbers can |
| 312 |
also be directly given, but they must |
| 313 |
exactly match one of the URIs listed |
| 314 |
by "lpinfo -v" (only available for |
| 315 |
CUPS). |
| 316 |
serial:<device> : Printer connected to local serial |
| 317 |
port, for example "serial:/dev/ttyS1". |
| 318 |
file:<file name> : Printing into a file, a named pipe, |
| 319 |
or similar. <file name> can also |
| 320 |
be a device special file as /dev/lp0, |
| 321 |
/dev/usb/lp1, ..., so we are |
| 322 |
compatible to older versions of |
| 323 |
Foomatic. |
| 324 |
hp:/<device name> : HP printer used with the low-level |
| 325 |
driver HPLIP (see |
| 326 |
http://hplipopensource.com/). The |
| 327 |
device name is name assigned to the |
| 328 |
device by the HPLIP system, Run |
| 329 |
"lpinfo -v" to see valid URIs (works |
| 330 |
only with CUPS). |
| 331 |
ptal:/<device name> : HP multi-function device used with |
| 332 |
the obsolete low-level driver HPOJ (see |
| 333 |
http://hpoj.sourceforge.net/). The |
| 334 |
device name is name assigned to the |
| 335 |
device by the ptal-mlcd daemon, for |
| 336 |
example "mlc:usb:PSC_950". Please |
| 337 |
replace HPOJ by HPLIP |
| 338 |
(http://hplipopensource.com/) if you |
| 339 |
have it still in use somewhere. |
| 340 |
mtink:/<device name> : Epson Stylus Color, Photo, Pro, |
| 341 |
or Scan inkjet printer used through |
| 342 |
the mtink daemon. <device name> |
| 343 |
is the name of the appropriate pipe |
| 344 |
in the /var/mtink directory. Example: |
| 345 |
To print to /var/mtink/C70 the URI is |
| 346 |
mtink:/C70. |
| 347 |
lpd://<server>/<queue> : Remote LPD printer (on server |
| 348 |
running LPD/LPRng or ethernet- |
| 349 |
connected printer) |
| 350 |
socket://<server>:<port>/ : TCP/Socket printer (ethernet- |
| 351 |
connected printer) |
| 352 |
smb://<user>:<password>@<workgroup>/<server>/<share> |
| 353 |
smb://<user>@<workgroup>/<server>/<share> |
| 354 |
smb://<workgroup>/<server>/<share> |
| 355 |
smb://<server>/<share> |
| 356 |
smb://<user>:<password>@<server>/<share> : Printer on |
| 357 |
Windows server. Leaving out user and |
| 358 |
password sends the job to the "GUEST" |
| 359 |
account, the workgroup is optional |
| 360 |
(SMB not available in PDQ, workgroup |
| 361 |
ignored in PPR). |
| 362 |
ncp://<server>/<queue> |
| 363 |
ncp://<user>:<password>@<server>/<queue> : Printer on |
| 364 |
Novell NetWare server (only LPD, |
| 365 |
LPRng, and direct printing). |
| 366 |
postpipe:"<command line>" : Pipe the PostScript output |
| 367 |
into the given command line (only LPD, |
| 368 |
LPRng, and direct printing). |
| 369 |
stdout Print to standard output (only |
| 370 |
available for direct printing). |
| 371 |
|
| 372 |
-p <printer ID> : The database ID of the used printer model. To get it, |
| 373 |
type |
| 374 |
|
| 375 |
foomatic-configure -O | less |
| 376 |
|
| 377 |
on the command line and search the output for your printer |
| 378 |
model. The entry for your model contains both the printer |
| 379 |
ID and the driver IDs for all suitable drivers. To search |
| 380 |
strings in the output of the command above press "/", type |
| 381 |
a search term, and press <Enter>. |
| 382 |
-d <driver ID> : The ID of the desired printer driver. If the "-p" and |
| 383 |
the "-d" options are left out, a raw (filterless) queue is |
| 384 |
set up (PDQ does not support raw queues). |
| 385 |
--ppd <ppdfile> : If you have a PostScript printer which is shipped |
| 386 |
with a PPD file (or a PPD file from the internet, a CD, |
| 387 |
or so), you can set up your print queue with this PPD |
| 388 |
file using this option. Works also with the PPD files |
| 389 |
of CUPS raster drivers, even if another spooler than |
| 390 |
CUPS is used. The driver itself and a Ghostscript version |
| 391 |
with the "cups" device (check with "gs -h") must be |
| 392 |
installed. Compressed PPD files ("file.ppd.gz") are |
| 393 |
allowed. Do not use "-p" and "-d" then. |
| 394 |
-o <option>=<value> : Set the default value for an option. |
| 395 |
|
| 396 |
Example: We have the HP DeskJet 840C on the USB and want to use it |
| 397 |
with the "cdj880" driver. To get a CUPS queue named "DeskJet" we have |
| 398 |
to enter: |
| 399 |
|
| 400 |
foomatic-configure -O | less |
| 401 |
|
| 402 |
and find in the output: |
| 403 |
|
| 404 |
<printer> |
| 405 |
<id>HP-DeskJet_840C</id> |
| 406 |
<make>HP</make> |
| 407 |
<model>DeskJet 840C</model> |
| 408 |
<functionality>B</functionality> |
| 409 |
<unverified>B</unverified> |
| 410 |
<autodetect> |
| 411 |
<parallel> |
| 412 |
<manufacturer>Hewlett-Packard</manufacturer> |
| 413 |
<model>DeskJet 840C</model> |
| 414 |
</parallel> |
| 415 |
</autodetect> |
| 416 |
<driver>hpijs</driver> |
| 417 |
<drivers> |
| 418 |
<driver>cdj550</driver> |
| 419 |
<driver>cdj670</driver> |
| 420 |
<driver>cdj880</driver> |
| 421 |
<driver>cdj970</driver> |
| 422 |
<driver>hpdj</driver> |
| 423 |
<driver>hpijs</driver> |
| 424 |
<driver>pcl3</driver> |
| 425 |
<driver>stp</driver> |
| 426 |
</drivers> |
| 427 |
</printer> |
| 428 |
|
| 429 |
The printer ID is between the "<id>" tags and is derived from the |
| 430 |
manufacturer and modek name (so it can often be determined without |
| 431 |
looking it up). The model name is between the "<model>" tags and the |
| 432 |
driver names between the "<driver>" tags. Then the command line to add |
| 433 |
the queue must be (with the default paper size set to A4): |
| 434 |
|
| 435 |
foomatic-configure -s cups -n DeskJet -c usb:/dev/usb/lp0 |
| 436 |
-p HP-DeskJet_840C -d cdj880 -o PageSize=A4 |
| 437 |
|
| 438 |
Under CUPS 1.1.17 or newer the URI will be converted to an URI referring |
| 439 |
to manufacturer, model, and serial number of the printer. So if the printer |
| 440 |
gets /dev/usb/lp1 after the next boot, the queue will still work. |
| 441 |
|
| 442 |
Exactly the same queue, but for PDQ: |
| 443 |
|
| 444 |
foomatic-configure -s pdq -n DeskJet -c usb:/dev/usb/lp0 |
| 445 |
-p HP-DeskJet_840C -d cdj880 -o PageSize=A4 |
| 446 |
|
| 447 |
When the printer is connected to a Samba server (name: "winserver", |
| 448 |
queue: "dj"), the line has to be: |
| 449 |
|
| 450 |
foomatic-configure -s cups -n DeskJet -c smb://winserver/dj |
| 451 |
-p HP-DeskJet_840C -d cdj880 -o PageSize=A4 |
| 452 |
|
| 453 |
If you have an HP LaserJet 4050, which is a PostScript printer, you |
| 454 |
can get its PPD file from its Windows driver CD, http://hplip.sf.net/, |
| 455 |
or http://www.openprinting.org/. After downloading it you can set up a |
| 456 |
queue as follows: |
| 457 |
|
| 458 |
foomatic-configure -s pdq -n LJ4050 -c socket://printer:9100 |
| 459 |
--ppd HP_LaserJet_4050_Series.ppd -o PageSize=A4 |
| 460 |
|
| 461 |
and you get full access to all features of the printer, even with |
| 462 |
non-PPD-aware spoolers (as PDQ in this example). Compressed PPD files |
| 463 |
("file.ppd.gz") are also allowed here. |
| 464 |
|
| 465 |
In this example we set up an Epson Stylus Photo 1290 with the CUPS |
| 466 |
driver of Gutenprint, but with PDQ as the spooler: |
| 467 |
|
| 468 |
foomatic-configure -s pdq -n Eps1290 -c usb:/dev/usb/lp0 |
| 469 |
--ppd escp2-1290.ppd -o PageSize=A4 |
| 470 |
|
| 471 |
One simply takes the PPD file which comes with the CUPS |
| 472 |
driver. Naturally the CUPS driver itself and a Ghostscript with the |
| 473 |
"cups" output device (Check with "gs -h", ESP Ghostscript |
| 474 |
recommended). In most cases you will need also the CUPS libraries to |
| 475 |
run a CUPS driver or to compile Ghostscript/the driver with CUPS |
| 476 |
support. The liberaries (and its "-devel" or "-dev" for compiling |
| 477 |
drivers/Ghostscript) are only a small part of CUPS and in most distros |
| 478 |
you can install the separately. |
| 479 |
|
| 480 |
A raw LPD queue pointing to an HP JetDirect box (IP: 192.168.1.234, |
| 481 |
port: 9100) is made this way: |
| 482 |
|
| 483 |
foomatic-configure -s lpd -n remoteraw -c socket://192.168.1.234:9100/ |
| 484 |
|
| 485 |
|
| 486 |
|
| 487 |
Modifying a queue |
| 488 |
----------------- |
| 489 |
|
| 490 |
Do the same as for adding a queue, but take care that you use the same |
| 491 |
queue name. The old queue will be replaced. You only need to supply |
| 492 |
the items which you want to change. |
| 493 |
|
| 494 |
Example: The "DeskJet" queue from above can be switched to use the |
| 495 |
"hpijs" driver (HP's DeskJet driver from |
| 496 |
http://hplipopensource.com/). Enter |
| 497 |
|
| 498 |
foomatic-configure -s cups -n DeskJet -d hpijs |
| 499 |
|
| 500 |
Both drivers have the option "PageSize", so its default value (here |
| 501 |
"A4") is overtaken to the new driver. So you do not need to configure |
| 502 |
all the options again when you change something with |
| 503 |
foomatic-configure. Also option defaults set with external programs |
| 504 |
(KUPS, CUPS web interface, KDE Printing Manager, XPDQ, ...) do not |
| 505 |
get lost. Option settings are also overtaken when one switches from |
| 506 |
a Foomatic setup ("-p <printer> -d <driver>" to a setup with a |
| 507 |
manufacturer-supplied PPD ("--ppd <ppd file>") or vice-versa or |
| 508 |
from one to another manufacturer-supplied PPD. |
| 509 |
|
| 510 |
This command line sets an option: |
| 511 |
|
| 512 |
foomatic-configure -s cups -n DeskJet -o Quality=600photo |
| 513 |
|
| 514 |
and this line you need when you want to connect your printer to the |
| 515 |
parallel port: |
| 516 |
|
| 517 |
foomatic-configure -s cups -n DeskJet -c parallel:/dev/lp0 |
| 518 |
|
| 519 |
|
| 520 |
|
| 521 |
Copying a queue |
| 522 |
--------------- |
| 523 |
|
| 524 |
To copy a queue we have the "-C" option: |
| 525 |
|
| 526 |
foomatic-configure [-q] [-f] [-w] [-s <spooler>] -n <queue> |
| 527 |
-C [sourcespooler] sourcequeue |
| 528 |
-c <connection> |
| 529 |
[-p <printer ID> -d <driver ID>] [-o <option>=<value> |
| 530 |
-o <option>=<value> ...] |
| 531 |
|
| 532 |
This creates the queue <queue> under the spooler <spooler> making a |
| 533 |
copy from the queue <sourcequeue> under the spooler |
| 534 |
<sourcespooler>. If you do not supply a <sourcespooler>, the source |
| 535 |
queue is assumed to be under the same spooler as the copy. All the |
| 536 |
other arguments have the same meaning as for creating a queue and they |
| 537 |
modify the copy. So lets make two queues for our HP DeskJet 840C with |
| 538 |
two different output qualities (under LPRng): |
| 539 |
|
| 540 |
foomatic-configure -s lprng -n DeskJetHi -c usb:/dev/usb/lp0 |
| 541 |
-p HP-DeskJet_840C -d hpijs -o PageSize=A4 |
| 542 |
-o Quality=600PhotoCMYK |
| 543 |
|
| 544 |
foomatic-configure -s lprng -n DeskJetLo -C DeskJetHi |
| 545 |
-o Quality=300ColorCMYK |
| 546 |
|
| 547 |
The first queue is for high quality printouts. The second is for low |
| 548 |
quality printouts, here we copy all characteristics of the first |
| 549 |
queue, but we modify the quality option to get the lower quality. So |
| 550 |
we do not need to type all the other arguments again. The page size |
| 551 |
setting of A4 is copied, too. |
| 552 |
|
| 553 |
Now we want to replace LPRng by CUPS without loosing our queues. After |
| 554 |
installing CUPS we do: |
| 555 |
|
| 556 |
foomatic-configure -s cups -n DeskJetHi -C lprng DeskJetHi |
| 557 |
foomatic-configure -s cups -n DeskJetLo -C lprng DeskJetLo |
| 558 |
|
| 559 |
and our queues are transferred to CUPS. LPRng does not need to be |
| 560 |
installed to do that copy, but CUPS as the destination spooler must be |
| 561 |
running. All option settings, description, location, and so on are |
| 562 |
conserved. |
| 563 |
|
| 564 |
When one has set up a USB printer with CUPS, its URI is converted to |
| 565 |
an URI referring to manufacturer, model, and serial number (see |
| 566 |
above). As these URIs are not supported by other spoolers, they are |
| 567 |
converted back in the copied queue under the bew spooler. But note |
| 568 |
that for this back-conversion CUPS must still be installed and running |
| 569 |
(it uses the "lpinfo -v" command of CUPS). When a USB printer queue is |
| 570 |
copied from another spooler to CUPS, the URI is also automatically |
| 571 |
converted to the new URI referring to manufacturer, model, and serial |
| 572 |
number. |
| 573 |
|
| 574 |
|
| 575 |
Setting the default queue |
| 576 |
------------------------- |
| 577 |
|
| 578 |
To define a default queue (which is used when one uses the "lpr", "pdq", or |
| 579 |
"foomatic-printjob" commands without the "-P" option) enter |
| 580 |
|
| 581 |
foomatic-configure [-q] -D [-s <spooler>] -n <queue> |
| 582 |
|
| 583 |
Options in [...] can be left out. The options mean: |
| 584 |
|
| 585 |
-q Quiet operation: You are not asked for anything. |
| 586 |
-D Set the given queue as the default queue. |
| 587 |
-s <spooler> The spooler to be used. If this option is left out, the |
| 588 |
spooler is auto-detected and the user is asked whether |
| 589 |
the auto-detection is correct (unless -q is given). Possible |
| 590 |
choices are: "lpd", "lprng", "cups", "pdq", "ppr", "direct". |
| 591 |
-n <queue> The queue name. This argument is required. |
| 592 |
|
| 593 |
Example: Set the "DeskJet" queue from above as the default queue: |
| 594 |
|
| 595 |
foomatic-configure -s cups -D -n DeskJet |
| 596 |
|
| 597 |
The super user ("root") can set system-wide default queues for all spoolers, |
| 598 |
normal users can set a personal default queue for CUPS or PDQ. Use the |
| 599 |
"-Q" option of "foomatic-configure" to find out which is the current |
| 600 |
default queue. |
| 601 |
|
| 602 |
|
| 603 |
Removing a queue |
| 604 |
---------------- |
| 605 |
|
| 606 |
To remove a queue you do |
| 607 |
|
| 608 |
foomatic-configure [-q] -R [-s <spooler>] -n <queue> |
| 609 |
|
| 610 |
Options in [...] can be left out. The options mean: |
| 611 |
|
| 612 |
-q Quiet operation: You are not asked for anything. |
| 613 |
-R Delete the given queue. |
| 614 |
-s <spooler> The spooler to be used. If this option is left out, the |
| 615 |
spooler is auto-detected and the user is asked whether |
| 616 |
the auto-detection is correct (unless -q is given). Possible |
| 617 |
choices are: "lpd", "lprng", "cups", "pdq", "ppr", "direct". |
| 618 |
-n <queue> The queue name. This argument is required. |
| 619 |
|
| 620 |
Example: Remove the "DeskJet" queue from above: |
| 621 |
|
| 622 |
foomatic-configure -s cups -R -n DeskJet |
| 623 |
|
| 624 |
|
| 625 |
Getting PPD files for manual queue setup |
| 626 |
---------------------------------------- |
| 627 |
|
| 628 |
You can get Foomatic PPD files for manual queue setup. Use |
| 629 |
|
| 630 |
foomatic-ppdfile -h |
| 631 |
|
| 632 |
to get information about how to get the PPD files and follow the |
| 633 |
links on |
| 634 |
|
| 635 |
http://www.openprinting.org/foomatic.html |
| 636 |
|
| 637 |
to know how to set up a queue with these PPD files. |
| 638 |
|
| 639 |
|
| 640 |
Querying info |
| 641 |
------------- |
| 642 |
|
| 643 |
You can query info about your configuration with the -Q and the -P |
| 644 |
option. Use |
| 645 |
|
| 646 |
foomatic-configure -h |
| 647 |
|
| 648 |
to get more info. |
| 649 |
|
| 650 |
|
| 651 |
Printing from the command line with Foomatic |
| 652 |
-------------------------------------------- |
| 653 |
|
| 654 |
Printing is done with the foomatic-printjob command. It is similar to the |
| 655 |
"lpr" commands of the spoolers. It is called as follows: |
| 656 |
|
| 657 |
foomatic-printjob [-i] [-s <spooler>] [-P <queue>] |
| 658 |
[-o <option1>=<value1>] [-o <option2>=<value2>] |
| 659 |
[-o <option3>] [<file1>] [<file2>] ... |
| 660 |
|
| 661 |
Options in [...] can be left out. The options mean: |
| 662 |
|
| 663 |
-i interactive, the user has to confirm the spooler auto- |
| 664 |
detection |
| 665 |
-s <spooler> The spooler to be used. If this option is left out, the |
| 666 |
spooler is auto-detected. When the -i option is given the |
| 667 |
user is asked whetherb the auto-detection is correct. |
| 668 |
Possible choices are: "lpd", "lprng", "cups", "pdq", "ppr", |
| 669 |
"direct". |
| 670 |
-P <queue> The queue where the job should be printed. If not given the |
| 671 |
default is read from the PRINTER environment variable or |
| 672 |
the default set with the "-D" option of "foomatic-configure" |
| 673 |
is used. If no default queue is set, it is chosen according |
| 674 |
to the rules of the spooler. |
| 675 |
-o <option> The switch "option" is set. |
| 676 |
-o <option>=<value> The option "option" is set to the value "value". |
| 677 |
<file> File(s) to be printed. When no file is given, the data to |
| 678 |
print is taken from standard input. |
| 679 |
|
| 680 |
Example: "file.ps" should be printed on the "DeskJet" in presentation |
| 681 |
quality on A4 paper: |
| 682 |
|
| 683 |
foomatic-printjob -s cups -P DeskJet -o PageSize=A4 |
| 684 |
-o Quality=presentation file.ps |
| 685 |
|
| 686 |
The current directory should be printed on the default printer: |
| 687 |
|
| 688 |
ls | foomatic-printjob |
| 689 |
|
| 690 |
In applications "foomatic-printjob" can be inserted as printing |
| 691 |
command instead of "lpr". |
| 692 |
|
| 693 |
|
| 694 |
Printing from the command line with your spooler's printing command |
| 695 |
------------------------------------------------------------------- |
| 696 |
|
| 697 |
You do not need to have Foomatic installed on all your clients to be |
| 698 |
able to print on your printer which you have set up on your server |
| 699 |
using Foomatic. You can use the normal printing commands of your |
| 700 |
printing system. Proceed as follows: |
| 701 |
|
| 702 |
|
| 703 |
- LPD |
| 704 |
|
| 705 |
Stock LPD (not LPRng or GNUlpr) do not support the submission of |
| 706 |
option settings along with the print job. Here a workaround is used by |
| 707 |
stuffing the option settings into the job title field: |
| 708 |
|
| 709 |
lpr [-P <queue>] |
| 710 |
[-J '<option1>=<value1> <option2>=<value2> ... |
| 711 |
<option3> ...'] [-Jdocs] [<file1>] [<file2>] ... |
| 712 |
|
| 713 |
Options in [...] can be left out. The options mean: |
| 714 |
|
| 715 |
-P <queue> The queue where the job should be printed. If not given the |
| 716 |
default is chosen according to the rules of the spooler. |
| 717 |
-J '...' Option settings, they must be enclosed in the '-J' option. |
| 718 |
The settings can be expressed as follows: |
| 719 |
<option> The switch "option" is set. |
| 720 |
<option>=<value> The option "option" is set to the value |
| 721 |
"value". |
| 722 |
-J docs Print listing of the options. Works only when you provide |
| 723 |
a file or something on standard input (which will not be |
| 724 |
printed). |
| 725 |
<file> File(s) to be printed. When no file is given, the data to |
| 726 |
print is taken from standard input. |
| 727 |
|
| 728 |
All other options can be used as forseen by the LPD printing system. |
| 729 |
|
| 730 |
The first example from above looks like the following now: |
| 731 |
|
| 732 |
lpr -P DeskJet -J 'PageSize=A4 Quality=presentation' file.ps |
| 733 |
|
| 734 |
Print a listing of valid options with |
| 735 |
|
| 736 |
lpr -P DeskJet -J docs ~/.bashrc |
| 737 |
|
| 738 |
|
| 739 |
- LPRng |
| 740 |
|
| 741 |
LPRng uses "-Z" to include option settings: |
| 742 |
|
| 743 |
lpr [-P <queue>] |
| 744 |
[-Z <option1>=<value1>] [-Z <option2>=<value2>] |
| 745 |
[-Z <option3>] [<file1>] [<file2>] ... |
| 746 |
|
| 747 |
Options in [...] can be left out. The options mean: |
| 748 |
|
| 749 |
-P <queue> The queue where the job should be printed. If not given the |
| 750 |
default is chosen according to the rules of the spooler. |
| 751 |
-Z <option> The switch "option" is set. |
| 752 |
-Z <option>=<value> The option "option" is set to the value "value". |
| 753 |
-Z docs Print listing of the options. Works only when you provide |
| 754 |
a file or something on standard input (which will not be |
| 755 |
printed). |
| 756 |
<file> File(s) to be printed. When no file is given, the data to |
| 757 |
print is taken from standard input. |
| 758 |
|
| 759 |
All other options can be used as forseen by the LPRng printing system. |
| 760 |
|
| 761 |
The first example from above looks like the following now: |
| 762 |
|
| 763 |
lpr -P DeskJet -Z PageSize=A4 -Z Quality=presentation file.ps |
| 764 |
|
| 765 |
Print a listing of valid options with |
| 766 |
|
| 767 |
lpr -P DeskJet -Z docs ~/.bashrc |
| 768 |
|
| 769 |
|
| 770 |
- CUPS/GNUlpr |
| 771 |
|
| 772 |
These spoolers use "-o" to include option settings: |
| 773 |
|
| 774 |
lpr [-P <queue>] |
| 775 |
[-o <option1>=<value1>] [-o <option2>=<value2>] |
| 776 |
[-o <option3>] [<file1>] [<file2>] ... |
| 777 |
|
| 778 |
Options in [...] can be left out. The options mean: |
| 779 |
|
| 780 |
-P <queue> The queue where the job should be printed. If not given the |
| 781 |
default is chosen according to the rules of the spooler. |
| 782 |
-o <option> The switch "option" is set. |
| 783 |
-o <option>=<value> The option "option" is set to the value "value". |
| 784 |
-o docs Print listing of the options. Works only when you provide |
| 785 |
a file or something on standard input (which will not be |
| 786 |
printed). |
| 787 |
<file> File(s) to be printed. When no file is given, the data to |
| 788 |
print is taken from standard input. |
| 789 |
|
| 790 |
The first example from above looks like the following now: |
| 791 |
|
| 792 |
lpr -P DeskJet -o PageSize=A4 -o Quality=presentation file.ps |
| 793 |
|
| 794 |
Print a listing of valid options with |
| 795 |
|
| 796 |
lpr -P DeskJet -o docs ~/.bashrc |
| 797 |
|
| 798 |
|
| 799 |
- PPR |
| 800 |
|
| 801 |
PPR uses the "ppr" command for printing and options are set by "-F": |
| 802 |
|
| 803 |
ppr [-d <queue>] |
| 804 |
[-F "*<option1> <value1>"] [-F "*<option2> <value2>"] |
| 805 |
[-F "*<option3> True"] [<file1>] [<file2>] ... |
| 806 |
|
| 807 |
Options in [...] can be left out. The options mean: |
| 808 |
|
| 809 |
-d <queue> The queue where the job should be printed. If not given the |
| 810 |
default is chosen according to the rules of the spooler. |
| 811 |
-F "*<option> True" The switch "option" is set. |
| 812 |
-F "*<option> <value>" The option "option" is set to the value "value". |
| 813 |
-i docs Print listing of the options. Works only when you provide |
| 814 |
a file or something on standard input (which will not be |
| 815 |
printed). |
| 816 |
<file> File(s) to be printed. When no file is given, the data to |
| 817 |
print is taken from standard input. |
| 818 |
|
| 819 |
The first example from above looks like the following now: |
| 820 |
|
| 821 |
ppr -d DeskJet -F "*PageSize A4" -F "*Quality presentation" file.ps |
| 822 |
|
| 823 |
Print a listing of valid options with |
| 824 |
|
| 825 |
ppr -d DeskJet -i docs ~/.bashrc |
| 826 |
|
| 827 |
|
| 828 |
- PDQ |
| 829 |
|
| 830 |
PDQ uses "-o" and "-a" to include option settings: |
| 831 |
|
| 832 |
pdq [-P <queue>] |
| 833 |
[-o<option1>_<value1>] [-o<option2>_<value2>] |
| 834 |
[-o<option3> -a<num_option>=<num_value>] [<file1>] [<file2>] ... |
| 835 |
|
| 836 |
Options in [...] can be left out. The options mean: |
| 837 |
|
| 838 |
-P <queue> The queue where the job should be printed. If not given the |
| 839 |
default is chosen according to the rules of the spooler. |
| 840 |
-o<option> The switch "option" is set. |
| 841 |
-o<option>_<value> The option "option" is set to the value "value". |
| 842 |
-a<num_option>=<num_value> The numerical option "num_option" is set to |
| 843 |
the value "num_value". |
| 844 |
-odocs Print listing of the options. Works only when you provide |
| 845 |
a file or something on standard input (which will not be |
| 846 |
printed). |
| 847 |
<file> File(s) to be printed. When no file is given, the data to |
| 848 |
print is taken from standard input. |
| 849 |
|
| 850 |
The first example from above looks like the following now: |
| 851 |
|
| 852 |
pdq -P DeskJet -oPageSize_A4 -oQuality_presentation file.ps |
| 853 |
|
| 854 |
Print a listing of valid options with |
| 855 |
|
| 856 |
pdq -P DeskJet -odocs ~/.bashrc |
| 857 |
|
| 858 |
|
| 859 |
- Direct, spooler-less printing |
| 860 |
|
| 861 |
Here one uses the "foomatic-rip" filter with a similar syntax as the "lpr" |
| 862 |
commands of CUPS and GNUlpr. Use "-o" to include option settings: |
| 863 |
|
| 864 |
foomatic-rip [-P <queue>] [--ppd <ppdfile>] |
| 865 |
[-o <option1>=<value1>] [-o <option2>=<value2>] |
| 866 |
[-o <option3>] [<file1>] [<file2>] ... [ > <destination> ] |
| 867 |
|
| 868 |
Options in [...] can be left out. The options mean: |
| 869 |
|
| 870 |
-P <queue> The queue where the job should be printed. If not given the |
| 871 |
default is chosen. |
| 872 |
--ppd <ppdfile> If your printer is not configured (or for testing/ |
| 873 |
debugging) you can specify a PPD file which defines |
| 874 |
how the job should be handled. The PPD file cane be |
| 875 |
one generated by Foomatic, but also one shipped with a |
| 876 |
PostScript printer. |
| 877 |
-o <option> The switch "option" is set. |
| 878 |
-o <option>=<value> The option "option" is set to the value "value". |
| 879 |
-o docs Print listing of the options. Works only when you provide |
| 880 |
a file or something on standard input (which will not be |
| 881 |
printed). |
| 882 |
<file> File(s) to be printed. When no file is given, the data to |
| 883 |
print is taken from standard input. |
| 884 |
> <destination> If no destination ("/dev/lp0", ...) for the output |
| 885 |
data is specified, the data is directed to standard |
| 886 |
output. In most cases it makes more sense to re-direct |
| 887 |
the output to a printer or into a file. |
| 888 |
|
| 889 |
The first example from above looks like the following now: |
| 890 |
|
| 891 |
foomatic-rip -P DeskJet -o PageSize=A4 -o Quality=presentation file.ps |
| 892 |
|
| 893 |
Print a listing of valid options with |
| 894 |
|
| 895 |
foomatic-rip -P DeskJet -o docs ~/.bashrc |
| 896 |
|
| 897 |
If you want to try out a PostScript printer which you have not configured |
| 898 |
yet, do |
| 899 |
|
| 900 |
foomatic-rip --ppd HP_LaserJet_4050_Series.ppd file.ps > /dev/lp0 |
| 901 |
foomatic-rip --ppd HP_LaserJet_4050_Series.ppd file.ps | nc -w1 host 9100 |
| 902 |
|
| 903 |
The first command assumes that the printer is on the first parallel |
| 904 |
port. Make sure that you have write permissions to /dev/lp0. The |
| 905 |
second command one has to use when the printer is connected via the |
| 906 |
local network, has the host name "host" and listens for jobs on port |
| 907 |
9100 (TCP/Socket/JetDirect). |
| 908 |
|
| 909 |
You can also use this for debugging purposes, for example when your |
| 910 |
jobs do not get printed. This surrounds the spooler and sends the |
| 911 |
filtered job directly to the printer. When they get printed this way, |
| 912 |
the problem is probably a problem of the spooler, not of the printer |
| 913 |
or the driver. |
| 914 |
|
| 915 |
Note that "foomatic-rip" only exits when the whole data is passed |
| 916 |
through the printer driver and sent to the printer, because we have no |
| 917 |
spooler which stores the data on the hard disk to print out of the |
| 918 |
background. |
| 919 |
|
| 920 |
|
| 921 |
Applying options only to selected pages |
| 922 |
--------------------------------------- |
| 923 |
|
| 924 |
With most spoolers options can be supplied only to selected pages when |
| 925 |
Foomatic is used. The queues can be either Foomatic queues or they can |
| 926 |
use a manufacturer-supplied PPD file with "foomatic-rip". To make CUPS |
| 927 |
using "foomatic-rip" with manufacturer-supplied PPD files, add the |
| 928 |
line |
| 929 |
|
| 930 |
*cupsFilter: "application/vnd.cups-postscript 0 foomatic-rip" |
| 931 |
|
| 932 |
to the PPD file. To make an option setting acting only on certain |
| 933 |
pages one only needs to preceed the option by a page specification: |
| 934 |
|
| 935 |
CUPS, GNUlpr, CPS, no spooler: |
| 936 |
lpr -o 1:InputSlot=Letterhead |
| 937 |
lpr -o even:Watermark=on |
| 938 |
lpr -o 1,6-10,15,20-:MediaType=YellowPaper |
| 939 |
|
| 940 |
LPRng: |
| 941 |
lpr -Z 1-2:MediaType=Cardboard |
| 942 |
|
| 943 |
LPD: |
| 944 |
lpr -J "1,6-10,15,20-:MediaType=YellowPaper" |
| 945 |
|
| 946 |
PPR (RIP): |
| 947 |
ppr --ripopts "1:InputSlot=Letterhead" |
| 948 |
|
| 949 |
PPR (Interface) |
| 950 |
ppr -i "1:InputSlot=Letterhead" |
| 951 |
|
| 952 |
The syntax is "even", "odd", or giving comma-separated page numbers or |
| 953 |
page ranges. Applying options to selected pages with PDQ is not |
| 954 |
supported. Note that specifying a page selection with the "-F" option |
| 955 |
of "ppr" does not work. |
| 956 |
|
| 957 |
Option settings with page selection override option settings for the |
| 958 |
whole document on the appropriate pages. More specific (less pages |
| 959 |
selected) settings override less specific settings on the appropriate |
| 960 |
pages. |
| 961 |
|
| 962 |
Page-specific option settings cannot be set as default in the PPD |
| 963 |
files, but they can be set by editing the ~/.lpoptions file of CUPS. |
| 964 |
|
| 965 |
|
| 966 |
More info |
| 967 |
--------- |
| 968 |
|
| 969 |
Enter |
| 970 |
|
| 971 |
foomatic-configure -h |
| 972 |
foomatic-printjob -h |
| 973 |
|
| 974 |
for a full option list or see the man pages: |
| 975 |
|
| 976 |
man foomatic-configure |
| 977 |
man foomatic-printjob |
| 978 |
|