GNU/Linux
Printing
CUPS and the LinuxPrinting.org Database
Home/News
  The HOWTO
    QuickStart
    Index
    Other Formats
  Articles
  Forums
  Suggested Printers
  The Database
    Printer Listings
    Driver Listings
  Foomatic
    LPD Docs
    LPRng Docs
    PDQ Docs
    CUPS Docs
  Vendor Info
  Projects
  Manual Pages

About this site
Contributing

Grant Taylor

I support CUPS through the CUPS-O-Matic PPD generator and companion cupsomatic CUPS backend filter. What follows is quick-start information on setting up your printer with this pair, followed by some details on how it all works.

Note that cupsd sometimes dies a horrible death when given buggy PPD files; when this happens lpadmin and other CUPS commands will hang. I had to recompile and use a debugger to figure out what was going on as I developed cupsomatic. CUPS versions through 1.1b5 have some bad security flaws to do with temporary files; caveat emptor. That said, CUPS and XPP do in fact work, and together they form a very nice system suitable for use in many environments.

Quick Start

This is mostly useless(tm) if you have a Postscript printer; in that case go get a PPD from your printer's vendor.

This system is supposed(tm) to work with CUPS 1.0 or 1.1. Check that you have this installed; see the CUPS website for details on that.

  1. You will need the driver that you wish to use installed (cupsomatic and the PPD file only provide a way to connect CUPS to your driver). There are several styles of driver; the ones suitable for your printer will be referenced from your printer's page in the database:
    Ghostscript
    Most Ghostscript drivers are included in typical distributions of Ghostscript, but some are not. You can see the available Ghostscript drivers on your system with `gs -h'. If the driver you need is not listed; you will need to obtain a new Ghostscript package with the driver included, or compile Ghostscript yourself. For many third-party drivers, the driver authors distribute special Ghostscript packages including the needed driver; give that a shot first.
    Uniprint
    Some Ghostscript drivers are Uniprint drivers. These consist simply of a upp file containing various parameters; most are included with Ghostscript. Others you will need to obtain and place in your ghostscript library directory.
    Filter
    Some drivers are separate programs which run together with Ghostscript. You will need to obtain and install the separate program, as well as Ghostscript.
  2. You will need a PPD for the free software printer driver you wish to use. Find the driver page for your printer driver from your printer's page in the database. If there are `Execution Details', then the system has enough information to generate a PPD for you, and there should be a CUPS-O-Matic selector for you to select your printer from in the `Printing system interfaces' section of the page. If there is not, then I simply haven't obtained (or entered) execution information about that driver; you're out of luck for now.
  3. Save the PPD file as the name suggested by the comments in the file itself, in the directory /usr/share/cups/model (may be a different location for you, but it will be called something/model). The PPD file does not have to be executable, but it should be world-readable.
  4. You will need the cupsomatic Perl script installed. Save the cupsomatic script as the file /var/lib/cups/filter/cupsomatic; the location may differ on other installations (Red Hat appears to place this under /usr/lib/cups/filter/, for example). Be sure to mark the script as executable/readable with `chmod 755 cupsomatic', and be sure that your Perl interpreter is in /usr/bin (if not, edit the first line of the cupsomatic script).

    There are a few other things you can set in the script; see the comments. Mostly these seem apply to users of non-GNU systems.

  5. You may want (or need!) to install the foomatic-gswrapper companion script.
  6. Execute as an appropriately empowered administrator (usually root, but perhaps you have approved other users as printer administrators) the proper setup command as found in the CUPS documentation. Here are a few examples for the Epson Stylus 860 Ghostscript driver defined in the database-generated file Epson-Stylus_Color_860-stp.ppd:
    lpadmin -p foo1 -m Epson-Stylus_Color_860-stp.ppd -v parallel:/dev/lp0 -E
    This defines a print queue named 'foo1' connected to /dev/lp0, and enable said queue.
    lpadmin -p foo1 -m Epson-Stylus_Color_860-stp.ppd -v lpd://hostname/queuename
    This defines a print queue named 'foo1' connected over the network to the queue queuename offered by the LPD service on host hostname without enabling said queue.

Printing with cupsomatic

To actually use this now that you've set it up, you use the CUPS lp(1) command; given our example setup above,
$ lp -d foo1 -o PageSize=Letter -o Dither=Fast /etc/motd
Would use the stp driver to print on letter paper with fast-mode dithering to your Epson Stylus 860. See your driver's page on this site for details on the available options. There might also be some (PJL-based) options described on your printer's page. For many drivers, you'll want to use the lpoptions(1) command (in CUPS 1.1; 1.0 users could mangle the PPD instead) to lock down a set of sensible defaults for you. This is especially true for drivers like this Stylus one, which have large number of options.

To see the options available for your setup, send a print job with only the option `docs', like this: `lp -d foo1 -o docs /etc/hosts'. This will make cupsomatic print out an option summary (instead of the actual printjob; hence the file /etc/hosts; no, it can't be /dev/null).

Note that options with a user-provided integer or float value are not supported by the PPD syntax. With cupsomatic-based printers, you may specify these options on the command line, and CUPS will just sort of pass them along. XPP provides explicit support for cupsomatic PPD files to eliminate this problem. Other GUI tools, however, only handle normal PPD files, and thus won't show these options.

Usually, you can also use the media=..., sides=..., and duplex "standard" CUPS options as documented in the CUPS user manual; they should work if there are InputSlot, MediaType, and/or Duplex options for your driver.

For more information on using CUPS and defining print queues, consult the CUPS documentation.

If it doesn't work, turn on the debug flag at the top of cupsomatic, and examine the debugging output in the file /tmp/prnlog. And feel free to contact me for help.

How does it work?

There are three parts to the cups-o-matic scheme:

The Database
The database contains a number of tables which detail exactly how to execute a given printer driver. There are several front-ends which use these tables: the human-readable one generates the information shown on various driver pages, the one which generates a PDQ driver declaration, and the one you care about, which computes a PPD file. (This is a Perl program called cups-o-matic.cgi).
The PPD
The PPD file generated by the database contains two things. It contains the normal option declarations you'd expect in a PPD, for the various options known to the database. It also contains a Perl Data::Dumper encapsulation (in a structured comment) of the entire set of data about the free software driver being used.
The backend filter
The CUPS filter script `cupsomatic' is called by CUPS with various inputs, including both the PPD filename and the various options selected by the user. Cupsomatic opens the PPD, extracts the encapsulated execution data found there, and combines it with the user-provided option values to this to compute the proper command to execute for filtering. It also massages the standard CUPS option types into the more generic printer/driver-specific format used by the database.

CUPS completely supports normal PPD option types, which include boolean values and enumerated choices. PPDs do not support arbitrary user-inputted numerical arguments, so the cupsomatic doesn't currently do anything much with these. AFAIK, there's nothing stopping the user from explicity saying `-o Gamma=4.3' on the command line and having it work, but GUI tools are based on the PPD-defined options, so these arguments won't appear there. I might pre-select a range of legal values and treat floats and ints as enumerated types. Someone make a suggestion.

I added a bunch of special code to pick out the media= and sides= options. These now map sensibly to the PageSize, MediaType, and InputSlot enumerated selections, plus the boolean Duplex argument, if present. It's all a bit ugly if a driver supports an option that happens to be named the same as an existing standard ipp/cups option. Oh, well.

You can obtain a tarball of all CUPS-O-Matic PPD files plus the filter.

  Built with Genpage - Version: 1.0.4