![]() | ![]() |
|
1. IntroductionThe Printing HOWTO should contain everything you need to know to help you set up printing services on your GNU/Linux box(en). As life would have it, it's a bit more complicated than in the point-and-click world of Microsoft and Apple, but it's also a bit more flexible and certainly easier to administer for large LANs. This document is structured so that most people will only need to read the first half or so. Most of the more obscure and situation-dependent information in here is in the last half, and can be easily located in the Table of Contents, whereas some information through section 10 or 11 is probably needed by most people. If you find this document or the linuxprinting.org website useful, consider buying something (ink, for example) through the referral links on the site; such purchases support this effort. The linuxprinting.org website is a good place to find the latest version; it is also, of course, distributed from tldp.org and your friendly local LDP mirror. 1.1. TerminologyI try to use consistent terminology throughout this document, so that users of all free Unix-like systems, and even users of non-Unix-like free software, can benefit. Unfortunately, there are many handy ambiguous names and many awkward unambiguous names, so just to be clear, here's a quick glossary of what each name means:
1.2. HistoryThis have been severel generations of the Printing HOWTO. The history of the PHT may be chronicled thusly:
1.3. CopyrightCopyright (c) 1992-2001 Grant Taylor. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in Appendix A. 2. Quick StartThe quickest way to get started is simply to use the setup tools provided by your vendor. Assuming that this includes support for your driver, and assuming that your vendor shipped the driver for your printer, then it should be easy to get a basic setup going this way. For information on vendor-provided setup tools, see Section 9. If your vendor's tool doesn't work out, you should figure out if your printer is supposed to work at all. Consult the printer compatibility listings in Section 5.3.1 as well as the online version described there. If your printer is known to work with a driver, check that you have that driver, and install if it not. Typically you will be able to find a contributed Ghostscript package including newer Ghostscript code and assorted third-party drivers. If not, you can compile it yourself; the process is not trivial, but it is well documented. See Section 10 for more information on Ghostscript. After installing the proper driver, attempt again to configure your printer with your vendor's tools. If that fails, select a suitable third party tool from those described in Section 8. If that also fails, you'll need to construct your own setup; again see Section 8. If you're still stuck, you've got a little troubleshooting to do. It's probably best to read most of this document first to get a feel for how things are supposed to work; then you'll be in a better position to debug. 2.1. Where to Get HelpThe Usenet newsgroups comp.os.linux.hardware, comp.os.linux.setup, and comp.periphs.printers all have a share of general printing questions. These are well-trafficked newsgroups where an answer is sure to be found; check in the Google Groups archives, too. There are also the linuxprinting.foo newsgroups; these are available both as web-based forums and via NNTP; see the website. Please also poke around the web looking for your answers. LinuxPrinting.org is an excellent place to start; other websites and projects are linked to from there. If you need more help, please try newsgroups, mailing lists, your distribution's support line, and so forth. If do want to contact me, please do so via the discussion forums on LinuxPrinting.org; this will give others a chance to respond, and will archive your problem and any solution publicly for the next hapless user. 3. How to printYou actually use a different command to print depending on which spooling software you use. 3.1. With BSD LPD and the lpr commandIf you've already got lpd setup to print to your printer, or your system administrator already did so, or your vendor did so for you, then all you need to do is learn how to use the lpr command. The Printing Usage HOWTO covers this, and a few other queue manipulation commands you should probably know. Or just read the lpr(1) man page. In a nutshell, you specify the queue name with -P, and specify a filename to print a file, or nothing to print from stdin. Driver options are traditionally not controllable from lpr, but various systems accept certain options with -o, -Z, or -J. 3.2. With System V LPD and the lp commandThere are two sets of commands that you may encounter if you have to deal with several brands of Unix. The BSD based LPD print system (*BSD, Linux) uses lpr (print),lpq (display queue),lprm (remove jobs). System V based systems on the other hand use lp (print), lpstat (display queue), cancel (remove jobs). Solaris, SCO and others are System V Unix systems. On SYSV systems, you can of course consult the man page of the lp command. To specify a queue you use the -d option and a filename to print a file, or nothing to print from stdin. 3.3. With CUPSCUPS provides both the System V and Berkeley command-line interfaces. This means that you can use either lpr or lp to print. This is really nice if you have a bunch of scripts that already use eg. lp or you have prior experience with either a System V or a BSD flavor. 3.4. GUI Printing ToolsMost spooling systems alone offer only a rather basic command-line interface. Rather than use lpr directly, you may wish to obtain and use a front-end interface. These generally let you fiddle with various printing options (the printer, paper types, collation, n-up, etc) in an easy-to-use graphical way. Some may have other features, as well. 3.4.1. KDEPrintKDEPrint allows users access to printing subsystems (CUPS, LPD, RLPR, LPRng etc.) through a KDE graphical user interface. With KDEPrint, you can easily print, administer jobs and printers and the printing daemon. KDEPrint is a replacement for the old QtCUPS and KUPS. It is easy to use for both developers and users. KDEPrint is already a part of KDE since 2.2.0 and has several nice features. kprinter is the print dialog of KDEPrint which allows you to select the destination printer and change printer options. Among the destination printers, there are a few virtual printers allowing you to print to email, fax or pdf. You can use KDEPrint's kprinter in any application that lets you configure your print command. Examples of these are Mozilla and OpenOffice. KDEPrint also features a Print Preview. that you can select from the Print Dialog. This is accomplished by passing the print file through the filters which make it suitable for displaying on screen using KGhostView or an external application like gv. The KDEPrint Job Viewer KJobViewer allows you to view, move and cancel print jobs. You can find more information about KDEPrint at http://printing.kde.org/. 3.4.2. XPPAnother good choice for CUPS is the program XPP (see Figure 4). XPP is built from the FLTK library and is therefore desktop agnostic. To print with XPP, simply run the xpp program, and specify a file (or nothing, if you're using xpp in place of lpr to print from stdin). Then select a printer from the list of configured printers, and select any options you'd like to apply from the various tabbed panels. See Figure 5 for an example options panel highlighting the standard CUPS options. When used with Foomatic driver interface system, XPP will also let you control numeric parameters not normally supported by CUPS. This typically includes such things as extended color tuning, cartridge alignment, and so forth. See Figure 6 for an example of this. You can save your selected printer and all the options with the `Save Settings' button. 3.4.3. GPRGPR, by Thomas Hubbell, uses code from CUPS to filter Postscript jobs and offer easy user control over job options. Some options (like n-way printing, page selection, etc) are implemented directly by GPR, while most others are implemented by the printer or by the spooler's filter system. GPR works with LPD or LPRng; or can be compiled specifically for use with GNUlpr. When compiled normally, it uses VA's libppd directly to produce printer-specific PostScript which it will then submit to the lpr command. When compiled for GNUlpr, it will submit your unmodified Postscript job to the lpr command, along with the set of job options you specify. This is arguably the better route, since it allows the Postscript to be redirected to a different printer by the spooler when appropriate; unfortunately it requires GNUlpr, which is not in wide circulation (although it is of course trivial to install). To use GPR, first select a printer (by LPD queue name) and check that GPR has loaded the proper PPD file. If it hasn't, you'll need to specify the PPD filename, and specify your printer's options in the Printer Configuration dialog (you get this dialog by pressing the Printer Configuration button; it contains assorted printer setup options defined by the PPD). Once you've configured your printer in GPR, you can print jobs by specifying the filename and selecting the proper options from the `Common' and `Advanced' tabbed panels. The `Common' options are implemented directly by GPR for all printers, while the `Advanced' options are defined by the PPD file for your printer. You can see these option panels in Figure 8 and Figure 9. 4. Kernel printer devicesThere are two completely different device drivers for the parallel port; which one you are using depends on your kernel version (which you can find out with the command uname -a). The driver changed in Linux 2.1.33; essentially all current systems will be running kernel 2.2 or later, so you'll probably want to skip ahead to the parport driver section. A few details are the same for both styles of driver. Most notably, many people have found that Linux will not detect their parallel port unless they disable "Plug and Play" in their PC BIOS. (This is no surprise; the track record for PnP of non-PCI devices with Windows and elsewhere has been something of a disaster). 4.1. The lp device (kernels <=2.1.32)The Linux kernel (<=2.1.32), assuming you have compiled in or loaded the lp device (the output of cat /proc/devices should include the device lp if it is loaded), provides one or more of /dev/lp0,/dev/lp1, and /dev/lp2. These are NOT assigned dynamically, rather, each corresponds to a specific hardware I/O address. This means that your first printer may be lp0 or lp1 depending on your hardware. Just try both. A few users have reported that their bidirectional lp ports aren't detected if they use an older unidirectional printer cable. Check that you've got a decent cable. One cannot run the plip and lp drivers at the same time on any given port (under 2.0, anyway). You can, however, have one or the other driver loaded at any given time either manually, or by kerneld with version 2.x (and later 1.3.x) kernels. By carefully setting the interrupts and such, you can supposedly run plip on one port and lp on the other. One person did so by editing the drivers; I eagerly await a success report of someone doing so with only a clever command line. There is a little utility called tunelp floating about with which you, as root, can tune the Linux 2.0 lp device's interrupt usage, polling rate, and other options. When the lp driver is built into the kernel, the kernel will accept an lp= option to set interrupts and io addresses:
When loaded as a module, it is possible to specify io addresses and interrupt lines on the insmod command line (or in/etc/conf.modules so as to affect kerneld) using the usual module argument syntax. The parameters areio=port0,port1,port2 and irq=irq0,irq1,irq2. Read the man page forinsmod for more information on this. **For those of you who can never find the standard port numbers when you need them, they are as in the second example above. The other port (lp0) is at 0x3bc. I've no idea what interrupt it usually uses. The source code for the Linux 2.0 parallel port driver is in /usr/src/linux/drivers/char/lp.c. 4.2. The parport device (kernels >= 2.1.33)Beginning with kernel 2.1.33 (and available as a patch for kernel 2.0.30), the lp device is merely a client of the new parport device. The addition of the parport device corrects a number of the problems that plague the old lp device driver - it can share the port with other drivers, it dynamically assigns available parallel ports to device numbers rather than enforcing a fixed correspondence between I/O addresses and port numbers, and so forth. The advent of the parport device has enabled a whole flock of new parallel-port drivers for things like Zip drives, Backpack CD-ROMs and disks, and so forth. Some of these are also available in versions for 2.0 kernels; look around on the web. The main difference that you will notice, so far as printing goes, is that parport-based kernels dynamically assign lp devices to parallel ports. So what was lp1 under Linux 2.0 may well be lp0 under Linux 2.2. Be sure to check this if you upgrade from an lp-driver kernel to a parport-driver kernel. The most popular problems with this device seems to stem from misconfiguration:
You can also read the parport documentation in your kernel sources, or look at the parport web site. 4.3. Serial devicesSerial devices are usually called something like/dev/ttyS1 under Linux. The utility stty will allow you to interactively view or set the settings for a serial port; setserial will allow you to control a few extended attributes and configure IRQs and I/O addresses for non-standard ports. Further discussion of serial ports under Linux may be found in the Serial-HOWTO. When using a slow serial printer with flow control, you may find that some of your print jobs get truncated. This may be due to the serial port, whose default behavior is to purge any untransmitted characters from its buffer 30 seconds after the port device is closed. The buffer can hold up to 4096 characters, and if your printer uses flow control and is slow enough that it can't accept all the data from the buffer within 30 seconds after printing software has closed the serial port, the tail end of the buffer's contents will be lost. If the command cat file > /dev/ttyS2 produces complete printouts for short files but truncated ones for longer files, you may have this condition. The 30 second interval can be adjusted through the "closing_wait" command-line option of setserial (version 2.12 and later). A machine's serial ports are usually initialized by a call to setserial in the rc.serial boot file. The call for the printing serial port can be modified to set the closing_wait at the same time as it sets that port's other parameters. 4.4. USB Devices4.4.1. USB 1.1Linux supports USB pretty well. USB should work with any late-model 2.2 kernel, and any 2.4 kernel or newer. Of course you need kernel support for USB, either linked in or through a module (recommended). If you have a modular kernel, the following modules need to be loaded:
4.4.2. USB 2.0To get high speed transfers out of a USB 2.0 capable device you must attach it to an USB 2.0 controller and use the EHCI driver (ehci-hcd.o). A recent 2.4 kernel or higher is recommended if you want to use USB 2.0. 4.4.3. HintsOne thing to remember is that USB devices are dynamically allocated. A USB printer gets assigned a device file (/dev/usb/lp*) when it is turned on or connected. This could mean that print jobs are sent to the wrong printer because you turned them on in a certain order. CUPS uses special Uri's containing manufacturer, model and printer serial number to keep sending the jobs to the correct physical printer. Although most USB printers work fine on Linux, there are exceptions. For example the new MF devices from Epson (Stylus CX3200/CX5200) return garbage when one polls the IEEE-1284 ID string via IOCTL, for example with the code of the CUPS "usb" backend. Whereas one can poll the ID string via an Epson-proprietary method. Till Kamppeter has written some tools to retrieve the device ID string from USB printers. getusbprinterid.pl and usb_id_test.c are the same thing but respectively in Perl and C. As mentioned above, the new MF devices from Epson are an exception, but the "Epson proprietary method" is implemented in the ttink tool of the MTink package. More documentation about USB is available at the Linux USB Website. 5. Supported PrintersThe Linux kernel will let you speak with any printer that you can plug into a serial, parallel, or usb port, plus any printer on the network. Unfortunately, this alone is insufficient; you must also be able to generate data that the printer will understand. Primary among the incompatible printers are those referred to as "Windows" or "GDI" printers. They are called this because all or part of the printer control language and the design details of the printing mechanism are not documented. Typically the vendor will provide a Windows driver and happily sell only to Windows users; this is why they are called Winprinters. In some cases the vendor also provides drivers for NT, OS/2, or other operating systems. Many of these printers do not work with free software. A few of them do, and some of them only work a little bit (usually because someone has reverse engineered the details needed to write a driver). See the printer support list below for details on specific printers. A few printers are in-between. Some of NEC's models, for example, implement a simple form of the standard printer language PCL that allows PCL-speaking software to print at up to 300dpi, but only NEC knows how to get the full 600dpi out of these printers. Note that if you already have one of these Winprinters, there are roundabout ways to print to one, but they're rather awkward. SeeSection 12 in this document for more discussion of Windows-only printers. 5.1. PostscriptAs for what printers do work with free software, the best choice is to buy a printer with native PostScript support in firmware. Nearly all Un*x software that produces printable output produces it in PostScript, so obviously it'd be nice to get a printer that supports PostScript directly. Unfortunately, PostScript support is scarce outside the laser printer domain, and is sometimes a costly add-on. Un*x software, and the publishing industry in general, have standardized upon Postscript as the printer control language of choice. This happened for several reasons:
5.2. Non-PostscriptFailing the (larger) budget necessary to buy a Postscript printer, you can use any printer supported by Ghostscript, the free Postscript interpreter used in lieu of actual printer Postscript support. Note that most GNU/Linux distributions can only ship a somewhat outdated version of Ghostscript due to the license. Fortunately, there is usually a prepackaged up to date Ghostscript made available in each distribution's contrib area. Adobe now has a new printer language called "PrintGear". I think it's a greatly simplified binary format language with some Postscript heritage but no Postscript compatibility. And I haven't heard of Ghostscript supporting it. But some PrintGear printers seem to support another language like PCL, and these printers will work with GNU/Linux (if the PCL is implemented in the printer and not in a Windows driver). Similarly, Adobe offers a host-based Postscript implementation called PressReady. This works much like Ghostscript does to provide Postscript support for a non-Postscript printer, but has the disadvantage that it runs only on Windows. 5.3. What printers work?You can look in several places to see if a particular printer will work. The cooperatively maintained Printing HOWTO printer database aims to be a comprehensive listing of the state of GNU/Linux printer support. A summary of it is below; be sure to check online for more details and information on what driver(s) to use. The best bet for new printer shoppers is to consult the list of suggested printers. These center around color inkjets and mono laser devices. You can even help support this document and the website by buying from one of affiliated vendors. Ghostscript's printer compatibility page has a list of some working printers, as well as links to other pages. Google groups contains hundreds of "it works" and "it doesn't work" testimonials. Try all three, and when you're done, check that your printer is present and correct in the database, so that it will be listed properly in this document in the future. 5.3.1. Printer compatibility listThis section is a summary of the online database. The online version includes device specifications, notes, driver information, user-maintained documentation, manufacturer web pages, and interface scripts for using drivers with several print spooling systems (including LPR, LPRng, PDQ, and CUPS). The online version of this list is also interactive; people can and do add printers all the time, so be sure to check it as well. Finally, if your printer isn't listed, add it! Note that this listing is not gospel; people sometimes add incorrect information, which are eventually weeded out. Entries which have not been sanity-checked are marked with an asterisk (*). Verify from Google Groups that a printer works for someone before buying it based on this list. Printers here are categorized into four types:
And without further ado, here is the printer compatibility list: Table 1. Linux Printer Support
5.4. How to buy a printerIt's a bit difficult to select a printer these days; there are many models to choose from. Here are some shopping tips:
6. Spooling softwareUntil recently, the choice for free software users was simple - everyone ran the same old lpd lifted mostly verbatim out of BSD's Net-2 code. Even today, some vendors ship this software. But this is beginning to change. SVR4-like systems including Sun's Solaris come with a completely different print spooling package, centered around lpsched. Today, there are a number of good systems to chose from. They are all described below; read the descriptions and make your own choice. CUPS is a good option and recommended for most users; it has excellent Postscript printer support, offers IPP support, a web interface, and a number of other features. For business environments with mainly networked Postscript printers, a front-end program like GPR with LPRng is another option; it handles PPD options directly and has a nice interface. 6.1. CUPSCUPS has become the standard printing system in most distributions today. What makes CUPS different from the rest ? CUPS is an implementation of the Internet Printing Protocol (IPP), a new standard intended to solve some of the deficiencies of the old LPD protocol. CUPS also supports LPD, SMB and AppSocket (JetDirect) with reduced functionality. The implementation of CUPS has been driven by Michael Sweet of Easy Software Products; CUPS is distributed under the GPL. Being a new protocol, the IPP has a number of advantages on the ancient LPD protocol:
There are a number of very good features in it, including sensible option handling; web, GUI, and command-line interfaces; and a mime-based filtering system with strong support for Postscript. There are several sets of PPDs which you can use with CUPS:
The third-party program XPP (see Figure 4) offers a very nice graphical interface to the user functionality of CUPS, including an marvelous interface to print-time options (shown in Figure 5). For information on using XPP, see Section 3.4.2. 6.2. LPDLPD, the original BSD Unix Line Printer Daemon, has been the standard on Unix for years. It is available for every style of Unix, and offers a rather minimal feature set derived from the needs of timesharing-era computing. Despite this somewhat peculiar history, it is still useful today as a basic print spooler. To be really useful with modern printer, a good deal of extra work is needed in the form of companion filter scripts and front-end programs. But these exist, and it does all work. LPD is also the name given to the network printing protocol by RFC 1179. This network protocol is spoken not only by the LPD daemon itself, but by essentially every networked print server, networked printer, and every other print spooler out there; LPD is the least common denominator of standards-based network printing. LPRng(see Section 6.3) is a far better implementation of the basic LPD design than the regular one; if you must use LPD, consider using LPRng instead. There is far less voodoo involved in making it do what you want, and what voodoo there is is well documented. LPRng is essentially an enhanced LPD implementation with better security and extra features. There are a large number of LPD sources floating around in the world. Arguably, some strain of BSD Unix is probably the official owner, but everyone implements changes willy-nilly, and they all cross-pollinate in unknown ways, such that it is difficult to say with certainty exactly which LPD you might have. Of the readily available LPDs, GNUlpr offers one with a few minor modifications that make the user interface much more flexible. The GNUlpr supports command-line option specification with a-o flag; options are then passed through to filters. This is similar to the features offered by a number of traditional Unix vendors, and similar to (although incompatible with) LPRng's -z option mechanism. If you go with LPD, the best way to use it is via a front-end. There are several to chose from; KDEPrint, GPR (see Section 3.4) and XPP are perhaps the best. Others exist; tell me about them. 6.3. LPRngSome GNU/Linux vendors provide LPRng, a far less ancient LPD print spooling implementation. LPRng is far easier to administer for large installations (read: more than one printer, any serial printers, or any peculiar non-lpd network printers) and has a less frightfully haphazard codebase than does stock lpd. It can even honestly claim to be secure - there are no SUID binaries, and it supports authentication via PGP or Kerberos. LPRng also includes some example setups for common network printers - HP LaserJets, mainly - that include some accounting abilities. LPRng uses more or less the same basic filter model as does BSD lpd, so the LPD support offered by the linuxprinting.org website applies to LPRng as well. This can help you effectively use free software drivers for many printers. LPRng is distributed under either the GPL or an Artistic license. 6.4. PPRPPR is a Postscript-centric spooler which includes a rudimentary Postscript parsing ability from which it derives several nice features. It includes good accounting capabilities, good support for Appletalk, SMB, and LPD clients, and much better error handling than lpd. PPR, like every other spooler here, can call Ghostscript to handle non-Postscript printers. PPR was written by, and is in use at, Trinity College. The license is BSD-style; free for all use but credit is due. 6.5. Others6.5.1. PDQPDQ stands for "Print, Don't Queue", and the way it works reflects this design. PDQ is a non-daemon-centric print system which has a built-in, and sensible, driver configuration syntax. This includes the ability to declare printing options, and a GUI or command line tool for users to specify these options with; users get a nice dialog box in which to specify resolution, duplexing, paper type, etc. Running all of the filters as the user has a number of advantages: the security problems possible from Postscript are mostly gone, multi-file LaTeX jobs can be printed effectively as dvi files, and so forth. PDQ is not without flaws: most notably it processes the entire job before sending it to the printer. This means that, for large jobs, PDQ may simply be impractical—you can end up with hundreds of megs being copied back and forth on your disk. Even worse, for slow drivers like the better quality inkjet drivers, the job will not start printing until Ghostscript and the driver have finished processing. This may be many minutes after submission. There's a real place for PDQ; it has a simple design that doesn't subtract user control. And the normal control path crosses no security boundaries, so it can't have the classes of security bug people are always finding in other systems. And to top it off, it's small. However there is no active development done on PDQ. A new maintainer would be most welcome. 6.5.2. GNUlprGNUlpr began its life in some work that HP sponsored VA Linux to do. Unfortunately, GNUlpr is now pretty much dead. 6.5.3. CPSThe Coherent Printing System is a set of Perl scripts called "lpr", "lpd", "lprm", and "lpq". These replace the programs of the same name which come with many Linux systems. 6.5.4. CEPSThe Cisco Enterprise Print System was developed by Damian Ivereigh when he was a sysadmin at Cisco. He did more than he was hired to do, he developed a new printing system to improve the administrative hassle. Cisco authorized the release of the software for free under the GNU General Public License. Installing CEPS will however only pay off at large organisations. 7. How it all worksIn order to get printing working well, you need to understand how your spooling software works. All systems work in essentially the same way, although the exact order might vary a bit, and some systems skip a step or two:
7.1. CUPSTo print a job with CUPS, you can use both the BSD (see Section 5.3.1) and System V commands making it really easy for people with prior experience with either system. Initially CUPS lacked an LPD backend. This was of course quickly added. Currently there are backends available for at least IPP, LPD, SMB, JetDirect, USB, Netatalk, parallel and serial printers. You may find others on the net or write your own. There are only a handfull of built-in drivers, allowing you to print with most printers but probably not at the maximum resolution. A PPD file for a Postscript driver can be added to CUPS but if you want to print at best quality with your fancy new HP Deskjet you are out of luck. It is here that Foomatic comes to the rescue. You can use Foomatic in combination with CUPS. Foomatic uses a CUPS filter called foomatic-rip to do its magic. foomatic-rip uses PPD files to describe printer capabilities, even for non-Postscript printers. CUPS + Foomatic is currently the recommended printing system. Some Linux distributions already use it and the number that do will only grow. The CUPS scheduler does not only accept jobs, it is also a administrative webinterface. Currently you can add/delete printers, cancel jobs, start/stop printers. Moving jobs will be available in a later release. 7.2. LPDLpd stands for Line Printer Daemon, and refers in different contexts to both the daemon and the whole collection of programs which run print spooling. These are:
So how does it fit together? The following things happen:
The lp system was originally designed when most printers were line printers - that is, people mostly printed plain ASCII. By placing all sorts of magic in the if filter, modern printing needs can be met with lpd (well, more or less; many other systems do a better job). There are many programs useful for writing LPD filters. Among them are:
8. How to set things upFor common configurations, you can probably ignore this section entirely - instead, you should jump straight to Section 9 below, or better yet, your vendor's documentation. Most GNU/Linux distributions supply one or more "idiot-proof" tools to do everything described here for common printers. If your vendor's tool doesn't work out for you, or you'd like the ability to interactively control printing options when you print, then you should use some other system. APS Filter is another good system; it configures LPD queues and filters very easily on most any sort of Unix system. You can also use the printing system interfaces from the linuxprinting.org website to connect many free drivers into several spooling systems. Once this project is complete, these interfaces will offer the best functionality: all styles of free software drivers are supported, user-settable options are available, and most common spooling systems are supported. Currently the foomatic print system is used in most modern distributions anyway. However, your distro may include a slightly outdated version of foomatic. 8.1. Configuring CUPSIf you are using a client with CUPS and a CUPS server has already been configured, installing the printers on your client can not get much easier than this: do nothing. Through broadcasting, the client should find the CUPS server and automatically configure the printers that are installed on that print server. This is one of the features of CUPS that will be really appreciated on large networks. Manually configuring printers with CUPS, also is a peace of cake. If you are new to CUPS and/or Unix printing, the way to go is probably the web interface. If you have to configure lots of printers, using the command-line will probably be faster. The URL to access the CUPS web interface is http://hostname:631/admin by default. The port can be changed in cupsd.conf if necessary. To add a printer from the command-line the general syntax is lpadmin -p printer -E -v device -m ppd Lpadmin with the -p option adds or modifies a printer. The printers are saved in the file The -x option deletes the named printer. Read the lpadmin man page for available options. Example 3. command-line examples
More information about configuring printers and options can be found in the CUPS documentation. The Software Administrators Manual will teach you all you need to know about configuring printers with CUPS. 8.2. Configuring LPDUntil recently most GNU/Linux distributions shipped with LPD. This section describes a very basic setup for LPD; further sections detail the creation of complex filters and network configuration. 8.2.1. Basic LPD configurationThe minimal setup for lpd results in a system that can queue files and print them. It will not pay any attention to whether or not your printer will understand them, and will probably not let you produce attractive output. But we have to start somewhere. To add a print queue to lpd, you must add an entry in/etc/printcap, and make the new spool directory under /var/spool/lpd. An entry in /etc/printcap looks like:
Go now and read the man page for printcap. The above looks very simple, but there a catch - unless I send in files a DeskJet 500 can understand, this DeskJet will print strange things. For example, sending an ordinary Unix text file to a deskjet results in literally interpreted newlines, and gets me:
Clearly more is needed, and this is the purpose of filtering. The more observant of you who read the printcap man page might have noticed the spool attributes if andof. Well, if, or the input filter, is just what we need here. If we write a small shell script called filter that adds carriage returns before newlines, the staircasing can be eliminated. So we have to add in an if line to our printcap entry above:
The only remaining problem is that printing plain text is really not too hot - surely it would be better to be able to print PostScript and other formatted or graphic types of output. Well, yes, it would, and it's easy to do. The method is simply an extension of the above linefeed-fixing filter. Such a filter is called a magic filter. Don't bother writing one yourself unless you print strange things - there are a good many written for you already, and most have easy-to-use interactive configuration tools. You should simply select a suitable pre-written filter:
There's one catch to such filters: older version of lpd don't run the if filter for remote printers, while most newer ones do (although often with no arguments). The version of LPD shipped with modern GNU/Linux and FreeBSD distributions does; most commercial Unices that still ship LPD have a version that does not. See the section on network printing later in this document for more information on this. If you only have locally-connected printers, then this won't affect you. 8.2.2. LPD for PostScript PrintersWhile most versions of LPD don't gracefully handle PostScript (never mind user options), VA Linux modified LPD and Red Hat's filtering software to support PostScript printers fairly well. Because the intention was to donate the code to the gnu project, they called it GNUlpr 8.2.2.1. How it worksVA's system uses Postscript Printer Definition, or PPD, files. PPD files are provided by printer manufacturers and declare the available options on a printer, along with the Postscript code needed to activate them. With the VA system, the normal LPD scheme works a little differently:
8.2.2.2. Obtaining and InstallingYou can obtain RPM packages, or source tarballs, from the project's website on SourceForge. For installation details, consult the project's installation micro-HOWTO. In essence, you need to uninstall the Red Hat version of printtool, lpd, and rhs-printfilters entirely, and then install the VA versions, plus ppdfilt, gpr, and a few other utilities. You will also need PPD files for your Postscript printers. PPD files are usually fairly easy to find. VA Linux and HP distribute PPD files for many Laserjet models. Other vendors provide PPDs for their own printers, and Adobe distributes PPD files for many printers. At the moment, much of this is a bit difficult to install. But future installation tools will build upon the printer configuration library libprinterconf, which enables both the autodetection and rhs-printfilter configuration of both networked and local printers.
8.2.2.3. Controlling Postscript OptionsOnce you've setup VA's Postscript-capable LPD system (GNUlpr), you can control your printer's options in two ways:
8.2.3. File PermissionsBy popular demand, I include below a listing of the permissions on interesting files on my system. There are a number of better ways to do this, ideally using only SGID binaries and not making everything SUID root, but this is how my system came out of the box, and it works for me. (Quite frankly, if your vendor can't even ship a working lpd you're in for a rough ride).
Lpd must currently be run as root so that it can bind to the low-numbered lp service port. It should probably become UID lp.lp or something after binding, but I don't think it does. This is simply one more reason to avoid the stock BSD LPD. 8.3. Large InstallationsLarge installations, by which I mean networks including more than two printers or hosts, have special needs. Below are some tips. CUPS has some nice features that make a good choice for a large network. Printer classes, access control and automatic client configuration to name a few. If you use LPD, for really large environments, merely distributing printcap/filter information becomes a difficult problem; the Cisco Enterprise Print System addresses this and is probably either a good starting point or a nearly complete solution, depending on your needs. Medium to large environments can be well supported by native LPRng features.
8.4. AccountingRegular LPD provides very little to help you with accounting. You can specify the name of an accounting file in the af printcap attribute, but this is merely passed as an argument to your if filter. It's up to you to make your if filter write entries to the accounting file, and up to you to process the accounting file later (the traditional format is mainly useful for line printers, and is nontrivial to parse in Perl, so there's no reason to preserve it). Also, if you're using foomatic-rip program as your filter, you'll need to make changes, since it depends on being given a configuration file as the ``accounting'' file name. CUPS provides page accounting by passing jobs through the pstops filter. This filter expects Postscript input. If you use print "raw" jobs, this is always counted as 1 page. This means that accounting will not work, if you print from Windows client with the native printer driver. Ghostscript provides a PageCount operator that you can use to count the number of pages in each job; basically you just tack a few lines of postscript onto the end of the job to write an accounting file entry; for the best example of this see the fileunix-lpr.sh in the Ghostscript source distribution. Note that the unix-lpr implementation of accounting writes to a file from the Ghostscript interpreter, and is thus incompatible with the recommended -dSAFER option. A better solution might be to query the printer with a PJL command after each job, or to write a postscript snippet that prints the pagecount on stdout, where it can be captured without having to write to a file. The LPRng print spooler includes an HP-specific sample implementation of accounting; I assume that it queries the printer with PJL. This technique should work for most PJL, Postscript, or SNMP printers with which you have two-way communications. If you have a networked printer that supports SNMP, you can use the npadmin program to query a pagecount after each job. This should work properly for all print jobs. See Section 11.10.1 for more information on npadmin. 9. Vendor SolutionsThis section is, by definition, incomplete. Feel free to send in details of your favorite distribution. There are a number of third-party packages out there designed to make printer configuration under Unix easy. These are covered in Section 8; see the subsection there for your particular spooling software for pointers. 9.1. Red HatRed Hat has a GUI printer administration tool called printtool which can add remote printers and printers on local devices. It lets you choose a ghostscript-supported printer type and Unix device file to print to, then installs a print queue in/etc/printcap and uses a filter program from the rhs-printfilters package to support postscript and other common input types. This solution works fairly well, and is trivial to setup for common cases. Red Hat 6.x shipped a BSD LPD flavor; Red Hat 7.x and 8.0 appear to default to using LPRng. Where Red Hat 6.x and 7.x fail is when you have a printer which isn't supported by their standard Ghostscript (which is GNU rather than Aladdin Ghostscript, and which supports fewer printers). Check in the printer compatibility list above (or online) if you find that you can't print properly with the stock Red Hat software. If your printer isn't supported by Red Hat's tools, you may need to install a contributed venison of Aladdin Ghostscript, and will probably also be better off if you use the lpdomatic or apsfilter packages, which know all about the printers supported by late-model Ghostscripts, and others besides. Red Hat 8.0 still installs LPRng by default although you can select CUPS. But even if you explicitly select only CUPS, LPRng is still installed. In Red Hat 8.1 CUPS will finally be the default spooler. Red Hat 9.0 finally uses CUPS as default spooler. 9.2. DebianDebian offers a choice between plain LPD, LPRng, or CUPS; LPRng or CUPS are probably the better choices. PDQ is provided in the unstable tree (currently called sid). Debian also offers a choice of printer configuration tools; apsfilter version 5 or later is probably your best bet, since that venison adds support for LPRng and Ghostscript's uniprint driver scheme. Red Hat's printtool is also supported, for those who like GUI administration tools. 9.3. SuSEThe printing system on SuSE Linux is based on apsfilter, with some enhancements; SuSE's apsfilter will recognize all common file formats (including HTML, if html2ps is installed). There are two ways to setup printers on SuSE systems:
The SuSE installation manual explains both of these setup procedures. Wolf Rogner reported some difficulties with SuSE. Apparently the following bugs may bite:
9.4. CalderaCaldera ships LPRng. I have no idea what sort of setup tools they offer. I've just signed up a Caldera employee as a maintainer of the LinuxPrinting.org database; evidently they plan to ship a CUPS and Foomatic-based print system in future releases. 9.5. CorelCorel is Debian-based, so all the Debian facts above should still apply. In addition, they've written their own setup tool, based on the sysAPS library which in turn uses my database. They've certainly done so as part of WordPerfect. Corel operates a printing support newsgroup named corelsupport.linux.printing. The bulk of the traffic appears to be WordPerfect and Corel Linux related. 9.6. MandrakeAs of version 7.2b1, Mandrake ships with CUPS standard. The program QtCUPS is used to provide a clean GUI administration interface. Till went to some trouble to include as many drivers as possible, and they ship CUPS PPD files build with my own foomatic interface code. Mandrake was the first distro to ship CUPS. I think Earlier Mandrake versions shipped with the Red Hat printtool. 9.7. SlackwareSlackware ships with APS Filter. The apsfilter SETUP script is installed as the command `apsfilterconfig'. You should be able to get a reasonable setup by simply running that. As of Slackware 9.0, CUPS is included in the extras dir of slackware but the default is still LPRng + APSFilter. 10. Ghostscript.Ghostscript is an incredibly significant program for free software-driven printing. Most printing software under Unix generates PostScript, which is typically a $100 option on a printer. Ghostscript, however, is free, and will generate the language of your printer from PostScript. Ghostscript is available in several forms. The commercial version of Ghostscript, called Aladdin Ghostscript, may be used freely for personal use but may not be distributed by commercial entities. It is generally a year or so ahead of the free Ghostscript; at the moment, for example, it supports many color inkjets that the older Ghostscripts do not and has rather better PDF support. The main free version of Ghostscript is GNU Ghostscript, and is simply an aged version of Aladdin ghostscript. This somewhat awkward arrangement has allowed Aladdin to be a totally self-funded free software project; the leading edge versions are done by L Peter and a few employees, and are licensed to hardware and software vendors for use in commercial products. Unfortunately, while this scheme has provided for L Peter's continued work on Ghostscript for years, it has also inhibited the participation of the wider free software community. Driver authors, in particular, find the arrangement poor. L Peter's retirement plans mandate a larger community involvement in the project, so he is considering license changes, and has established a SourceForge project. The third version of Ghostscript is ESP Ghostscript, maintained by Easy Software Products (authors of CUPS) under contract from Epson. ESP Ghostscript is a combination of the gimp-print driver project's drivers and GNU Ghostscript, plus assorted usability patches. This version is not yet in full swing, but it will be available soon, and will hopefully simplify life for owners of Gimp-print-driven printers. Whatever you do with gs, be very sure to run it with the option for disabling file access (-dSAFER). PostScript is a fully functional language, and a bad PostScript program could give you quite a headache. Speaking of PDF, Adobe's Portable Document Format (at least through 1.3) is actually little more than organized PostScript in a compressed file. Ghostscript can handle PDF input just as it does PostScript. So you can be the first on your block with a PDF-capable printer. 10.1. Invoking GhostscriptTypically, Ghostscript will be run by whatever filter you settle upon (I recommend Foomatic if your vendor didn't supply anything that suits you), but for debugging purposes it is often handy to run it directly. gs -helpwill give a brief listing of options and available drivers (note that this list is the list of drivers compiled in, not the master list of all available drivers). You might run gs for testing purposes like: `gs <options> -q -dSAFER -sOutputFile=/dev/lp1 test.ps'. 10.2. Ghostscript output tuningThere are a number of things one can do if Ghostscript's output is not satisfactory (actually, you can do anything you darn well please, since you have the source). Some of these options, and others are described in the Ghostscript User Guide (the file Use.htm in the Ghostscript distribution; possibly installed under /usr/doc or/usr/share/doc on your system) are all excellent candidates for driver options in your filter system. 10.2.1. Output location and sizeThe location, size, and aspect ratio of the image on a page is controlled by the printer-specific driver in ghostscript. If you find that your pages are coming out scrunched too short, or too long, or too big by a factor of two, you might want to look in your driver's source module and adjust whatever parameters jump out at you. Unfortunately, each driver is different, so I can't really tell you what to adjust, but most of them are reasonably well commented. 10.2.2. Gamma, dotsizes, etc.Most non-laser printers suffer from the fact that their dots are rather large. This results in pictures coming out too dark. If you experience this problem with an otherwise untunable driver, you could use your own transfer function. Simply create the following file in the ghostscript lib-dir and add its name to the gs call just before the actual file. You may need to tweak the actual values to fit your printer. Lower values result in a brighter print. Especially if your driver uses a Floyd-Steinberg algorithm to rasterize colors, lower values ( 0.2 - 0.15 ) are probably a good choice.
It is also possible to mend printers that have some kind of color fault by tweaking these values. If you do that kind of thing, I recommend using the filecolorcir.ps, that comes with ghostscript (in the examples/ subdirectory), as a test page. For many of the newer color inkjet drivers, there are command-line options, or different upp driver files, which implement gamma and other changes to adapt the printer to different paper types. You should look into this before playing with Postscript to fix things. 10.2.3. Color Printing in GhostscriptGhostscript's default color dithering is optimized for low-resolution devices. It will dither rather coarsely in an attempt to produce 60ppi output (not dpi, ppi - the "apparent" color pixels per inch you get after dithering). This produces rather poor output on modern color printers; inkjets with photo paper, in particular, are capable of much finer ppi settings. To adjust this, use the Ghostscript option-dDITHERPPI=x, where x is the value to use. This may or may not have an effect with all drivers; many newer drivers (the Epson Stylusstp driver, for example) implement their own dithering and pay no attention to this setting. Some drivers can use either the regular Ghostscript or driver-specific dithering (the Canon Bubblejet bjc600 driver, for example). Ghostscript's dithering is in fact rather rudimentary. Many things needed for good output on modern printers are simply not available in the Ghostscript core. Various projects to fix this situation—and the free software world does have the software to do so ready and waiting—are hampered by Ghostscript's licensing situation and the resulting "cathedral" development style. Beginning at the Open Source Printing Summit 2000, however, all the necessary people are talking, so you can expect this situation to improve shortly. 11. NetworksOne of the features of most spoolers is that they support printing over the network to printers physically connected to a different machine, or to the network directly. With the careful combination of filter scripts and assorted utilities, you can print transparently to printers on all sorts of networks. 11.1. Printing to a Unix/lpd hostTo allow remote machines to print to your printer using the LPD protocol, you must list the machines in/etc/hosts.equiv or/etc/hosts.lpd. (Note thathosts.equiv has a host of other effects; be sure you know what you are doing if you list any machine there). You can allow only certain users on the other machines to print to your printer by using the rs attribute; read the lpd man page for information on this. 11.1.1. With lpdTo print to another machine, you make an/etc/printcap entry like this:
11.1.2. With rlprYou can also use rlpr to send a print job directly to a queue on a remote machine without going through the hassle of configuring lpd to handle it. This is mostly useful in situations where you print to a variety of printers only occasionally. From the announcement forrlpr: Rlpr uses TCP/IP to send print jobs to lpd servers anywhere on a network. Unlike lpr, it *does not* require that the remote printers be explicitly known to the machine you wish to print from, (e.g. through /etc/printcap) and thus is considerably more flexible and requires less administration. rlpr can be used anywhere a traditional lpr might be used, and is backwards compatible with traditional BSD lpr. The main power gained by rlpr is the power to print remotely *from anywhere to anywhere* without regard for how the system you wish to print from was configured. Rlpr can work as a filter just like traditional lpr so that clients executing on a remote machine like netscape, xemacs, etc, etc can print to your local machine with little effort. Rlpr is available from Metalab. 11.2. Printing to a Windows or Samba printerThere is a Printing to Windows mini-HOWTO out there which has more info than there is here. 11.2.1. From LPDIt is possible to direct a print queue through the smbclient program (part of the Samba suite) to a TCP/IP based SMB print service. Samba includes a script to do this called smbprint. In short, you put a configuration file for the specific printer in question in the spool directory, and install the smbprint script as theif. The /etc/printcap entry goes like this:
You should read the documentation inside the smbprint script for more information on how to set this up. You can also use smbclient to submit a file directly to an SMB printing service without involving lpd. See the man page. 11.3. Printing to a NetWare PrinterThe ncpfs suite includes a utility called nprint which provides the same functionality as smbprint but for NetWare. You can get ncpfs from Metalab. From the LSM entry for version 0.16: "With ncpfs you can mount volumes of your NetWare server under Linux. You can also print to NetWare print queues and spool NetWare print queues to the Un*x print spooler. You need kernel 1.2.x or 1.3.54 and above. ncpfs does NOT work with any 1.3.x kernel below 1.3.54." 11.3.1. From LPDTo make nprint work via lpd, you write a little shell script to print stdin on the NetWare printer, and install that as the if for an lpd print queue. You'll get something like:
11.4. Printing to an EtherTalk (Apple) printerThe netatalk package includes something like nprint and smbclient. Others have documented the procedure for printing to and from an Apple network far better than I ever will; see the Linux Netatalk-HOWTO. 11.5. Printing to a networked printerMany printers come with an ethernet interface which you can print to directly, typically using the LPD protocol. You should follow the instructions that came with your printer or its network adaptor, but in general, such printers are "running" lpd, and provide one or more queues which you can print to. An HP, for example, might work with a printcap like:
HP Laserjet printers with JetDirect interfaces generally support two built in lpd queues - "raw" which accepts PCL (and possibly Postscript) and "text" which accepts straight ascii (and copes automatically with the staircase effect). If you've got a JetDirect Plus3 three-port box, the queues are named "raw1", "text2", and so forth. Note that the ISS company has identified an assortment of denial of service attacks which hang HP Jetdirect interfaces. Most of these have been addressed beginning in Fall 98. These sorts of problems are common in embedded code; few appliance-style devices should be exposed to general Internet traffic. In a large scale environment, especially a large environment where some printers do not support PostScript, it may be useful to establish a dedicated print server to which all machines print and on which all ghostscript jobs are run. This will allow the queue to be paused or reordered using the topq and lprm commands. This also allows your GNU/Linux box to act as a spool server for the printer so that your network users can complete their print jobs quickly and get on with things without waiting for the printer to print any other job that someone else has sent. This is suggested too if you have unfixable older HP Jetdirects; it reduces the likelihood of the printers wedging. To do this, set up a queue on your linux box that points at the ethernet equipped HP LJ (as above). Now set up all the clients on your LAN to point at the LPD queue (eg lj-5 in the example above). Some HP network printers apparently don't heed the banner page setting sent by clients; you can turn off their internally generated banner page by telnetting to the printer, hitting return twice, typing "banner: 0" followed by "quit". There are other settings you can change this way, as well; type "?" to see a list. The full range of settings can be controlled with HP's webJetAdmin software. This package runs as a daemon, and accepts http requests on a designated port. It serves up forms and Java applets which can control HP printers on the network. In theory, it can also control Unix print queues, but it does so using the rexec service, which is completely unsecure. I don't advise using that feature. 11.5.1. To AppSocket DevicesSome printers (and printer networking "black boxes") support only a cheesy little non-protocol involving plain TCP connections; this is sometimes called the "AppSocket" protocol. Notable in this category are early-model JetDirect (including some JetDirectEx) cards. Basically, to print to the printer, you must open a TCP connection to the printer on a specified port (typically 9100, or 9100, 9101 and 9102 for three-port boxes) and stuff your print job into it. LPRng has built-in support for stuffing print jobs into random TCP ports, but with BSD lpd it's not so easy. The best thing is probably to obtain and use the little utility called netcat. Failing that, it can be implemented, among other ways, in Perl using the program below. For better performance, use the program netcat ("nc"), which does much the same thing in a general purpose way. Most distributions should have netcat available in prepackaged form. 11.6. Running an if for remote printers with old LPDsOne oddity of older versions of lpd is that the if is not run for remote printers. (Versions after 0.43 or so have the change originated on FreeBSD such that the if is always run). If you find that you need to run anif for a remote printer, and it isn't working with your lpr, you can do so by setting up a double queue and requeueing the job. As an example, consider thisprintcap:
The -U option to lpr only works if lpr is run as daemon, and it sets the submitter's name for the job in the resubmitted queue correctly. You should probably use a more robust method of getting the username, since in some cases it is not argument 5. See the man page for printcap. 11.7. From Windows.Printing from a Windows (or presumably, OS/2) client to a Un*x server is directly supported over SMB through the use of the SAMBA package, which also supports file sharing of your Un*x filesystem to Windows clients. Samba includes fairly complete documentation, and there is a good Samba FAQ which covers it, too. You can either configure a magic filter on the Un*x box and print PostScript to it, or run around installing printer-specific drivers on all the Windows machines and having a queue for them with no filters at all. Relying on the Windows drivers may in some cases produce better output, but is a bit more of an administrative hassle if there are many Windows boxes. So try Postscript first. Modern versions of Samba should support the automagical driver download mechanism offered by Windows NT servers to deal with this problem. 11.8. From an Apple.Netatalk supports printing from Apple clients over EtherTalk. See the Netatalk HOWTO Page for more information. Really, though, any modern Mac can print over TCP/IP using the LPD protocol just fine. UVa provides a very nice support page detailing how to set this up. 11.9. From Netware.The ncpfs package includes a daemon named pserver which can be used to provide service to a NetWare print queue. From what I understand, this system requires a Bindery-based NetWare, eg 2.x, 3.x, or 4.x with bindery access enabled. For more information on ncpfs and it's pserver program, see the ncpfs FTP site. 11.10. Networked Printer AdministrationMost networked printers support some method of remote administration. Often there are easy-to-use web pages for configuration. More usefully, there is often support for SNMP management. Typically you can find out interesting information on printer status like ink and paper levels, print volumes, and so forth, and you can usually change certain settings. SNMP printer control, and a number of other printing-related things, are being standardized by the IEEE's Printer Working Group 11.10.1. npadminNpadminis a command-line program which offers an interface to the common SNMP functionality of networked printers. It implements the standard Printer MIB, as well as a few vendor-proprietary schemes used mainly for older devices. Both printer-discovery style actions and various printer status queries are supported. npadmin has an excellent man page, and precompiled packages are distributed for a number of RPM and dpkg based distributions. 11.10.2. Other SNMP toolsBesides npadmin, there are a number of SNMP tools that will be useful. snmptraplogd can log SNMP trap events. This is useful for observing printer jams, out of paper events, etc; it would be straightforward to retransmit certain events to a pager, or to send an email. While npadmin provides simplified support for many network printers' SNMP interfaces, some printers may have vendor extensions which npadmin doesn't know about. In this case, you can use the CMU SNMP tools, which support arbitrary SNMP GET and SET operations, as well as walks and the like. With these, and a bit of work, you can make use of any SNMP feature offered by your printer's MIB. You may need to obtain a MIB from your vendor to figure out what all the variables are; sometimes vendors think that people actually use the proprietary tools they ship. VA Linux's libprinterconf includes code to perform network printer discovery. Printers are identified against a compiled-in library of printer signatures; at the moment the library is not large, but does cover many common networked printer models. 12. Windows-only printersAs I discussed earlier, some printers are inherently unsupported because they don't speak a normal printer language, instead using the computer's CPU to render a bitmap which is then piped to the printer at a fixed speed. In a few cases, these printers also speak something normal like PCL, but often they do not. In some (really low-end) cases, the printer doesn't even use a normal parallel connection but relies on the vendor's driver to emulate what should be hardware behavior (most importantly flow control). In any case, there are a few possible workarounds if you find yourself stuck with such a lemon. 12.1. The Ghostscript Windows redirectorThere is now a Ghostscript printer driver available (called mswinpr2) that will print using Windows GDI calls. There is also a port redirection tool called redmon which will run a print job through Ghostscript before finally printing it. (Rather like an if filter in Unix's LPD). Taken all together, this allows a Windows machine to print PostScript to a Windows-only printer through the vendor's driver. If you have a host-based printer that can't be used directly, you can export it as a "Postscript" printer by using redmon, Ghostscript, and mswinpr2 on a Windows PC and print through the vendor's drivers. 12.2. HP WinprintersSome HP printers use "Printing Performance Architecture" (marketing speak for "we were too cheap to implement PCL"). This is supported in a roundabout way via the pbm2ppa translator written by Tim Norman. Basically, you use ghostscript to render PostScript into a bitmapped image in pbm format and then use pbm2ppa to translate this into a printer-specific ppa format bitmap ready to be dumped to the printer. This program may also come in ghostscript driver format by now. The ppa software can be had from the ppa home page; pbm2ppa supports some models of the HP 720, 820, and 1000; read the documentation that comes with the package for more details on ppa printer support. 12.3. Lexmark WinprintersMost of the cheap Lexmark inkjets use a proprietary language and are therefore Winprinters. However, Henryk Paluch has written a program which can print on a Lexmark 7000. Hopefully he'll be able to figure out color and expand support to other Lexmark inkjets. See here for more info. Similarly, there are now drivers for the 5700, 1000, 1100, 2070, 3200, and others. See the supported printers listing above, and my web site, for more information on obtaining these drivers. 13. How to print to a fax machine.You can print to a fax machine with, or without, a modem. 13.1. Using a faxmodemThere are a number of fax programs out there that will let you fax and receive documents. One of the most powerful is Sam Leffler's HylaFAX. It supports all sorts of things from multiple modems to broadcasting. SuSE ships a Java HylaFax client which allegedly works on any Java platform (including Windows and GNU/Linux). There are also non-Java fax clients for most platforms; GNU/Linux can almost certainly handle your network faxing needs. Also available, and a better choice for smaller installations, is efax, a simple program which sends and receives faxes. The getty program mgetty can receive faxes using efax (and do voicemail or interactive logins). 13.2. Using the Remote Printing ServiceThere is an experimental service offered that lets you send an email message containing something you'd like printed such that it will appear on a fax machine elsewhere. Nice formats like postscript are supported, so even though global coverage is spotty, this can still be a very useful service. For more information on printing via the remote printing service, see the Remote Printing WWW Site. 13.3. Commercial Faxing ServicesA number of companies operate web-based faxing services. EFax, in particular, offers free inbound faxes (to your own dedicated fax number, no less) via email, and fax transmission for a fee. Other companies offer similar services. 14. How to generate something worth printing.Here we get into a real rat's-nest of software. Basically, Linux can run many types of binaries with varying degrees of success: Linux/x86, Linux/Alpha, Linux/Sparc, Linux/foo, iBCS, Win16/Win32s (with dosemu and, someday, with Wine), Mac/68k (with Executor), and Java. I'll just discuss native GNU/Linux and common Un*x software. 14.1. Markup languagesMost markup languages are more suitable for large or repetitive projects, where you want the computer to control the layout of the text to make things uniform.
14.2. WYSIWYG Word ProcessorsThere is no shortage of WYSIWYG word processing software. Several complete office suites are available, including one that's free for personal use (StarOffice).
Other vendors should feel free to drop me a line with your offerings. 15. Printing PhotographsThere are many details to getting decent photo output from common printers. If you haven't bought a photo printer yet, see the photo-related tips in Section 5.4. 15.1. Ghostscript and PhotosGhostscript has some difficulties rendering color photographs through most drivers. The problems are several:
That said, the obvious solution for now is to use non-Ghostscript software for printing photos, and indeed, such things do exist. The main contender is the print plugin in the Gimp, which supports pixel-for-pixel printing on Epson Styluses and Postscript printers (with basic PPD support). That Epson Stylus portion of that driver is available for Ghostcript, as well, as thestp driver. Also possible to use for this purpose are the assorted external pnm-to-foo programs used to print on printers like the cheap Lexmarks; these print attempt to print pixmaps pixel-for-pixel. The best solution, of course, is to buy a Postscript printer; such printers can usually be completely controlled from available free software, and will print to the full capability of the printer. 15.2. PaperColor inkjets are extremely dependent on the paper for good output. The expensive glossy coated inkjet papers will allow you to produce near-photographic output, while plain uncoated paper will often produce muddy colors and fuzzy details. Non-glossy coated inkjet papers will produce results in between, and are probably best for final prints of text, as well. Stiffer glossy coated "photo" papers will produce similar output to lighter-weight glossy papers, but will feel like a regular photo. 15.3. Printer SettingsFor photo output on most color inkjets, you should use the most highly interlaced (and slowest) print mode; otherwise solid regions may have banding or weak colors. Generally with Ghostscript this is what will happen when you pick the highest resolution. With Postscript printers, you may need to add a snippet to the prologue based on the settings available in the PPD file. The Gimp's PPD support doesn't include (printer-specific) print quality settings, but I added one in an ugly way for my own use; contact me if you'd like that. If you use PDQ or CUPS, you can easily control all the printer settings you need. VA Linux'slibppd and the GPR front-end can also add these options for Postscript printers. 15.4. Print DurabilityColor inkjet printouts usually fade after a few years, especially if exposed to lots of light and air; this is a function of the ink. Printers with ink-only consumables like the Epsons and Canons can buy archival inks, which are less prone to this problem. Newer printers often use pigment-based inks, which don't fade as much as the older dye-based ink did. No inkjet output is really particularly good for long-term archival use. Write the bits to a CD-R and store that instead. 15.5. Shareware and Commercial SoftwareThere's a program called xwtools which supports photo printing with all the bells and whistles on an assortment of Epson, HP, and Canon printers. Unfortunately, it was written under NDA, so comes without source. Unless you use it for the Epson Stylus Color 300 on GNU/Linux x86, it costs E15 for personal use; commercial pricing is unknown. The ESP Print Pro package from Easy Software supports some printers which might otherwise be unsupported. These drivers are not reported to be very well-tuned for photos, but they do work. 16. On-screen previewing of printable things.Nearly anything you can print can be viewed on the screen, too. 16.1. PostScriptGhostscript has an X11 driver best used under the management of the PostScript previewer gv. The latest versions of these programs should be able to view PDF files, as well. Note that gv has replaced the older previewer "Ghostview"; the new user interface is much prettier and featureful that ghostview's plain old Athena GUI. 16.2. TeX dviTeX DeVice Independent files may be previewed under X11 withxdvi. Modern versions of xdvi call ghostscript to render PostScript specials. A VT100 driver exists as well. It's called dgvt. Tmview works with GNU/Linux and svgalib, if that's all you can do. 16.3. Adobe PDFAdobe's Acrobat Reader is available for GNU/Linux; just download it from the Adobe web site. You can also use xpdf, which is free software, and I believegv supports viewing PDF files with gs under X11. 17. Serial printers under lpdSerial printers are rather tricky under lpd. 17.1. Setting up in printcapLpd provides five attributes which you can set in/etc/printcap to control all the settings of the serial port a printer is on. Read the printcap man page and note the meanings ofbr#, fc#,xc#, fs# andxs#. The last four of these attributes are bitmaps indicating the settings for use the port. Thebr# attribute is simply the baud rate, eg `br#9600'. It is very easy to translate from stty settings to printcap flag settings. If you need to, see the man page for stty now. Use stty to set up the printer port so that you can cat a file to it and have it print correctly. Here's what `stty -a' looks like for my printer port:
You actually use stty in a somewhat odd way. Since stty operates on the terminal connected to it's standard input, you use it to manipulate a given serial port by using the `<' character as above. Once you have your stty settings right, so that `cat file > /dev/ttyS2' (in my case) sends the file to the printer, look at the file /usr/src/linux/include/asm-i386/termbits.h. This contains a lot of #defines and a few structs (You may wish to cat this file to the printer (you do have that working, right?) and use it as scratch paper). Go to the section that starts out
Note which of those settings are preceded with a - in your stty output. Sum up all those numbers (they are octal). This represents the bits you want to clear, so the result is yourfc# capability. Of course, remember that you will be setting bits directly after you clear, so you can just use `fc#0177777' (I do). Now do the same for those settings (listed in this section) which do not have a - before them in your stty output. In my example the important ones are CS8 (0000060), HUPCL (0002000), and CREAD (0000200). Also note the flags for your baud rate (mine is 0000015). Add those all up, and in my example you get 0002275. This goes in your fs# capability (`fs#02275' works fine in my example). Do the same with set and clear for the next section of the include file, "c_lflag bits". In my case I didn't have to set anything, so I just use `xc#0157777' and `xs#0'. 17.2. Older serial printers that drop charactersJon Luckey points out that some older serial printers with ten-cent serial interfaces and small buffersreally mean stop when they say so with flow control. He found that disabling the FIFO in his Linux box's 16550 serial port with setserial corrected the problem of dropped characters (you apparently just specify the UART type as an 8250 to do this). 18. What's missing?Many of the parts for a complete printing system do not exist yet. Projects are underway to address most of these, although most have not yet produced running useful code, and efforts to standardize the necessary protocols and APIs are in their infancy. 18.1. PlumbingThere's a general problem with getting all the parts to talk to one another; especially in a spooler-independent way. This problem manifests itself most noticeably in the pathetic application support for control over all the "usual" printing features. There is simply no way for an application writer to get information about printers, jobs, etc; no standardized way to submit jobs; no good way to get job status back; nor even really a standardized way to generate print data (although most of the new desktop systems offer desktop-specific facilities for doing this). 18.2. FontsFont handling on free systems is rather awkward. The display, the printer, the application, and the data files should ideally all have access to the same fonts. Unfortunately this was simply not the case. With the advent of xft2 and fontconfig - which the newest distributions will start deploying - this should finally be solved. Redhat 8.0 is AFAIK the first distro that uses xft2. 18.3. DriversThere is still some work to be done on free software drivers. Although the drivers have improved a lot the last several years, not all printers are supported. Printer vendors have a major role to play in this area. With the increasing popularity of Linux it is getting really hard for them to simple ignore this userbase. 19. CreditsSpecial thanks to Grant Taylor for creating this HOWTO and to Till Kampeter for foomatic and his expert advice. The smbprint information is from an article by Marcel Roelofs <marcel@paragon.nl>. The nprint information for using Netware printers was provided by Michael Smith <mikes@bioch.ox.ac.uk>. The serial printers under lpd section is from Andrew Tefft <teffta@engr.dnet.ge.com>. The blurb about gammas and such for gs was sent in by Andreas<quasi@hub-fue.franken.de>. The two paragraphs about the 30 second closing_wait of the serial driver was contributed by Chris Johnson <cdj@netcom.com>. Robert Hart sent a few excellent paragraphs about setting up a print server to networked HPs which Grant used verbatim. And special thanks to the dozens upon dozens of you who've pointed out typos, bad URLs, and errors in the document over the years. A. GNU Free Documentation LicenseVersion 1.2, November 2002
A.1. PREAMBLEThe purpose of this License is to make a manual, textbook, or other functional and useful document "free" in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others. This License is a kind of "copyleft", which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software. We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference. A.2. APPLICABILITY AND DEFINITIONSThis License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The "Document", below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as "you". You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law. A "Modified Version" of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language. A "Secondary Section" is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them. The "Invariant Sections" are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none. The "Cover Texts" are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words. A "Transparent" copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not "Transparent" is called "Opaque". Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only. The "Title Page" means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, "Title Page" means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text. A section "Entitled XYZ" means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as "Acknowledgements", "Dedications", "Endorsements", or "History".) To "Preserve the Title" of such a section when you modify the Document means that it remains a section "Entitled XYZ" according to this definition. The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License. A.3. VERBATIM COPYINGYou may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3. You may also lend copies, under the same conditions stated above, and you may publicly display copies. A.4. COPYING IN QUANTITYIf you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects. If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages. If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public. It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document. A.5. MODIFICATIONSYou may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version:
If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles. You may add a section Entitled "Endorsements", provided it contains nothing but endorsements of your Modified Version by various parties--for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard. You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one. The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version. A.6. COMBINING DOCUMENTSYou may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers. The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work. In the combination, you must combine any sections Entitled "History" in the various original documents, forming one section Entitled "History"; likewise combine any sections Entitled "Acknowledgements", and any sections Entitled "Dedications". You must delete all sections Entitled "Endorsements". A.7. COLLECTIONS OF DOCUMENTSYou may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects. You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document. A.8. AGGREGATION WITH INDEPENDENT WORKSA compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an "aggregate" if the copyright resulting from the compilation is not used to limit the legal rights of the compilation's users beyond what the individual works permit. When the Document is included an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document. If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document's Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate. A.9. TRANSLATIONTranslation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail. If a section in the Document is Entitled "Acknowledgements", "Dedications", or "History", the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title. A.10. TERMINATIONYou may not copy, modify, sublicense, or distribute the Document except as expressly provided for under this License. Any other attempt to copy, modify, sublicense or distribute the Document is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. A.11. FUTURE REVISIONS OF THIS LICENSEThe Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See http://www.gnu.org/copyleft/. Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License "or any later version" applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. A.12. ADDENDUM: How to use this License for your documentsTo use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page:
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the "with...Texts." line with this:
If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation. If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software. |