Show Lecture.Printing as a slide show.
CT320 Printing
Colorado State University
Computer Science Department
Original slides from Dr. James Walden at Northern Kentucky University.
Printing
- Printer Languages
- Printing Systems
- CUPS Printing
- Troubleshooting
- System V Printing
- BSD Printing
- Printer Practicalities
Printer Languages
- PostScript (.ps): Most common page description language on Unix and Linux systems, from Adobe.
- PDF (.pdf): Portable document format from Adobe, not a page description language, usually translated.
- PCL (.pcl): Printer control language from Hewlett-Packard, binary format for laser and inkjet printers.
- XHTML (.xhtml): Markup language for printing based on XML specification.
- XPS (.xps): XML Paper Specification from Microsoft, not currently very widely used.
- PJL (.pjl): Printer Job Language from HP uses metalanguage to describe printer jobs.
PostScript
PostScript is a Page Description Language (PDL) that was invented around the same time as the laser printer.
- Now is the most common PDL on Unix and Linux systems, and many printers can directly interpret.
- Developed by Adobe Systems, but evolved from InterPress, a Xerox proprietary language.
- You can read most PostScript programs with a text editor, not a binary format.
- Interpreted by a PostScript-specificRaster Image Processor (RIP) that produces a bitmap.
Portable Document Format (PDF) from Adobe systems was designed for the interchange of documents.
- Currently dominates this market, almost every other tool export to PDF (Microsoft Word, PowerPoint, etc.)
- Not a page description language, but many convertors exist between PDF and PS or PCL.
- Adobe Acrobat provides a downloadable reader
and proprietary tools for generating PDF content:
- Adobe Reader 9 (2010), Adobe Reader X (2012)
- PDF 1.7 (2008), PDF 2.0 (2011)
PCL
Printer Command Language (PCL) was invented by Hewlett-Packard for its laser and inkjet printers.
- PCL is a page description language that tells printers how to print pages.
- PCL jobs are binary, not human readable, so must be manipulated by tools.
- HP has a PCL dialect with custom commands that take
advantage of specific printer features:
- PCL6: Drawing tools, color handling, paper handling, font loading, compresion etc.
XHTML
Extensible HyperText Markup Language (XHTML) is recommended by the World Wide Web consortium.
- Cleaner version of HTML, based on well-formed XML specification that can be parsed in a standard fashion.
- XHTML-Print provides a data stream, e.g., from a Web page
to be rendered on low end printers.
- Example: you can browse the web and print a web page from a Bluetooth printer
- Mostly used by content management systems based on web pages.
Printing Systems
- Major printing systems: CUPS, BSD, System V are the historical systems used on Unix and Linux.
- Based on a print spooler or queuing system for scheduling print jobs.
- Requires user-level utilities based on CLI or GUI that allows the user to queue, cancel, or query jobs.
- Back end drivers and software to communicate with the actual printing devices (local or network).
- Network protocols that allow print spoolers to communicate and transfer jobs.
CUPS Overview
- Common Unix Printing System (CUPS) is a standards-based open source printing system.
- Original developed by Apple for OS X and other Unix environments.
- A CUPS server is a spooler that maintains print queues for clients, with a client-server architecture.
- The client can use either command line interfaces
(
lpr
,lpq
) or a graphical interface (kprinter). - Also supports a web interface to configure and administer printer jobs.
CUPS Printing
- Client transmits copies of the files to the CUPS server, which reads them and stores them in a queue.
- The CUPS server then will process each file as the printer becomes available.
- The CUPS server examines both the printer’s postscript capabilities and the document to make sure it prints properly on the device.
CUPS Printing
- Preparation for a job requires the CUPS to pass it
through a pipeline of filters which perform a variety of functions.
- Reformat if necessary
- Transfer a job from one PDL to another
- Printer initialization
- Then the document finally gets passed to the last stage which is the pipeline that sends the job from the host via the appropriate protocol, e.g. USB port.
CUPS Commands
- Commands allow the user to queue, suspend, cancel, or send jobs from one queue to another.
lpr
: asks the CUPS server to queue a print job
lpr -P laser01 myfile.ps
lpq
: requests job status from the CUPS server
lpq -P laser01
lpstat
: summary of CUPS server
lpstat -t
lprm
: remove a print job from the CUPS server
lprm <id>
CUPS Web Interface
Multiple Printers
- CUPS will manage multiple queues for multiple printers.
- A simple
-p
option will specify which printer queue to use. - You may also set a default printer in two different ways:
- PRINTER environment variable
export PRINTER=printer_name
- Telling CUPS via a command
lpotions -dprinter_name
Printer Instances
- These allow you to set several instances for different printing types, like a draft print, or a normal print.
lpoptions -p laser02/2up -o number-up=2
- Creates instance
laser02
that performs 2-up printing
Network Printing
- All CUPS daemons communicate with each other, which makes it easy with multiple computers.
- To configure CUPS daemon to accept print jobs
edit the file
/etc/cups/cupsd.conf
. - To allow two printers on two different subnets to communicate, edit the file to set up a slave server.
- The configuration file will also allow you to set up multiple queues for one printer.
CUPS Protocol
- The underlying protocol for CUPS is HTTP that uses port 631
- CUPS servers are web servers, clients can be GUI or CLI or a web interface
- Uses Internet Printing Protocol (IPP) based on simple GET and POST commands.
CUPS Administration
- Responsibilities of a CUPS server administrator:
- Install printers
- Route network Printers
- Setup authorization
- Editing configuration files
- Specifying paper size
- Printer maintenance!
- Linux system components of a CUPS server
cupsd
— daemon process that manage print jobs/etc/cups/cupsd.conf
— configuration file
CUPS Administration
- Used on Unix, Linux, and Mac operating systems
- Any printer that can be networked
- Any server that can act as a CUPS server
- Handy browser interface for easy maintenance
- Centralized system for printing and management
- Standardized
- Efficient for large printers
- Printer-specific Information
- Can print multiple printer file formats
- pdf, dvi, gif, jpeg, tiff, and more
CUPS Implementation
- What you need: Printer, Server, Client
- Connect server to network via config files
- Use the web interface to configure the rest
- It’s in a package:
# apt install cups
Remote CUPSing
- You’d be crazy to configure CUPS on every computer at your site.
- Instead, have one central print server, that is running
cupsd
. - On all other machines, just configure
/etc/cups/client.conf
:
$ cat /etc/cups/client.conf servername parsons.cs.colostate.edu
CUPS Documentation
- Nemeth, E, Snyder, G, & Hein, T (2011) Unix and Linux Administration Handbook Fourth Edition, Prentice Hall
- Wikipedia: CUPS Common Unix Printing System retrieved Sep. 2012 from https://en.wikipedia.org/wiki/CUPS
- Common UNIX Printing System, https://www.cups.org/
Troubleshooting
- If you change the
cupsd.conf
file, be sure to restart the daemon - Logging
- Page log: list of pages printed
- Access log: requests processed by server
- Error log: printer or server errors
- All typically kept under
/var/log
Troubleshooting
Problem | Where to look |
---|---|
Name resolution, permissions | System log files on sending machine |
Permissions | System log files on print server |
Missing filters, unknown printers, missing dirs, etc. | CUPS log files on sending machine |
Messages about bad device names, bad formats, etc. | CUPS log files on print server |
System V Printing
Command | Location | Function |
---|---|---|
accept | /usr/sbin | make queue accept printing jobs |
cancel | /bin | remove print job from queue |
disable | /bin | disable printing jobs from a queue |
enable | /bin | enable printing jobs from a queue |
lp | /bin | queues jobs for printing |
lpadmin | /usr/sbin | configure the printing system |
lpmove | /usr/sbin | move printing jobs between queues |
lpsched | /usr/lib | schedules and prints jobs |
lpshut | /usr/sbin | stops printing services |
lpstat | /bin | reports status of printing services |
reject | /usr/sbin | make queue reject printing jobs |
BSD Printing
Command | Location | Function |
---|---|---|
lpc | /usr/sbin | controls a printer or queue |
lpd | /usr/sbin | schedules and prints jobs |
lpq | /usr/bin | show print queue and status |
lpr | /usr/bin | queues jobs for printing |
lprm | /usr/bin | cancels a queued print job |
lptest | /usr/bin | prints a test page |
Printer Practicalities
- Printer selection
- Supported well by Linux?
- PS, non-PS?
- GDI (Graphics Device Interface) printers
- WinPrinters
- Supported better by Windows
Printer Practicalities (cont.)
- Duplexing
- Do you really need it?
- Accessories
- Memory
- Large documents
- Trays
- Memory
- Serial or parallel?
- Network printers
- Network interfaces
- Faster
- Better for large networks
- Network interfaces
Printer Practicalities (cont.)
- Turn off banner pages
- Waste of toner/paper
- Recycle!
- User print previewers
- Printers are cheap, ink/toner are not
- Monitor cost/page
- PaperCut
Printer Practicalities (cont.)
- What’s it going to cost me?
- Depends on the size of the printer
- Larger, more efficient
- Smaller, more costly
- Printers cost $200–$10000
- Total cost of ownership greatly exceeds the original purchase price
- Maintenance costs are high if you have to call a service technician
- Laser printers are generally more cost effective per page of printing