Desktop FreeBSD Part 5: Printing
By Ed Hurst | Jun 11, 2007 at 14:45:2
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. Even though most of what I've written is read by
others online, I still have to produce paper copies from time to time.
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 printers. 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.
You should have gotten most of the basic packages when you elected
to install KDE. It comes with CUPS, which is the main printer control
software. With recent improvements in CUPS and how it has been ported
to FreeBSD, it's now quite easy to set up. Much depends on your
printer. The best place to learn how CUPS will handle your printer is
to visit the Free
Standards Group database to see if your printer will work with
CUPS, and any peculiarities. For example, my HP DeskJet works fine with
the standard HP drivers (HPIJS). It might offer more features if I were
to install the newest HPLIP driver system from HP, but it's a real
boondoggle on FreeBSD, and doesn't always work without breaking
something else.
While there at the Free Standards Group site, click on the link for
"Printer information" and read up on recommended drivers. Then look for
the input boxes which allow you input a request for the best driver for
any particular supported printer. They will produce for you the latest
version of the driver as a PPD file. Save it, then gzip it:
gzip Printer-Driver.ppd
Copy it to the appropriate directory under /usr/local/share/ppd/.
For example, HP DeskJet drivers go in /usr/local/share/ppd/HP/. If you
have an oddball driver, simply drop it in the ppd directory. CUPS
should still be able to find it.
This assumes the most common types of hardware, which means a
printer connected via a USB cable. If you are using an older parallel
printer cable, you can skip the "devfs" items in 2, 3 and 4
below. Make sure the printer is plugged in appropriately and turned
on.
1. Make sure the original BSD printer commands do
not conflict with those provided by the CUPS package. The built-in BSD
commands are in /usr/bin, but those for CUPS are in
/usr/local/bin:
mv /usr/bin/lp /usr/bin/bak.lp
mv /usr/bin/lpr /usr/bin/bak.lpr
mv /usr/bin/lprm /usr/bin/bak.lprm
mv /usr/bin/lpq /usr/bin/bak.lpq
Should you ever need to undo this, it's a simple matter of renaming
these files back by removing the "bak." from the names.
2. In /etc/rc.conf, add
cupsd_enable="YES"
devfs_rulesets="/etc/defaults/devfs.rules /etc/devfs.rules"
devfs_system_ruleset="local_ruleset"
3. Then create /etc/devfs.rules. In
that file:
[local_ruleset=10]
add path 'ulpt*' user root group cups mode 664
4. Run the command
/etc/rc.d/devfs restart
5. Next, run the command
/usr/local/etc/rc.d/cupsd start
You should see a response indicating it's running.
6. Run this command to use Kongqueror as root:
konqueror http://localhost:631/admin
This should open the CUPS administrative webpage on your system. For
the most part, it's a simple matter of reading the instructions and
following the steps provided. Basically, five items:
a. You will be asked to give the
printer an internal name. Most of the time, "lp" is the best
choice.
b. The location is whatever you find
useful, but standard choices are "local" or "USB"
and so forth.
c. Description is the place to give the
proper marketing name. That might be "Brother HL-1440" or
"HP DJ-5440" and such.
d. Device is the electronic interface. For
USB printers, that's "/dev/upt0" for the first printer. Some
older printers can make your FreeBSD system choke, even crash. If that
happens, try the parallel cable connection. Using the older parallel
printer cables, that would be "/dev/lpt0" -- be aware there
may be a slew of error message when using some printers about IRQ 7.
You'll have to read up on that; I can't summarize it here. However, I
can warn you now you'll need to do a few things summarized
here.
e. Driver: In the drop-down search for the
driver you installed from the Free Standards Group website. Once you've
selected it, the browser page should indicate it's ready to go. Print a
test page and see what you get. Users can do some fine tuning under KDE
Control Center, under Peripherals > Printers. In the lower left
corner, select the CUPS printer queue. Click on the "lp" in
the printer device list window, and on the last tab --
"Instances" -- click the "Settings" button and
examine the options. For most modern HP inkjets, there's not much you
need to do, because the printer will detect the paper and adjust
settings automatically. Other brands of printer may do the
same.
If it all works more or less as expected, you're done.
Ed Hurst is Associate Editor of Open for Business.