Book Image

CUPS Administrative Guide

By : Ankur Shah
Book Image

CUPS Administrative Guide

By: Ankur Shah

Overview of this book

Table of Contents (16 chapters)
CUPS Administrative Guide
Credits
About the Author
Acknowledgement
About the Reviewer
Preface

Evolution of CUPS as a Printing System


In 1993, a company called Easy Software Products (ESP) was started, aimed at supporting the Digital UNIX and Linux operating systems. Unfortunately, these operating systems used the original LPD for printing, so you couldn't pass options to the printer drivers. This alone would cripple any drivers you could develop. To make matters more complicated, at least three versions of the LPD were in common use, and they were not 100% compatible with each other.

The original design of the Common UNIX Printing System (CUPS) was based around the LPD network protocol. Later, developers added support for various features such as remote administration, and authentication when the Internet Printing Protocol (IPP) working group was created. The IPP working group originally was just going to update the LPD network protocol, but quickly changed direction to create a much more functional and extensible protocol that could evolve as needed to support new technologies.

Architecture of CUPS

CUPS provides a mechanism that allows print jobs to be sent to printers in a standard fashion. The data is sent to a scheduler, which then sends jobs to a filter system that converts the print job into a format which the printer will understand. The filter system then passes the data on to a backend—a special filter that sends print data to a device or a network connection.

The primary advantage of CUPS is that it is a standard and modularized printing system that can process numerous data formats on the print server. Previously, it was difficult to find a standardized solution that would allow numerous printers to print their full feature sets. For instance, the System V and Berkeley printing systems were largely incompatible with each other, and they required setting up complicated scripts and workarounds to convert from the program's data format to a format the printer understood. They often didn't know how to detect the file format that was being sent to the printer and thus could not convert data correctly. They also did their data conversion on the workstation and not on the server.

With CUPS, it is far easier for printer manufacturers and printer driver developers to create drivers that work natively on the print server than before. As the processing is done on the server, it is also easier to allow for network-based printing. Another advantage that CUPS has is that when it is used with Samba software, the printers can be used for remote print from and to Windows PCs.

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

  • Printer and class definition files

  • MIME type and conversion rule files

  • PostScript Printer Description (PPD) files

The HTTP server configuration file is purposely similar to the Apache web server configuration file and defines all 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, in a round-robin fashion.

The MIME type files list the supported MIME (Multipurpose Internet Mail Extensions) types (text/plain, application/postscript, and so on) and the "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 can describe the capabilities of all the printers, not just PostScript printers. There is one PPD file for each printer. PPD files for non-PostScript printers define additional filters through CUPS Filter 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.

Note

You can get detailed information on the license of CUPS and other supported software at: http://www.cups.org/documentation.php/license.html

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 ("printer server") when printer browsing is enabled.

The System V administration 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 the scheduler.

Filters

A filter program reads from the standard input or from a file if a filename is supplied, and then sends the output to the backend in a format the printer recognizes. The filters supports a common set of options including printer name, job ID, username, job title, number of copies, and job options. 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. Instead of using the Ghostscript printer drivers and frontend, the CUPS filter uses a generic raster printer driver and CUPS-compliant frontend to support any kind of raster printer. This allows the same printer driver filter to be used for printing raster data from any filter. We will discuss all CUPS based drivers such as PostScript Printer Drivers (PPD), Ghostscript drivers and so on in detail in the section, Printer Drivers in Chapter 3 on Printer Management.

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 printer drivers.

Note

PostScript Raster Image Processors (RIP) are the filters that convert PostScript files into high resolution raster images. This means that the RIP can take the digital information about fonts and graphics that describe the appearance of your file and translate it into an image composed of individual dots that the imaging device.

Backends

A backend program is a special filter that sends print data to a device or network connection. This program is usually located in /usr/lib/cups/backend/. The backends for parallel, serial, usb, lpd, ipp, and socket (for AppSocket & JetDirect) connections are provided in CUPS 1.1 & the later versions. The SAMBA version 2.0.6 and higher includes a SMB backend (smbspool) that can be used with CUPS 1.0 or higher for printing to Windows.

Network Printing

Traditionally, network printing has been one of the hardest things to get working under UNIX. One reason is that each vendor added his or her 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 each network printer on each 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. The feature will be discussed in Chapter 8Monitoring CUPS where we explore SNMP protocol within CUPS.

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. In addition, failsafe and load-balancing functions are enabled simply by defining the same printer on multiple servers. The feature of classes will be discussed in Chapter 4Managing Multiple Printers at a Time.