Common Unix Printing System

From Christoph's Personal Wiki
Revision as of 00:59, 27 April 2007 by Christoph (Talk | contribs) (Network configuration scripts)

Jump to: navigation, search

The Common Unix Printing System (CUPS) is a modular printing system for Unix-like computer operating systems that allows a computer to act as a powerful print server. A computer running CUPS is a host which can accept print jobs from client computers, process them, and send them to the appropriate printer.

PostScript Printer Description (PPD)

PostScript Printer Description (PPD) files are created by vendors to describe the entire set of features and capabilities available for their PostScript printers. For example, a generic PPD file for all models of HP Color LaserJet contains:

*% =================================
*% Basic Device Capabilities
*% =================================
*LanguageLevel:        "2"
*ColorDevice:          True
*DefaultColorSpace:    CMYK
*TTRasterizer:         Type42
*FileSystem:           False
*Throughput:           "10"

MIME databases

During start-up, the CUPS daemon loads two MIME databases: mime.types that defines the known file types that CUPS can accept data for, and mime.convs that defines the programs that process each particular MIME type.[1]

The mime.types file has the syntax:

mimetype      { [file-extensions] | [pattern-match] }

For example, to detect an HTML file, the following entry would be applicable:

text/html       html htm \
printable(0,1024) + (string(0,"<HTML>") string(0,"<!DOCTYPE"))

The mime.convs file has the syntax:

source destination cost program

Some examples:

text/plain application/postscript 50 texttops
application/vnd.cups-postscript application/vnd.cups-raster 50 pstoraster
image/* application/vnd.cups-postscript 50 imagetops
image/* application/vnd.cups-raster 50 imagetoraster

User Interface tools

There are several tools created to help set up CUPS. The CUPS server itself runs a webserver administration interface on port 631.[2]

Tools

System V

lp 
the user command to print
lpstat 
shows the current print queue
cancel 
deletes a job from the print queue
lpadmin 
a sysadmin command that configures the print system
lpmove 
a sysadmin command that moves jobs between queues

LPD

lpr 
Assign a job to a queue.
lpq 
Display the jobs assigned to a queue and their print status.
lprm 
Remove a job from a queue.
lpc 
Control a queue.

Network configuration scripts

If you are using a network computer, you will need to add your IP address to the printer's address pool. Create a ifcfg file (usually in /etc/sysconfig/network-scripts) and call it something like ifcfg-eth0:0). Then add the following lines (replacing the IP address, etc.):

DEVICE=eth0:0
BOOTPROTO=static
IPADDR=192.168.xx.yy
NETMASK=255.255.255.0
NETWORK=10.0.xx.0
BROADCAST=192.168.xx.255
ONBOOT=yes
METRIC=10

You will also need to add your URI (i.e. printer IP address) to your /etc/cups/printers.conf file. As an example:

# Printer configuration file for CUPS v1.2.4
<Printer MyPrinter>
Info The_Name_of_Your_Printer
Location
DeviceURI ipp://192.168.xx.1/ipp
State Idle
StateTime 1162501383
Accepting Yes
Shared Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy retry-job
</Printer>

Of course, make sure you have your printer's PPD file in /etc/cups/ppd/

Then

/etc/init.d/network restart

See also

KDE

References

  1. Easy Software Products. CUPS Software Administrators Manual, File Typing and Filtering. (accessed 2007-01-09).
  2. CUPS Software Administrators Manual, "Managing Printers from the Web"

External links

Related links

  • OpenPrinting — resources to help with printing under free operating systems like Linux

PPD