Lemur zaprasza
Red Hat® Linux 6 Unleashed
Chapter 16: Printing with Linux Previous
Sections in this Chapter: Printer Devices Linux Printing Commands Some Program Tips What Printer Should I Use with Linux? Simple Formatting Other Helpful Programs How Do I Print? Other Helpful Printer Programs and Filters Troubleshooting and More Information The RHS Linux Print System Manager Infrared Printer Support Previous SectionNext Section The RHS Linux Print System Manager Remote Linux Printers Customizing RHS Printer Filters 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 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: # su -c printtool After you type in root's password and press Enter, the main printtool dialog box comes up. Click the Add button and you'll be asked to select a local, remote, SMB or NCP manager printer (see ). FIGURE 16.1 The printtool Add a Printer Entry dialog box offers setup of four different types of printers. 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 16.2. FIGURE 16.2 The printtool Remote Queue dialog box is used to set up a remote printers. 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 16.3. FIGURE 16.3 The printtool Configure Filter dialog box is used to set filter options for a number of printers Select a printer type, resolution, paper size, and other options. When you've finished selecting the remote printer's options, click the OK button.The printtool command creates a simple remote printer entry in your system's printer capability database, /etc/printcap. The entry make look something like this: ##PRINTTOOL3## REMOTE djet500 300x300 letter {} DeskJet500Mono Default 1 lp1:\ :sd=/var/spool/lpd/lp1:\ :mx#0:\ :sh:\ :rm=aptiva.home.org:\ :rp=lp:\ :if=/var/spool/lpd/lp1/filter: The :rm and :rp entries defines the remote host and printer. The remote machine (aptiva.home.org in this example) should have a configured printer named lp, and should also have a properly configured hosts.lpd file under the /etc directory. For example, to enable printing on the lp queue from other computers, you should enter a list of allowed remote hostnames in aptiva's /etc/hosts.lpd file like this: ascentia.home.org presario.home.org hitachi.home.org This allows print jobs from the three listed computers. For details about remote printer entries, see the printcap man page and look for the rm and rp capabilities. Note - There are other, possibly easier ways to print to remote printers, such as using the rlpr command. For more information, read Grant Taylor's The Linux Printing HOWTO under /usr/doc/HOWTO. After you've created your remote printer, you'll see a remote entry in printtool's main dialog box, as shown in . FIGURE 16.4 The printtool main dialog box may be used to test local or remote printers. You can test your remote printer by clicking the Tests menu item (as shown in ) 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 your page. 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 smbprint/smbclient command installed under the /usr/bin directory. You must also be connected to a Windows network and have printer sharing enabled under Windows.For example, under Windows 95, navigate to the Network device in the Control Panel (available through the Settings menu item in the Start menu). Press the File and Print Sharing button, select I Want to Be Able to Allow Others to Print to My Printers, and press the OK button. Press 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 press the OK button. You need the name and password information when you run printtool. According to printtool, you need the following to set up a LAN printer: l Printer server
Printer server IP
Printer
Printer
Printer
This information is entered in a dialog box that pops up after you select the type of printer you want to set up. You can also select the type of printer through the Select button at the Input Filter field (similar to that shown in Figure 16.3). Note - Check Chapter 17, "TCP/IP Network Management," for tips on printing through Apple LocalTalk networks and for information on setting up other services through Server Message Block (SMB) Windows-based networks. Need more detailed instructions on how to print from Red Hat Linux to a printer on a Windows 95/98/NT system or to print on a Linux printer from Windows 95? Browse to . You'll also find the latest information about Samba at . After you fill out your LAN printer's information and press the OK button, printtool creates a printer entry in your system's printer-capabilities database, /etc/printcap (see Linux printing commands later in this chapter). The printer entry might look something like this: ##PRINTTOOL3## SMB cdj500 300x300 letter {} DeskJet500 1 1 lp0:\ :sd=/var/spool/lpd/lp0:\ :mx#0:\ :sh:\ :if=/var/spool/lpd/lp0/filter:\ :af=/var/spool/lpd/lp0/acct:\ :lp=/dev/null: Note - You'll receive a warning before you create an SMB or NCP printer for Red Hat Linux with printtool. You should know that when you use printtool to create a SMB printer entry, a file named .config is created under the /var/spool/lpd directory, or spool directory. This file, which contains the Share (server) name, the printer user name, and the password, is not encrypted and anyone on your system can read it! 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 the OK button. Linux then tries to load the parallel printing module, lp.o, and an Info dialog box appears (shown in Figure 16.5). The dialog box tells you what parallel printer devices have been detected. If printtool reports that no device was found, check your /etc/conf.modules entry for the parport driver. FIGURE 16.5 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 ) when 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. The Configure Filter dialog box appears (as shown in ). When finished selecting your options, click the OK button. 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. FIGURE 16.6 The printtool printer device main configuration dialog box allows you to name printers and limit the size of spooled printer files. The printtool program (written in the Python language--see Chapter 34, "Programming in Python") 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 in bash--see Chapter 25, "Shell Programming") 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. See the sample /etc/printcap database file later in this chapter. 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.40, 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. Red Hat® Linux 6 Unleashed
Chapter 16: Printing with Linux Previous
Sections in this Chapter: Printer Devices Linux Printing Commands Some Program Tips What Printer Should I Use with Linux? Simple Formatting Other Helpful Programs How Do I Print? Other Helpful Printer Programs and Filters Troubleshooting and More Information The RHS Linux Print System Manager Infrared Printer Support Previous SectionNext Section © Copyright Macmillan USA. All rights reserved. |