- Table of Contents
- Copyright
- About the Lead Authors
- About the Contributing Authors
- Acknowledgments
- Tell Us What You Think!
- Introduction
- I. Red Hat Linux Installation and User Services
- Chapter 1. Introduction to Red Hat Linux
- Chapter 2. Installation of Your Red Hat System
- Chapter 3. LILO and Other Boot Managers
- Chapter 4. Configuring the X Window System, Version 11
- Chapter 5. Window Managers
- Chapter 6. Connecting to the Internet
- Chapter 7. IRC, ICQ, and Chat Clients
- Chapter 8. Using Multimedia and Graphics Clients
- II. Configuring Services
- Chapter 9. System Startup and Shutdown
- Chapter 10. SMTP and Protocols
- Chapter 11. FTP
- Chapter 12. Apache Server
- Chapter 13. Internet News
- Chapter 14. Domain Name Service and Dynamic Host Configuration Protocol
- Chapter 15. NIS: Network Information Service
- Chapter 16. NFS: Network Filesystem
- Chapter 17. Samba
- III. System Administration and Management
- Chapter 18. Linux Filesystems, Disks, and Other Devices
- Chapter 19. Printing with Linux
- Chapter 20. TCP/IP Network Management
- Chapter 21. Linux System Administration
- Chapter 22. Backup and Restore
- Chapter 23. System Security
- IV. Red Hat Development and Productivity
- Chapter 24. Linux C/C++ Programming Tools
- Chapter 25. Shell Scripting
- Chapter 26. Automating Tasks
- Chapter 27. Configuring and Building Kernels
- Chapter 28. Emulators, Tools, and Window Clients
- V. Appendixes
- A. The Linux Documentation Project
- B. Top Linux Commands and Utilities
- C. The GNU General Public License
- D. Red Hat Linux RPM Package Listings
printtool—The Red Hat Linux Print System Manager
If you want to install, modify, or delete a local, remote, or LAN printer, you're going to love the printtool program. Found in /usr/bin, printtool is a graphical interface printer setup program you can call up from the command line, from the GNOME or KDE desktop panel, or through the Red Hat control-panel program.
The control-panel and printtool programs require root permission and run under X, so you'll have to first fire up X and then type the following from a terminal window:
# printtool
After you type in root's password and press Enter, the main printtool dialog box comes up, as shown in Figure 19.1.
Figure 19.1 The printtool client is used to set up printers for your Red Hat Linux system.
Click the Add button and you'll be asked to select a local, remote, SMB, NCP manager, or "Direct to port" printer (see Figure 19.2).
Figure 19.2 The printtool client may be used to define printer settings for a variety of printer types.
Remote Linux Printers
To set up a remote printer, click the Remote UNIX (lpd) Queue button. You'll see a dialog box like that shown in Figure 19.3.
Figure 19.3 The printtool Remote Queue dialog box is used to set up a remote printer.
To set up your system to be able to print to a remote printer attached to another Linux computer on your network, type in the hostname of the remote machine hosting the printer, then type in the remote print queue's name. Click the Select button. You'll see a dialog box like that shown in Figure 19.4.
Figure 19.4 The printtool Configure Filter dialog box is used to set filter options for more than 100 different printers.
Select the correct printer type, resolution, paper size, and other options. Note that these settings should match the capabilities of the remote printer! When you've finished selecting the remote printer's options, click OK.
The printtool command then creates a simple remote printer entry in your system's printer capability database, /etc/printcap. The entry will look something like this:
##PRINTTOOL3## REMOTE djet500 300x300 letter {} DeskJet500 8 1
lp: :sd=/var/spool/lpd/lp: :mx#0: :sh: :rm=aptiva.home.org: :rp=remotelp: :if=/var/spool/lpd/lp/filter:
The :rm and :rp entries define the remote host and printer. The remote machine (aptiva.home.org in this example) should have a configured printer named remotelp, and should also have a properly configured hosts.lpd file under the /etc directory. For example, to enable printing on the remotelp queue from other computers, you should enter a list of allowed remote hostnames (or IP addresses) in aptiva's /etc/hosts.lpd file like this:
ascentia.home.org stinky.home.org 192.168.2.38 presario.home.org hitachi.home.org
This allows print jobs from the listed computers. For details about remote printer entries, see the printcap man page and look for the rm and rp capabilities.
After you've created your remote printer, you'll see a remote entry in printtool's main dialog box, as shown in Figure 19.5.
You can test your remote printer by clicking the Tests menu item (as shown in Figure 19.5) and then clicking the ASCII or PostScript test pages. The ASCII test page will print seven lines of test in 10-point Courier to check alignment and proper linefeeds. The PostScript test page will print a page of text, the Red Hat logo, an eight-color or eight-shaded box, and two lined boxes at the one-inch and half-inch margins of your page.
Figure 19.5 The printtool main dialog box may be used to test local or remote printers.
To set up for printing to an SMB printer, you must have Server Message Block services enabled (through the smbd daemon, part of the Samba software package). You must also have the smbclient command and associated smbprint shell script installed under the /usr/bin directory. You must also be connected to a Windows network and have printer sharing enabled under the remote Windows computer.
For example, under Windows 95, navigate to the Network device in the Control Panel (available through the Settings menu item in the Start menu). Click the File and Print Sharing button, select I Want to Be Able to Allow Others to Print to My Printers, and click OK. Click the Identification tab at the top of the Network window, note the name of your computer, and close the window.
After rebooting, open the Printers folder, right-click the printer you would like to share, and select the Sharing menu item. Select Shared As, enter a shared name and a password, and click OK. You need the name and password information when you run printtool. According to printtool, you need the following to set up a LAN printer:
- Printer server name
- Printer server IP number
- Printer name
- Printer user
- Printer password
- Workgroup
This information (which you can also get from the shared printer's Properties menu under Network Neighborhood) is entered in the SMB Printer Entry dialog box that pops up after you select the type of printer you want to set up. You should also select the type of printer through the Select button at the Input Filter field (similar to that shown in Figure 19.4).
Again, after you fill out your LAN printer's information and click OK, printtool creates a printer entry in /etc/printcap. The printer entry might look something like this:
##PRINTTOOL3## SMB cdj500 300x300 letter { } DeskJet500 8 1
lp0: :sd=/var/spool/lpd/lp0: :mx#0: :sh: :af=/var/spool/lpd/lp0/acct: :lp=/dev/null: :if=/var/spool/lpd/lp0/filter:
Before you can print to your SMB printer, you should have an active network connection. You can then use the -P option of the lpr command, followed by your new LAN printer's name and the name of the file you'd like to print. Using a /etc/printcap entry for a defined printer lp0, use lpr to print a file called myfile.txt:
# lpr -Plp0 myfile.txt
You can also use the smbprint command, part of Andrew Tridgell's collection of programs in the Samba software package, to print to a LAN printer. The smbprint command is a shell script, found under the /usr/bin directory, that uses the smbclient command to send files to a shared printer. In fact, a modified version of smbprint is used as Red Hat's printer filter when you create an SMB printer entry with printtool. For details about smbclient, see its man page.
Local Printers
Red Hat's printtool can easily and quickly set up a parallel port printer attached directly to your computer. To do so, run printtool, click the Add button, select Local, and click OK.
Linux then tries to load the parallel printing module, lp.o, and an Info dialog box appears (shown in Figure 19.6). The dialog box tells you what parallel printer devices have been detected. If printtool reports that no device was found, check your /etc/modules.conf entry for the parport driver.
Figure 19.6 printtool will quickly and easily set up local (attached) printers as long as a parallel port is recognized.
You see an Edit Local Printer Entry dialog box (shown in Figure 19.7) after you click OK. If you'd like to give your printer a name, type a name in the Names field. If you want to limit the size of any spooled printer files (because you don't have enough space on your hard drive), enter a number (such as 1024 for 1MB). After you have finished, click the Select button.
Figure 19.7 The printtool printer device main configuration dialog box allows you to name printers and limit the size of spooled printer files.
The Configure Filter dialog box appears (as shown in Figure 19.4). When finished selecting your options, click OK. The printer you defined should now appear under the list of Printer Queues in the main printtool dialog box. Select it and then choose an ASCII or PostScript test from the Tests menu.
The printtool client (written in the Python language) works by first defining your printer and then inserting the definition into an /etc/printcap entry, along with a pointer to a filter script (written using bash) in the /var/spool/lpd directory. The filter and associated scripts reside in a directory, or printer queue, under /var/spool/lpd, with either a name you choose or an assigned default.
Customizing RHS Printer Filters
The master set of printer filters, along with definitions of the printer entries in the printtool database, reside under the /usr/lib/rhs/rhs-printfilters directory. You can change options for your selected printer by editing the file printerdb. For example, if you find that you only want black-and-white printing for your HP Deskjet 400, open the printerdb file (as root) with your favorite text editor. Scroll through the file until you find the HP 400 entry, like this:
StartEntry: DeskJet500
GSDriver: cdj500
Description: {HP DeskJet 400/500C/520/540C}
About: { This driver supports the HP inkjet printers which have color capability with an optional color cartridge. If your DeskJet can use EITHER a B&W cartridge or a color cartridge, but not both simultaneously, this driver may work for you. Ghostscript supports several optional parameters for this driver: see the document 'devices.doc' in the ghostscript directory under /usr/doc. }
Resolution: {300} {300} {}
BitsPerPixel: {3} {Normal color printing with color cartridge}
BitsPerPixel: {8} {Floyd-Steinberg B&W printing for better greys}
BitsPerPixel: {24} {Floyd-Steinberg Color printing (best, but slow)}
EndEntry
To add simple black-and-white printing as an option for this series of printer, add a BitsPerPixel entry following the Resolution: entry:
BitsPerPixel: {1} {Normal B&W printing with black cartridge}
As you can see, printtool can add, edit, or delete printers. Another nice feature is the capability to assign a size limit to spooled files, which can be helpful if you have limited disk space or don't want users to fill up your filesystem. If you have a printer that requires you to change the print cartridge so that you can print black-and-white or color pages, you'll find printtool indispensable. Try it!
Although the current version of printtool, 3.48, creates a backup of your /etc/printcap database each time you make a change, it does not delete the associated printer queue or spool directory when you delete a printer.
Linux Printing Commands | Next Section

Account Sign In
View your cart