Search notes:

CUPS

CUPS stands for Common Unix Printing System.
CUPS is based on IPP, the Internet Printing Protocol and uses PostScript Printer Description (PPD) files to describe the capabilites of printers.

Starting CUPS

CUPS is started with cupsd (the cups scheduler), see man cupsd.

Configuration

/etc/cups/cupsd.conf is the main(?) configuration file for CUPS.

Printer drivers

lpinfo -m lists all available driver.

Shell commands

lpadmin configures CUPS printers and classes. For example, a printer might be added with
printer_name=ep901a
device_uri=usb:/EPSON/EP-901A
ppd_file=/opt/epson-inkjet-printer-escpr/ppds/EPSON/EPSON-EP-901A-epson-escpr-en.ppd.gz
lpadmin -p $printer -v $device_uri - P $ppds -E
lpinfo lists available devices and drivers that are known to the CUPS server.
Show connected and available printers:
lpstat -a
Print a file:
lp -d $PRINTER_NAME ~/document.txt
lp and lpr can be used to print files:
lp  -o media=A4 -o resolution=600dpi $file
lpr -o media=A4 -o resolution=600dpi $file

Monitoring

CUPS can be accessed via http://localhost:631/admin. 631 is the default port for the Internet Printing Protocol.
The user accessing CUPS must be member of the lpadmin group. (Otherwise, the webinterface might complain with Enter your username and password or the root username and password to access this page. If you are using Kerberos authentication, make sure you have a valid Kerberos ticket.)

Filters

Filters are used to render PostScript onto a pixel based device. These are necessary for printers that don't have built in post script support.
CUPS provides such filters: gstoraster (/usr/lib/cups/filter/gstoraster) and imagetoraster (/usr/lib/cups/filter/imagetoraster). These are based on the filter system of ghostscript.

Queues and Jobs

A queue is «attached» to a printer. It keeps track of the status of the printer (Enough paper? Printer jam? Toner reserver? etc).
A job is created when an application asks something to be printed. The job is placed into a queue and removed when the printing is finished.

Job Sequence

The application sends PostScript data to CUPS.
CUPS reads the destination printer's respective PostScript Printer Description (PPD) File to determine the necessary filters to convert the PostScript into the format the printer understands (such as PJL, PCL).
Usually, this is handed over to GhostScript.
The converted data is sent to the printers

Restarting cups

# /etc/init.d/cups restart

Installing Epson ET-4800

I somehow managed to install and configure Epson ET-4800 like so:
When trying to print, I got Stopped, Filter failure error message.
In the log file /var/log/cups/error_log, I found ET-4800-tq84: error while loading shared libraries: libcupsimage.so.2: cannot open shared object file: No such file or directory.
I also got the same error message by trying to manually execute /opt/epson-inkjet-printer-escpr/cups/lib/filter/epson-escpr-wrapper.
I am not sure anymore if I changed the log level from warn to debug in /etc/cups/cupsd.conf order to see this helpful error message. Anyway, I then installed the missing library as well: sudo apt -y install libcupsimage2.

TODO

http://localhost:631/help
http://localhost:631/documentation.html

See also

/etc/cups
/etc/cups/printers.conf: the printer configuration file for CUPS.
/etc/cups/cups-files.conf: The file and directory configuration file.
/var/log/cups
/var/log/cups/error_log: the general log file
/var/log/cups/access_log: the log file for all cupsd HTTP server activity.
/usr/share/cups
/usr/lib/cups/filter: the filter directory.
/var/spool/cups-pdf/$USER: the default directory into which pdfs are stored.
Avahi scans for printers on the local network.
At least in Debian, CUPS runs as user cupsys

Links

openprinting.org has resources to help with printing under Linux.
For example, it has the printer database which allows to search for a driver for a specific printer/manafacturer.

Index