CUPS filters

The core of the CUPS filtering system is based on Ghostscript, part of the GNU project. It consults PPD files, which are an industry standard for representing printer capabilities (two-sided printing, four-to-a-page, etc.).

For PostScript printers, the PPD file contains the printer-specific options (and nothing else) together with the corresponding PostScript code snippets that must be sent to the PostScript interpreter in order to activate a certain option.

For non-PostScript printers, the PPD file contains additional information about which printer driver program to use and the options available for the particular driver. If several drivers can be used for a given printer, several PPD files are found on the system.

Depending on the printer-specific options set for a certain print job (e.g., -o PageSize=A4), the filter system reads the suitable PostScript code snippets (the so-called “PostScript invocation values”) from the PPD file and inserts them in the PostScript data stream.

The original data has a MIME type determined by configuration options in /etc/cups/mime.types. If the type is not application/postscript, the data is converted to PostScript according to the /etc/cups/mime.convs configuration file. For example, text/plain is converted to PostScript with the /usr/lib/cups/filter/texttops program.

These filter files are usually found in the directory /usr/lib/cups/filter and, like CUPS backends, can be compiled code or shell scripts.

Get LPI Linux Certification in a Nutshell, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.