Changing the Driver

A traditional BSD LPD or LPRng print queue calls Ghostscript and specifies the

Ghostscript driver to be used with the help of a print filter. This filter is specified using the if= line in /etc/printcap, as described earlier, in "When to Pick LPRng." Unfortunately, several layers of indirection are usually involved, so you can't simply change the if= line to modify the driver or its options. Instead, you must locate documentation about the printer filter package that your distribution uses or that you've installed. One popular filter package is Apsfilter (http://www.apsfilter.org), which is often used in conjunction with BSD LPD or LPRng. CUPS uses its own printer filters. If your system uses another type of printer filter, you may need to backtrack from its /etc/printcap entry.

Using Apsfilter

Debian and Slackware both use Apsfilter. Typically, you use this tool to set up a complete printer queue—an /etc/printcap entry, spool directory, and filter script. To do this, type /usr/share/apsfilter/SETUP to run the setup tool, which then runs through a series of informational screens and allows you to set various options, such as your printer type and location. Figure 13.2 shows the main configuration screen. If you haven't set all the necessary information, the (I) option won't appear on this menu. You use this item to finalize the installation. Before doing so, though, you should type T to print a test page to make sure the installation works.

[^j Click To expand

Figure 13.2: The main Apsfilter Setup screen lets you change various printer options.

Apsfilter provides many options for printer drivers when you type 1 in the main setup screen. Roughly speaking, these options fall into several categories:

PostScript Printer The first option is for a PostScript printer. Select this option if your printer understands PostScript natively, no matter what its brand or model.

Standard Ghostscript Drivers Option 3 on the driver page is for printer drivers built into Ghostscript. Most non-PostScript printers fall into this category, although a few don't. When you select this option, the program presents a long list of printers, and you select your model from this list.

Add-on Ghostscript Drivers Ghostscript ships with many printer drivers, but third parties have written additional drivers. Options 4 and up on the printer driver selection page enable you to use these drivers. Most of these drivers work with a small family of printers, so you pick the specific model from a list after selecting the family option.

Note The upcoming section, "Finding the Best Driver," provides tips on locating the best printer driver for any given printer.

Once configured, Apsfilter stores information on printer drivers in /etc/apsfilter/qrueue/apsfilterrc, where queue is the print queue name. Most importantly, the PRINTER variable holds the name of the printer driver. Therefore, you can change the driver a queue uses by modifying that variable. Drivers are stored in /etc/apsfilter/basedir/driver and its subdirectories. These drivers are actually Apsfilter configuration files, so you may be able to edit them to achieve unusual effects if you understand the Ghostscript configuration for your printer.

Apsfilter actually calls Ghostscript (the gs program file itself) from the apsfilter script, which is stored in /etc/apsfilter/basedir/bin. This script sets the gs_cmd variable to a Ghostscript command template, depending on the printer type. If you need to enable unusual Ghostscript options, you can modify this command template.

Backtracking from /etc/printcap

If you're using an unusual print filter with BSD LPD or LPRng, you may need to use your distribution's or print filter's configuration tool to create a new printer definition. You can then backtrack from its /etc/printcap entry to find the call to Ghostscript. The if= option in printcap points to the filter program. This program may be a do-it-all filter, such as Apsfilter, or a simpler filter that a filter package created for a specific printer. In either case, this filter is probably a shell script, so you can load it into a text editor and study it to learn how the printing system calls Ghostscript. Sometimes Ghostscript is called directly from the filter script. Other filters call still more scripts, or they place the Ghostscript command in another configuration file.

Once you've located the call to Ghostscript, you can change the driver by changing the -sDEVICE option to gs. In many cases, a filter script passes a variable to this option, so you may need to backtrack further to discover where this variable is set.

Using CUPS

When you use your web browser to access http://localhost:631, the system should display a summary of options, as shown in Figure 13.1. Click Manage Printers to manage existing printers or add new ones. The Add Printer link then lets you add a printer. This process is much like the Apsfilter process—you specify the printer's device or network location, its make and model, and so on.

If you want to modify an existing printer, you can do so by clicking the Modify Printer or Configure Printer option in a specific printer's listing. Modify Printer lets you change the printer driver, location, and so on. Configure Printer lets you set options such as the printer's resolution and paper size.

If you need to delve into configuration files, you can examine the /etc/cups/printers.conf file in which CUPS stores printer-specific information. This file includes information concerning the device file or network location of the printer, its current status, and so on. CUPS stores more detailed information on printers in the /etc/cups/ppd directory, which holds PostScript Printer Description (PPD) files. In the case of non-PostScript printers, these files include lines that begin with the string *cupsFilter, which identifies how CUPS should convert the file to a format the printer will understand. These lines don't correspond in any simple way to Ghostscript driver names, though, so they can be tricky to modify by hand; it's usually better to rely on the web-based configuration tool. If you want to tweak your Ghostscript configuration, though, check the final word on this line against the programs and scripts in /usr/lib/cups/filter—these CUPS print filters are responsible for calling Ghostscript. Many, but not all, drivers call /usr/bin/foomatic-gswrapper, which calls Ghostscript.

Note Some CUPS installations deliver a very limited set of printer choices by default. You can install GIMP-Print (as described in the next section), drivers from the Linux Printing website (http://www.linuxprinting.org), drivers available from many distributions as the cups-drivers package, or the commercial Easy Software Products (ESP) Print Pro (http://www.easysw.com/printpro/) to expand the range of options delivered by CUPS.

0 0

Post a comment