AddThis Social Bookmark Button


Unix Printing Basics

by Dru Lavigne, author of BSD Hacks

Somewhere there must be a theory stating that the amount of configuration knowledge required is directly proportional to the need for using said configured service. This is certainly often the case with printing.

True, the configuration interfaces have steadily improved in the past few years. However, administrators still need a fair bit of knowledge to understand which particular software bits they need to make the most of the features of a particular printer. Additionally, the vast array of software available often confuses new users. As an example, there are more than 300 print applications available in the ports collection. Where exactly does one start?

In the next few articles, I'll explain some basic printing terminology. I'll also discuss some of the available applications for each printing component and cover some of the pros and cons of each application. Throughout, I'll demonstrate applying this knowledge to an example printer.

If you haven't already, take some time and skim through the printing section of the FreeBSD handbook. While you may not understand everything, that section will still give you a good overview of the printing process on a Unix system. If you're new to hardware, you'll also find the "hardware setup" and "troubleshooting" subsections very helpful if you're having problems physically setting up your printer.

The Spooler

Let's start with the various components available when setting up your printer. Regardless of the operating system, the main printing software component will always be the spooler. This piece of software receives your print request, known as a print job, and places it in a print queue. As the name suggests, a queue is a lineup of jobs waiting for their turn to receive access to the hardware printer. The spooler monitors both the queue and the printer. As the printer becomes available, the spooler sends the next job for printing. Once the print successfully completes, the spooler removes the job from the queue and moves on to the next job.

Your FreeBSD system comes with lpd, the original Unix spooler. Another popular spooler, LPRng (LPR new generation), is available in the ports collection.

Both spoolers use the printer capability database located in /etc/printcap for configuration. Did you notice that the bulk of the printing section of the handbook deals with the proper configuration of this file? That's for good reason; all printing components rely on the spooler, which calls them based on their appearance in the spooler configuration file. Depending upon your particular printer, it may be easier to create this file manually or use a printer configuration tool to create the necessary /etc/printcap entries. I'll discuss both methods shortly.


Technically, a configured spooler will allow you to access your printer. You'll often want additional components, though. After all, your printer isn't very useful if it can only print gobbledygook or unformatted text with all of the appeal of plain ASCII on a terminal. It's also rather disappointing if your particular printer model comes with a slew of features, none of which you can access.

One of the required components is usually Ghostscript, especially if your printer was created for the home market. Most Unix programs assume that your printer speaks the PostScript printing language found in PostScript (which usually means expensive) printers.

Ghostscript provides a collection of print drivers. A print driver provides the necessary translation between programs and the language spoken by your particular printer. It also includes the command set required to access the features provided by your printer. Additionally, a print driver often uses a PPD (PostScript Printer Description) file to understand the capabilities of a particular printer.

LinuxPrinting has an excellent article on the interaction of PostScript, Ghostscript, print drivers, and PPDs.

Magic Filters and Configuration Utilities

Another useful component is the magic, smart, or input filter. This software recognizes different print formats and sends a job first to a necessary conversion program. Such filters usually come with a configuration utility, allowing for a fairly easy setup. Example filters from the ports collection include:

Finally, your window manager may also provide a printer subsystem that includes a printer setup utility. For example, KDEPrint gives detailed instructions for using KDEPrint, and Gnome provides the Gnome Print Manager.

Researching Your Printer

OK, now that we're aware of the various pieces, where do we go from here? Let's start with a checklist:

  • A spooler (FreeBSD comes with lpd).
  • Ghostscript.
  • A print driver specific to your printer.

Depending upon which ports you've installed on your system, you may or may not already have Ghostscript. To see if you do:

% gs -v
GNU Ghostscript 7.07 (2003-05-17)
Copyright (C) 2003 artofcode LLC, Benicia, CA. All rights reserved.

Note that the name of the Ghostscript executable is gs. If you receive similar output, you have Ghostscript. If for some reason you don't keep your ports up-to-date, double-check that your version of Ghostscript is the latest available from the ports collection. Since Ghostscript is a collection of drivers and the maintainers constantly add new drivers, you do want a recent version of Ghostscript.

If you instead receive an error message about a missing command, install Ghostscript:

# cd /usr/ports/print/ghostscript-gnu
# make install clean

During the install, you'll receive a menu asking which portions to install. If you want, deselect the drivers you don't need. If you're not sure, stick with the defaults.

Next, you need to research the availability of a print driver for your particular printer model. This will let you know if there is an available Unix print driver and provide clues regarding the best route for installing and configuring that driver. Start your search at the Un*x printer compatibility database.

As an example, I have an HP OfficeJet 4110. Fortunately for me, there is an entry in the database for this printer. Hopefully, your particular model will be here as well. (If you're in the market for a printer, check out Suggested Printers for Free Software Users for practical advice on choosing a printer).

Click on the hyperlink for your model to receive a detailed description of the features and quirks provided by the driver. Before proceeding, carefully read through the driver description to see if there's anything you need to know. I made note of the following:

  • The hpijs driver is the recommended driver for my printer.
  • The hpoj driver of 0.9 or newer in conjunction with libusb will allow me to access my printer's scanning feature.
  • There is a patch available to take advantage of black ink.

Armed with this information, my next stop is the FreeBSD Ports search engine to see if there are any related FreeBSD ports. A search for hpijs and hpoj shows a port for each.

For now, I'll install the hpijs driver; once I've configured my printer, I'll experiment with hpoj and that black ink patch.

# cd /usr/ports/print/hpijs
# make install

Note: Always check the ports collection for your driver. The print drivers that come with Ghostscript are compiled into its binary. Sometimes you'll need an additional port as a Ghostscript add-on to access the printer's full feature set. In my case, hpijs is an add-on to the ijs driver compiled into Ghostscript. I don't need hpoj for printing per se, only for accessing the scanning features of my all-in-one printer.

Pages: 1, 2

Next Pagearrow