Despite years of hype about the coming paperless office, printing has become more frequent and more complex as time has passed, not less so. Ordinary users now routinely print tens or even hundreds of pages a week, often including the sort of high-quality graphics formerly done only rarely, on expensive, special-purpose devices. This chapter discusses the printing subsystems of the various Unix versions we are considering. Nowhere is there more variation than in accessing printing devices and spooling jobs. The FreeBSD, Linux,[1] and Tru64 operating systems use the BSD spooling system, HP-UX and Solaris use the System V spooling system, and AIX uses its own spooling system. Each of them is discussed individually. [1] Linux distributions also offer the LPRng system, discussed later in this chapter. In some cases, this is now the default. In this chapter, I'll talk almost exclusively about "print" jobs, but the general discussion applies equally well to related hardcopy devices such asplotters. In fact, the Unix spooling subsystems are flexible enough to be used for purposes unrelated to printing: archiving data, running programs in batch mode, and playing music, among others.[2] [2] The spooling system can also be used to send faxes, a topic discussed in Chapter 12 (and placed there because most of the administrative tasks related to faxing concern interfacing to serial lines and modems). A spooling system typically includes the following components: - Printers
-
Current output devices include laser printers and inkjet printers, as well as special-purposes devices such as label printers. Printing can be done by a printer attached to the local computer via a serial, parallel, or USB port; by a printer on a remote system; or by a standalone device connected directly to the local area network. - User commands to initiate printing
-
The user specifies the file to print, which device to print it on (if there is more than one possibility), and any other necessary instructions. BSD calls them print jobs, while System V and AIX refer to them as print requests. - Queues
-
Queues store and sequentially process print jobs. Conceptually, a queue is basically a line waiting to use a specific device. - Spooling directories
-
Spooling directories hold pending jobs. Under BSD, the entire file to be printed is copied to a spooling directory. Under AIX and System V, by default only a small request file is generated, and the file is accessed in its original location at the proper time. - Server processes
-
Server processes accept print requests, set up and store the files associated with them, and transfer the resulting jobs from the spooling directory to the actual devices. - Filters
-
Filters transform the files to be printed into the internal formats required by the printer. Filters are programs which the print server runs automatically for each print job. - Administrative commands
-
These commands start and stop the entire subsystem or specific printers and manage queues and individual print jobs. In addition, configuration files are usually used to specify the various characteristics and desired settings for each printing device. They are typically modified automatically by the various administrative commands, but some files need to be edited manually. - Remote printing support
-
These days, remote printing is at least as common as local printing. A system that lets users on other hosts send jobs to some or all of its printers is referred to as a print server, and the remote systems from which jobs originate are thus its clients. We will consider remote printing in the context of each of the three spooling subsystems. | An excellent reference for all aspects of Unix printing is the book Network Printing by Todd Radermacher and Matthew Gast (O'Reilly & Associates). Despite its title, it discusses both the local and network-related aspects of print spooling, including a extended section on print filters. |
| Table 13-1 presents a summary of the spooling subsystem components for the various Unix versions. Table 13-1. Print system components Component | Location | Version | - BSD
-
FreeBSD, Linux, Tru64 - System V
-
HP-UX, Solaris - Proprietary
-
AIX | Spool directories | - BSD
-
/var/spool/lpd/* - System V
-
/var/spool/lp/request/* - AIX
-
/var/spool/lpd/qdir and /var/spool/qdaemon - FreeBSD
-
/var/spool/output/lpd/* - Solaris
-
/var/spool/lp/requests/* | Configuration file(s) | - BSD
-
/etc/printcap - System V
-
/etc/lp/* - AIX
-
/etc/qconfig - Solaris
-
/etc/printers.conf in addition | First serial port device | - AIX
-
/dev/tty0 - FreeBSD
-
/dev/ttyd0 - HP-UX
-
/dev/ttyp0 - Linux
-
/dev/ttyS0 - Solaris
-
/dev/term/a - Tru64
-
/dev/tty00 | First parallel port device | - Usual
-
/dev/lp0 - FreeBSD
-
/dev/lpt0 - HP-UX
-
/dev/lp - Solaris
-
/dev/ecpp0 - Linux
-
/dev/parport0, but a module usually maps this to /dev/lp0 | Boot script (starts the spooling daemon) | - AIX
-
/etc/inittab and /etc/rc.tcpip - FreeBSD
-
/etc/rc - HP-UX
-
/sbin/init.d/lp - Linux
-
/etc/init.d/lpd - Solaris
-
/etc/init.d/lp - Tru64
-
/sbin/init.d/lpd | Boot script configuration | - FreeBSD
-
lpd_enable="YES" (and others) in /etc/rc.conf or /etc/rc.conf.local - HP-UX
-
LP=1 in /etc/rc.config.d/lp - SuSE
-
START_LPD="yes" and DEFAULT_PRINTER in /etc/rc.config (SuSE 7)DEFAULT_PRINTER in /etcsysconfig/printer (SuSE 8) | Remote printing support | - Usual
-
incoming and outgoing BSD-based - AIX
-
BSD, AIX, outgoing System V - HP-UX
-
incoming and outgoing BSD and HP-UX | We will conclude this section by considering some useful and often requested user commands related to printing beyond those required to submit and manipulate print jobs. We describe each of the briefly, and Table 13-2 gives their availability by operating system. - a2ps or enscript
-
Commands to convert text files toPostScript. Many systems provide both of these (as well as other, similar commands). - mpage
-
A command to print text or PostScript files with multiple page images appearing on each sheet of paper. The default is to print 4 pages per sheet. The utility can print up to 8 pages per sheet. - lptest and pmbpage
-
Utilities to generate test output for printers. The first command produces the standard line-printer ripple pattern: a long string consisting of all available characters, which is offset by one character in each successive printed line. The second command produces an image that may be used to determine the boundaries of the printable area on a physical page. - pr
-
A utility that can format text files as a series of columns across the page (among other things). In this mode, it can be useful for preprocessing certain kinds of text files prior to printing them. Note that pr in its more general form is also used by various traditional print filtering mechanisms. - ghostview, gv and similar commands
-
Utilities that allow you to previewPostScript files on screen. They rely upon the Ghostscript PostScript facility. - ghostscript
-
A command that allows a PostScript file to be printed to a non-PostScript printer. - Screen capture utilities
-
Most versions of the X Windows system provide the xwd command for creating an image file from a window. More sophisticated screen capturing facilities are included as part of the gimp graphics editing package. Table 13-2. Available user printing-related utilities[3] Command | AIX | FreeBSD | HP-UX | Linux | Solaris | Tru64 | a2ps and/or enscript | | | | | | | mpage | | | | | | | lptest | | | | | | | pmbpage | | | | | | | pr | a | | a | | | a | ghostview and/or gv | a | | a | | | | xwd | | | | | | | gimp | a | or a | a | | | a | [3] A check ( ) means that the item is provided with the operating system or included among its optional components. The letter a indicates that the item can be obtained for that operating system, typically by downloading source code from the Internet and then building the program, although sometimes in prebuilt form via one of the public software archives. |