| Getting Started with Linux - Lesson 17 |
|---|
Printing under Linux
Although this is my personal opinion and I have not done scientific research
on this topic, I would say that word processing is probably the computer
activity which is done with the most frequency. E-mail may be surpassing the
popularity of basic word processing (e-mail is just an extension of that,
really). The fact is that people open up their word processor of choice
(or the one they're forced to use at work) and write things on a pretty regular
basis. Writing things, logically, means printing them afterwards. Despite what
we're hearing about the web doing away with the printed material as we know it, it
seems that we handle more paper not less of it in our
networked world. After all, many people curl up in bed with a novel or a report
for work. I don't see that custom being altered unless someone comes up with a
comfortable way to use a computer in bed!
Obviously, if writing/word processing is so important and printing is the
logical next step after writing, then getting your printer up and running under
Linux is going to be a priority. Luckily, Linux has changed a great deal and
hardware manufacturers got the idea quick that it didn't matter what
OS people used their printers with, it was just important that they used
them. That means that all of the major distributions offer first rate tools to
get practically any printer running under Linux.
What you're doing when you print under Linux
Historically, printing in the Unix platforms started off as just sending
plain text to a line printer, (resulting in rather plain looking text on paper with holes on
each side - some of you might remember this). The basic means of printing in Linux just
takes off from there. When you first set up your Linux machine to use a
printer, you'll be configuring the lpr or "line printer". The lpr
works with the lpd or "line printer daemon" running on your system.
. A "daemon" is just a program that works in the background, without
your direct intervention. This daemon just waits there for printing jobs to be
sent to it, which it will then send to the lpq or "line printer
queue". The queue (queue the British word for what Americans call a
"waiting line") just puts your print job on hold until the system figures out
the way to print it. This holding pattern is usually pretty quick - maybe a
couple of seconds - because computers work pretty fast, generally.
As I mentioned, printing used to consist of just sending
rather boring looking output to a line printer. Today's computing needs in
terms of printing are much more demanding. Exotic fonts, graphics
and other visual goodies can be found in standard printed material that comes
from a computer. Your Linux machine should be capable of printing anything you
want as long as you have the correct filters. For example, if you
downloaded a report from the Save the Whales Foundation on the mating habits of
the pilot whale in PDF format and you wanted to print it, you'll need some
filters installed that know how to print PDF files. All mainstream Linux
distributions come with Ghostscript. This is a free
implementation of Adobe's Postscript filters. These filters are
used to make sure that "What you see is what you get", to use a hackneyed expression.
How to print
If you want to print, you should push the "print" option in the menu. OK,
you know that already. But how do we get from the point where you've got Linux
installed to where you can print something with your word processor? Here are
the steps.
1. Install a printer
Most Linux distributions come with tools that will get you printing in no
time. As I mentioned before that Linux's printing system is based on basic line
printing, you'll need a working "printcap" file (to be found in /etc/printcap,
usually) that tells your system what printer it's supposed to work with. With
SuSE you can use YAST to create this file (which will invoke a program
called 'apsfilter'. Red Hat comes with "printtool", Mandrake has its printer
setup tool in its main configuration package. Debian and Slackware both use the
'apsfilter' tool as well.
This lesson is not meant by any means to be the definitive list on products from every vendor,
so if your particular distribution isn't listed here, you'll have to consult
the documentation in your case.
For example, the /etc/printcap file that SuSE configured for my main machine
at home is this:
printer1-ascii|lp1|y2prn_printer1.upp--ascii-printer1|y2prn_printer1.upp ascii:\
:lp=/dev/lp0:\
:sd=/var/spool/lpd/y2prn_printer1.upp--ascii-printer1:\
:lf=/var/spool/lpd/y2prn_printer1.upp--ascii-printer1/log:\
:af=/var/spool/lpd/y2prn_printer1.upp--ascii-printer1/acct:\
:if=/var/lib/apsfilter/bin/y2prn_printer1.upp--ascii-printer1:\
:la@:mx#0:\
:tr=:cl:sh:
#
printer1|lp2|y2prn_printer1.upp--auto-printer1|y2prn_printer1.upp auto:\
:lp=/dev/lp0:\
:sd=/var/spool/lpd/y2prn_printer1.upp--auto-printer1:\
:lf=/var/spool/lpd/y2prn_printer1.upp--auto-printer1/log:\
:af=/var/spool/lpd/y2prn_printer1.upp--auto-printer1/acct:\
:if=/var/lib/apsfilter/bin/y2prn_printer1.upp--auto-printer1:\
:la@:mx#0:\
:tr=:cl:sh:
#
printer1-raw|lp3|y2prn_printer1.upp--raw-printer1|y2prn_printer1.upp raw:\
:lp=/dev/lp0:\
:sd=/var/spool/lpd/y2prn_printer1.upp--raw-printer1:\
:lf=/var/spool/lpd/y2prn_printer1.upp--raw-printer1/log:\
:af=/var/spool/lpd/y2prn_printer1.upp--raw-printer1/acct:\
:if=/var/lib/apsfilter/bin/y2prn_printer1.upp--raw-printer1:\
:la@:mx#0:\
:tr=:cl:sh:
2. Install the Ghostscript package and other useful filters
Most major distributions always recommend the Ghostscript package by default, so it goes
on your system with a standard install. This will take care of your more
advanced formatting needs. Other ones, like the jpeg libraries and other image
formatting libraries are also installed by default so you can print your image
files easily and painlessly.
3. Turn on the printer and press the print button
I sometimes forget to turn on the printer, so that's why I included this last
part.
Some useful trouble shooting techniques
Most printers work from a parallel port. You must have parallel port support
enabled in your kernel. Most major Linux distributions will install a generic
kernel with this enabled. Printing therefore shouldn't be a problem. However,
most people at some stage of the game prefer to compile and install their own
custom Linux kernel. When you get up to speed on Linux and you decided to do
this, always remember to include parallel port support into your new kernel. I
have forgotten to do this (which ironically seems to happen with much more
frequency as I get familiar with compiling kernels) only to find that I can't
print anything when I've finished installing my new kernel.
I have also noticed my system choke on stuff sent to it from Corel
WordPerfect. I won't go into the "hows" and "whys" (because I honestly don't
know why or how this happens) but I have fell victim to an inability to print
from WordPerfect on occasion. What I usually do is see if in fact I have
pressed the button 'print' and something is waiting to be printed.
To see if you have something waiting in the printer queue, just issue the command:
lpq
This will show you what's in the printer queue or if there is in fact
anything there. Output generally looks something like this, if you have a
problem (like my printer being unplugged, in this case).
waiting for printer1 to become ready (offline ?)
Rank Owner Job Files Total Size
1st bob 46 grocery_list.txt 667 bytes
2nd bob 47 lyrics_to_sinatra_my_way.txt 2323 bytes
For example, if I wanted to just get rid of these files, shut WordPerfect
down and start it up again and try printing again (which usually works for me),
I would just issue the command:
lprm
Which removes the whole line printer queue. I could also be
selective about it and only delete one of the print jobs by typing the
command:
lprm 47
Alas, my debut in the karaoke bar will have to wait, but I can still do the
shopping. Hopefully you won't need to use these troubleshooting techniques very
often, but they're good to know just in case.
Enjoy printing under Linux!
[Next]
|