Desktop FreeBSD Part 4: Printing

By Ed Hurst | Posted at 12:05 PM
As a writer, the only reason I ever got that first computer was because it was far more efficient than a typewriter, and certainly more readable than my own handwriting. The sheer volume of what I've turned out over the years would be impossible for me to manage on paper. Add to that all the stuff written by others that I wanted to save, and it boggles the mind. Still, most of what I've written is read by others on paper. That means I have to translate my electronic files into readable paper copies. That first computer would have been nearly useless to me without the attached printer.

Open Source printing is one of the most powerful systems, yet remains an ugly kludge in some ways. When multi-user computing was born, printing was either from machines that were merely automated typewriters ("raw" printers) or the work of fancy type-setting equipment. These two elements remain the heart of Open Source printing. It is not built into the system, but is an add-on if you need it. I no longer print very much, but when I do, it needs to be clean and readable.

Note: The first version of this tutorial was a long and complicated process of setting up the CUPS (Common Unix Printing Service) server with some enhancements. Since first writing that, a few things have changed on the website that offers the printer drivers and they are no longer compatible with FreeBSD 4.9 in many cases. For now, I am recommending that newbies to FreeBSD stick with the tried-and-true Apsfilter package. What follows is far simpler, since Apsfilter has a much easier setup than CUPS.


To do this, life is much simpler if you login as root and run your desktop by typing startx at the command line. I'm assuming here you are using KDE. First, we have to make sure all the proper software packages are present. Here is a list of what you'll need for most printers:

  • apsfilter
  • psutils-letter
  • curl
  • perl
  • n
  • ghostscript-gnu
  • cups-base
  • cups- pstoraster
  • gimp-print
  • libijs
  • n
  • foomatic-db

Perl is usually installed by default. The last four on the list allow you a wider selection of print drivers that Apsfilter can use. One more package is needed if you do anything with laser-jet printers: "hpijs." As with many things, if you choose to install these through the ports system, you won't need to worry much about which package depends on another. For example, if you simply install Apsfilter this way:

    cd /usr/ports/print/apsfilter/
    make install

it will download, compile and install all the packages needed for Apsfilter itself. If you do the same for "gimp-print," it will know to get the "libijs" package on which it depends. The "foomatic-db" package needs "curl." If you try to install these as packages already built, you'll get a warning when you try to install a package that depends on another that's missing:

    Can't find package xxxx!

or words to that effect. Then you will know precisely what's missing. Simply get the missing package(s) and install it first, then return to the first one. The exercise becomes more civilized if you learn at least one trick. When you visit and look at the ports index, you will see at the bottom of each package description a list of packages required to build from source via ports. On the main page of the website, on the left-hand column, see the link "Ported Applications" under the "Software" heading.


Once everything is installed, login as root. Apsfilter is set up only on the command line, so simply type in a terminal window apsfilter and ENTER. You will see an interesting ASCII art presentation that asks you to accept the license. Obviously, you'll have to type y for yes or you can't do the setup. Since it involves merely agreeing to send the author a postcard, it shouldn't be too onerous. Send an e-mail to the address specified and you should get back a snail-mail address to which you send a simple postcard. Since the next screen asks you for your e-mail address, and the script attempts to handle the whole thing for you, it's not bad at all (though that final step could fail, depending on your system mail setup and your ISP).

The next screen is just the title page, so hit ENTER. The following one is for your information, and you should read it, then ENTER. If you don't have a version of Ghostscript that Apsfilter can use, it will terminate there with a message. If you followed my advice for installation in the first lesson, this should not be an issue.

From there, the script branches out in several directions depending on what it finds. It requires rather careful attention to the options listed and the keyboard commands available for each section. If you fail at any point, and feel you need to start over, simply hit CTRL+C and the script will terminate. Then you can restart, being careful to select the o option offered to overwrite the previous attempt. Don't be ashamed of having to go through it several times; it happens to seasoned veterans, too. It will be a little frustrating, but to make the script any more idiot-proof would make the whole thing much larger and harder to use.

One screen in particular will be confusing at first, and that is the main options screen, because it shows a checklist of things you need to do, and off to the right whether (or how) each item is completed.

      A P S F I L T E R   S E T U P                   -- MAIN MENUE --

    (D)     Available Device Drivers in your gs binary
 (R)     Read Ghostscript driver documentation (devices.txt)

    (1)     Printer Driver Selection []
    (2)     Interface Setup                         []
 (3)     Paper Format                            []
    (4) Printing Quality                        []
    (5)     Color Mode []
    (6)     Print Resolution in "dots per inch"     []
    (7)     Default Printing Method []

When asked to give the printer a system name, "lp" is the norm. Also, the "PRINTER DRIVER SELECTION" page you may have to see several time until you select the right type of driver:

     Please select the type of printer you want to install:
     1)  PostScript printer (generic)
     2)  PostScript printer (with ghostscript drivers)
     3)  printer driver natively supported by ghostscript
     4)  gimp-print (stp driver; version 4.2.x)
 5)  gimp-print (ijs driver; version 4.2.1 and later)
     6) hpdj
     7)  pcl3 (successor to hpdj)
     8)  IBM Omni
 9)  various HP Deskjet drivers
     10) PPA printer
     11) official HP DeskJet drivers (hpijs 0.97)
     12) official HP DeskJet drivers (hpijs 1.1 and later)
     13) Epson printer (official drivers)
     14) Lexmark inkjet printer
     15) miscellaneous other drivers
     16) non-printer devices (caution! -- read the handbook)

     0)  return to main menu

The first two are the easiest, if you have a Postscript-ready printer. Number 3 is largely for dot-matrix and daisy-wheel printers. You should probably try 4 and then 5 for most ink-jet type printers. However, notice the official driver groups offered further down. You will have to try whatever you feel best suits your situation. At some point, you get to test the setup before the final configuration is written. The test page includes a photo of the author, among other things.

The whole process ends with a series of amusing self-promotions by the author, along with some important notices of recent changes in the package. You'll need to start the print server; in a terminal window type the command lpd and you should see a response indicating all is well. To insure that the print server is started whenever you boot, put this line in /etc/rc.conf:


Once you are finished, you can then check the results easily in KDE by going to Kmenu > Settings > Printing Manager. I usually do this while logged in as root, to insure it all works properly. You can find error messages at /var/log/lpd-errs. If you don't understand what you see there, it should at least provide something you can post to forums and newsgroups when seeking advice.

If all is right, the Printing Manager window should indicate a printer with whatever name you chose to call it. In my case, "lp" is listed first in the device window, with a printer icon. Click on it and use the tabs in the lower half of the application window to see if all seems normal. The last tab will offer you a chance to examine the settings and print another test page that is generated by the CUPS package. If you like the results, be sure to go through the same procedure with the Printing Manager when logged into KDE under your user account.

Ed Hurst is Associate Editor of Open for Business. Ed is also the Music Director for Grace Baptist Church of Kickapoo Creek, Texas. He loves computers, runs FreeBSD and GNU/Linux and reads all sorts of things. You can reach Ed at