An Overview of the
Common UNIX Printing System,
Version 1.1

July 10, 2000
Michael Sweet, Easy Software Products
Copyright 1998-2003, All Rights Reserved.

This whitepaper describes the Common UNIX Printing SystemTM ("CUPSTM"), a portable and extensible printing system for UNIX®. CUPS is being developed by Easy Software Products, a software firm located in Hollywood, Maryland that has been selling commercial software for UNIX since 1993 through more than 40 distributors serving over 80 countries worldwide.

Additional information on CUPS is available on the World Wide Web at "http://www.cups.org/".

Background

Printing within UNIX has historically been done using one of two printing systems - the Berkeley Line Printer Daemon ("LPD") [RFC1179] and the AT&T Line Printer system. These printing systems were designed in the 70's for printing text to line printers; vendors have since added varying levels of support for other types of printers.

Replacements for these printing systems have emerged [LPRng, Palladin, PLP], however none of the replacements change the fundamental capabilities of these systems.

Over the last few years several attempts at developing a standard printing interface have been made, including the draft POSIX Printing standard developed by the Institute of Electrical and Electronics Engineers, Inc. ("IEEE") [IEEE-1387.4] and Internet Printing Protocol ("IPP") developed by the Internet Engineering Task Force ("IETF") through the Printer Working Group ("PWG") [IETF-IPP]. The POSIX printing standard defines a common set of command-line tools as well as a C interface for printer administration and print jobs, but has been shelved by the IEEE.

The Internet Printing Protocol defines extensions to the HyperText Transport Protocol 1.1 [RFC2616] to provide support for remote printing services. IPP/1.0 was accepted by the IETF as an experimental Request For Comments [RFC] document in October of 1999. Since then the Printer Working Group has developed an updated set of specifications for IPP/1.1 which have been accepted by the IETF and are awaiting publication as proposed standards. Unlike POSIX Printing, IPP enjoys widespread industry support and is poised to become the standard network printing solution for all operating systems.

CUPS uses IPP/1.1 to provide a complete, modern printing system for UNIX that can be extended to support new printers, devices, and protocols while providing compatibility with existing UNIX applications. CUPS is free software provided under the terms of the GNU General Public License and GNU Library General Public License.

History

The first production release of CUPS (based on IPP/1.0) was released in October of 1999. Since then, we have released several patch updates to the original CUPS 1.0 release that addressed security, portability, and bugs found, but no new functionality was added to improve the stability of the CUPS code.

CUPS 1.1 is based on IPP/1.1 and adds many of the functional enhancements that have been requested by our users. As with 1.0, CUPS 1.1 will be followed by patch releases that address any problems found with the software but add no new features.

Design Overview

Like most printing systems, CUPS is designed around a central print scheduling process that dispatches print jobs, processes administrative commands, provides printer status information to local and remote programs, and informs users as needed. Figure 1 shows the basic organization of CUPS.

Figure 1 - CUPS Block Diagram

Scheduler

The scheduler is a HTTP/1.1 server application that handles HTTP requests. Besides handling printer requests via IPP POST requests, the scheduler also acts as a full-featured web server for documentation, status monitoring, and administration.

The scheduler also manages a list of available printers on the LAN and dispatches print jobs as needed using the appropriate filters and backends.

Configuration Files

The configuration files consist of:

The HTTP server configuration file is purposely similar to the Apache server configuration file and defines all of the access control properties for the server.

The printer and class definition files list the available printer queues and classes. Printer classes are collections of printers. Jobs sent to a class are forwarded to the first available printer in the class, round-robin fashion.

The MIME type files list the supported MIME types (text/plain, application/postscript, etc.) and "magic" rules for automatically detecting the format of a file. These are used by the HTTP server to determine the Content-Type field for GET and HEAD requests and by the IPP request handler to determine the file type when a Print-Job or Send-File request is received with a document-format of application/octet-stream.

The MIME conversion rule files list the available filters. The filters are used when a job is dispatched so that an application can send a convenient file format to the printing system which then converts the document into a printable format as needed. Each filter has a relative cost associated with it, and the filtering algorithm chooses the set of filters that will convert the file to the needed format with the lowest total "cost".

The PPD files describe the capabilities of all printers, not just PostScript printers. There is one PPD file for each printer. PPD files for non-PostScript printers define additional filters through cupsFilter attributes to support printer drivers.

CUPS API

The CUPS API contains CUPS-specific convenience functions for queuing print jobs, getting printer information, accessing resources via HTTP and IPP, and manipulating PPD files. Unlike the rest of CUPS, the CUPS API is provided under the terms of the GNU LGPL so it may be used by non-GPL applications.

Berkeley and System V Commands

CUPS provides the System V and Berkeley command-line interfaces for submitting jobs and checking the printer status. The lpstat and lpc status commands also show network printers ("[email protected]") when printer browsing is enabled.

The System V administation commands are supplied for managing printers and classes. The Berkeley printer administration tool (lpc) is only supported in a "read-only" mode to check the current status of the printer queues and scheduler.

Filters

A filter program reads from the standard input or from a file if a filename is supplied. All filters must support a common set of options including printer name, job ID, username, job title, number of copies, and job options. All output is sent to the standard output.

Filters are provided for many file formats and include image file and PostScript raster filters that support non-PostScript printers. Multiple filters are run in parallel to produce the required output format.

The PostScript raster filter is based on the GNU Ghostscript 5.50 core. Instead of using the Ghostscript printer drivers and front-end, the CUPS filter uses a generic raster printer driver and CUPS-compliant front-end to support any kind of raster printer. This allows the same printer driver filter to be used for printing raster data from any filter.

CUPS Imaging

The CUPS Imaging library provides functions for managing large images, doing colorspace conversion and color management, scaling images for printing, and managing raster page streams. It is used by the CUPS image file filters, the PostScript RIP, and all raster printers drivers.

Backends

A backend program is a special filter that sends print data to a device or network connection. Backends for parallel, serial, USB, LPD, IPP, and AppSocket (JetDirect) connections are provided in CUPS 1.1.

SAMBA version 2.0.6 and higher includes a SMB backend (smbspool(1)) that can be used with CUPS 1.0 or 1.1 for printing to Windows.

Network Printing

Traditionally, network printing has been one of the hardest things to get working under UNIX. One reason is because each vendor added their own extensions to the LPD protocol (the previous standard for network printing), making cross-platform printing difficult if not impossible.

Another reason is that you have to administer every network printer on every client machine. In some cases you can "clone" the printer configuration from a "master" client to each of the others, but even that can be time-consuming and error-prone. Something better is needed.

CUPS provides "printer browsing", which allows clients to automatically see and use printers from any server on a LAN. This means that you only need to configure the server and the clients will automatically see the printers and classes on it.

In addition, CUPS can automatically merge multiple identical network printers into "implicit classes". This allows clients to send jobs to the implicit class and have them print on the first available printer or server. In addition, failsafe and load-balancing functions are enabled simply by defining the same printer on multiple servers!

New Features in CUPS 1.1

CUPS 1.1 includes many new features and capabilities:

  1. Backends
  2. Banner Page Support
  3. Digest Authentication
  4. Directory Services
  5. Directory Structure Changes
  6. Documentation
  7. Drivers
  8. Filters
  9. IPP Support
  10. Job Persistence
  11. LPD Client Support
  12. User-Defined Printers and Options
  13. Web Administration Interface

1. Backends

CUPS 1.1 implements a new backend interface for retrieving a list of available devices for CUPS clients. This allows administration interfaces to query the CUPS scheduler for a list of available devices, automatically configure printers if the device identification information is available, and present the user with a list of available devices rather than relying on the user to know what devices are configured on the system.

The new release also includes a backend for USB printers under *BSD and Linux. Support for USB under Solaris 8 will be provided in a subsequent patch release.

2. Banner Page Support

CUPS 1.1 includes support for banner pages at the beginning and end of a job. Banner pages may be of any file format and support variable substitution for job titles, usernames, etc. Default banner pages are associated with each printer and can be overridden with command-line options by the user.

3. Digest Authentication

Digest authentication provides a more secure method of authenticating access to the printing system. Unlike Basic authentication, Digest authentication does not send passwords "in the clear" so it is more difficult to gain unauthorized access to your system.

CUPS 1.1 implements Digest authentication using a special MD5 password file instead of the UNIX password file. This file is managed using the new lppasswd command.

4. Directory Services

CUPS 1.1 adds new directory service ("printer browsing") features to make using CUPS on large LANs and WANs easier. You can now poll a remote server for printer information and relay it to the LAN as well as restrict what printer information is processed (e.g. to "hide" servers, domains, or networks that you don't want to see.)

5. Directory Structure Changes

CUPS 1.1 now uses a directory structure that complies with the Filesystem Hierarchy Standard ("FHS"), version 2.0. This should make integration into existing Linux and *BSD distributions a lot easier.

6. Documentation

The CUPS 1.1 documentation has gone through many revisions, including a completely rewritten administrators manual, a new programmers manual, and an IPP implementation reference manual.

7. Drivers

CUPS 1.1 includes drivers for EPSON dot-matrix and inkjet printers. As with the HP PCL drivers, the EPSON drivers don't necessarily provide the best possible output for each printer but should provide adequate printing quality for general day-to-day printing.

8. Filters

CUPS 1.1 includes new image, PostScript, PDF, and text filters. The image filters have been upgraded to support Windows BMP and Alias PIX files.

The PostScript filter is now based off GNU Ghostscript 5.50. The new filter provides much better performance with higher-resolution printers and supports most Level 3 PostScript language features.

The new PDF filter is based off the excellent Xpdf software from Derek Noonburg and supports automatic page scaling. The new filter is a faster, smaller, more reliable replacement for the GNU Ghostscript PDF filtering that was used in CUPS 1.0.

The new text filter now supports bidirectional text and can embed fonts as needed.

9. IPP Support

Probably the least visible portion of CUPS is the IPP support. CUPS 1.1 implements all of the required IPP/1.1 operations and attributes and most of the optional ones. The optional Create-Job and Send-File operations are now implemented, allowing for better System V printing system compatibility (one job ID per lp command) and support for banner pages.

10. Job Persistence

CUPS 1.1 supports job persistence. This means that jobs are preserved even after a reboot, a feature that was sorely missing from CUPS 1.0.

In addition, CUPS 1.1 allows you to keep job information after the job has printed. The basic post-job persistence mode provides a job history (number of pages printed, time job was printed, etc.) but does not preserve the actual job files. This can be changed to discard all information after a job is printed or keep the job files after printing so you can reprint a job at some later time.

11. LPD Client Support

By popular request, CUPS 1.1 supports LPD-based clients using a new mini-daemon that handles LPD requests and passes them on to the main server.

12. User-Defined Printers and Options

CUPS 1.1 includes support for user-defined printers and options via a new lpoptions command. User-defined printers are special instances of the available printers (e.g. "printer/instance" or "[email protected]/instance") that can have their own default options such as media size, resolution, and so forth. The lpoptions command can also be used to set a different default printer queue.

13. Web Administration Interface

CUPS 1.0 provided a simple class, job, and printer monitoring interface for web browsers. CUPS 1.1 replaces this interface with an enhanced administration interface that allows you to add, modify, delete, configure, and control classes, jobs, and printers.

Software Using CUPS

A lot has happened since CUPS 1.0 came out, and many software packages are supporting CUPS. We have contributed code to the SAMBA team to support CUPS, and parts of that are already available in SAMBA 2.0.6 and 2.0.7. With any luck the final pieces that provide a complete integration with SAMBA will be available in the next release of SAMBA.

Two graphical interfaces have appeared on the scene that use CUPS as well. The KUPS project provides a KDE-based interface for CUPS and can be found at:

The X Printing Panel ("XPP") project provides a graphical printing panel for CUPS and can be found at:

Numerous other filters, drivers, tutorials, etc. have been made available on the CUPS Links web page, available at:

Finally, our own ESP Print Pro software uses CUPS to provide drivers for thousands of printers and can be found at:

Operating Systems Using CUPS

One of our goals has always been to get as many UNIX/Linux distributions using CUPS as possible. Debian is currently providing CUPS as part of its stable distribution, and many other distributions are considering it in their next releases.

Summary

The Common UNIX Printing System provides a modern printing interface for UNIX applications that is both flexible and user-friendly. The software provides System V and Berkeley compatible command-line interfaces to ensure compatibility with existing applications. CUPS 1.1 adds many new features that make it an even better choice for printing under UNIX.

Who to Contact

For more information on CUPS please contact us at:

References

IEEE-1387.4
System Administration - Part 4: Printing Interfaces (draft)
IETF-IPP
Internet Printing Protocol/1.1
LPRng
An enhanced, extended, and portable implementation of the Berkeley LPR print spooler functionality
Palladin
A printing system developed at the Massachussetts Institute of Technology
PLP
The Portable Line Printer spooler system
RFC1179
Line Printer Daemon Protocol
RFC2046
Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types
RFC2616
Hypertext Transfer Protocol -- HTTP/1.1

Trademarks

The Common UNIX Printing System, CUPS, and the CUPS logo are the trademark property of Easy Software Products. All other trademarks are the property of their respective owners.