0229-0232.html
来自「linux-unix130.linux.and.unix.ebooks130 l」· HTML 代码 · 共 433 行
HTML
433 行
<HTML>
<HEAD>
<TITLE>Developer.com - Online Reference Library - 0672311739:RED HAT LINUX 2ND EDITION:Printing with Linux</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!-- ISBN=0672311739 //-->
<!-- TITLE=RED HAT LINUX 2ND EDITION //-->
<!-- AUTHOR=DAVID PITTS ET AL //-->
<!-- PUBLISHER=MACMILLAN //-->
<!-- IMPRINT=SAMS PUBLISHING //-->
<!-- PUBLICATION DATE=1998 //-->
<!-- CHAPTER=12 //-->
<!-- PAGES=0229-0242 //-->
<!-- UNASSIGNED1 //-->
<!-- UNASSIGNED2 //-->
<P><CENTER>
<a href="../ch11/0228-0228.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0233-0235.html">Next</A>
</CENTER></P>
<A NAME="PAGENUM-229"><P>Page 229</P></A>
<H3><A NAME="ch12_ 1">
CHAPTER 12
</A></H3>
<H2>
Printing with Linux
</H2>
<B>by Bill Ball</B>
<H3><A NAME="ch12_ 2">
IN THIS CHAPTER
</A></H3>
<UL>
<LI> Printer Devices
<LI> How Do I Print?
<LI> The RHS Linux Print System Manager
<LI> Linux Printing Commands
<LI> Simple Formatting
<LI> Other Helpful Printer Programs and
Filters
<LI> Some Program Tips
<LI> Other Helpful Programs
<LI> For More Information
</UL>
<A NAME="PAGENUM-230"><P>Page 230</P></A>
<P>This chapter shows you how to use your printer with Linux. A number of programs, files,
and directories are integral to supporting printing under Linux, but you'll find that with little
effort, you'll be able to get to work and print nicely formatted documents or graphics.
</P>
<P>If you can print to your printer from DOS, Windows 95, or Windows NT, don't worry!
You'll be able to print under Linux, and will probably be pleasantly surprised by the additional
printing capabilities you won't find in the commercial operating system installed on your PC.
</P>
<P>As a Red Hat Linux user, you'll be especially pleased because the kind folks in North
Carolina have hidden the ugly and gory details of installing and using a printer, and have made the
process a snap!
</P>
<H3><A NAME="ch12_ 3">
Printer Devices
</A></H3>
<P>Under Linux, each piece of your computer's hardware is abstracted to a device file
(hopefully with an accompanying device driver in the kernel; see Chapter 11, "Filesystems, Disks,
and Other Devices," for more details). Printer devices, traditionally named after line printers,
are character mode devices, and will be found under the
/dev directory. Some of these are shown in Table 12.1.
</P>
<P>Table 12.1. Parallel printer devices.</P>
<TABLE WIDTH="360">
<TR><TD>
<B>Device Name</B>
</TD><TD>
<B>Printer</B>
</TD><TD>
<B>Address</B>
</TD></TR>
<TD><TR>
/dev/lp0
</TD><TD>
First parallel printer
</TD><TD>
0x3bc
</TD></TR>
<TD><TR>
/dev/lp1
</TD><TD>
Second parallel printer
</TD><TD>
0x378
</TD></TR>
<TD><TR>
/dev/lp2
</TD><TD>
Third parallel printer
</TD><TD>
0x278
</TD></TR>
</TABLE>
<P>Serial printers are assigned to serial devices such as
/dev/ttySX, where X is a number from 0 to 3. There are quite a few
tty devices listed in /dev. Generally, if you're going to use a
serial printer, you'll have to use the setserial command to make sure the printer's serial port is
set to the fastest baud rate your printer supports.
</P>
<P>There are some special cases, such as using an old Apple LaserWriter as a serial printer (it
has a Diablo print-wheel emulation mode using the Courier font), when you must define
your own printer or edit an entry in the
/etc/printcap database. Sometimes you can
manipulate the printer to get a higher speed. For example, here's a 10-year-old trick to increase the
serial port speed of the Apple LaserWriter Plus to 19200, by Dale Carstensen, and posted to
the comp.laser-printers newsgroup:
</P>
<!-- CODE //-->
<PRE>
%!
0000 % Server Password
statusdict begin 25 sccbatch 0 ne exch 19200 ne or
{ serverdict begin exitserver} {pop end stop} ifelse
statusdict begin
</PRE>
<!-- END CODE //-->
<A NAME="PAGENUM-231"><P>Page 231</P></A>
<!-- CODE SNIP //-->
<PRE>
25 19200 0 setsccbatch
end % note--next line has an actual CTRL-D
</PRE>
<!-- END CODE SNIP //-->
<P>See Appendix D in the RedBook, Adobe's PostScript language reference
manual, for more information about LaserWriters, or peruse
comp.laser-printers for hints on setting up your
laser printer. Also check the
/usr/lib/ghostscript/doc directory for information about 25
different PostScript printer utilities included in the Ghostscript distribution.
</P>
<P>Most users, however, have a printer attached to the parallel printer port, so I'll concentrate
on /dev/lp.
</P>
<H3><A NAME="ch12_ 4">
How Do I Print?
</A></H3>
<P>First, check to see that your printer is plugged in, turned on, and attached to your
computer's parallel port. Pass-through parallel port cables shouldn't pose a problem, but don't expect
to be able to use your printer while you're using your CD-ROM, QuickCam, SCSI adapter,
or tape, ZIP, or SyQuest drive if attached to a pass-through cable.
</P>
<P>For starters, try a simple
</P>
<!-- CODE SNIP //-->
<PRE>
# ls >/dev/lp1
</PRE>
<!-- END CODE SNIP //-->
<P>Chances are your printer will activate and its print head will move, but when you look at
the printout, you might see a staircase effect, with each word on a separate line, moving across
the page. Don't worry! This is normal, and tells you that you can at least access your printer.
Later in this chapter, you'll find out how to fine-tune your printing.
</P>
<P>If you're unable to print, then try using
</P>
<!-- CODE SNIP //-->
<PRE>
# cat /proc/devices
</PRE>
<!-- END CODE SNIP //-->
<P>to see if the lp device driver loaded or compiled into your kernel. You should see
something like the following:
</P>
<!-- CODE //-->
<PRE>
Character devices:
1 mem
2 pty
3 ttyp
4 ttyp
5 cua
6 lp
7 vcs
10 misc
14 sound
63 pcmcia
Block devices:
1 ramdisk
2 fd
3 ide0
9 md
22 ide1
</PRE>
<!-- END CODE //-->
<A NAME="PAGENUM-232"><P>Page 232</P></A>
<P>You can also try the tunelp command, which sets various parameters to "tune" your
printer port or lets you know if your printer device is using interrupts or polling for printing. Try <BR>
using
</P>
<!-- CODE SNIP //-->
<PRE>
# tunelp /dev/lp1
</PRE>
<!-- END CODE SNIP //-->
<P>and you might see something like the following:
</P>
<!-- CODE SNIP //-->
<PRE>
/dev/lp1 using polling
</PRE>
<!-- END CODE SNIP //-->
<P>Or you can try
</P>
<!-- CODE SNIP //-->
<PRE>
# tunelp /dev/lp1 -s
</PRE>
<!-- END CODE SNIP //-->
<P>and you might see
</P>
<!-- CODE SNIP //-->
<PRE>
/dev/lp1 status is 223, on-line
</PRE>
<!-- END CODE SNIP //-->
<P>If tunelp reports "No such device or address,"
or if you do not find an lp character device, see Chapter 5, "Configuring and Building Kernels."
</P>
<H3><A NAME="ch12_ 5">
The RHS Linux Print System Manager
</A></H3>
<P>If you want to install, modify, or delete a local, remote, or LAN printer, you're going to
love the printtool program. Found in /usr/bin,
printtool is a graphical interface printer setup program you can call up from the command line or through the Red Hat
control-panel program.
</P>
<P>The control-panel and printtool programs run under X, so you'll have to first fire up X
and then type
</P>
<!-- CODE SNIP //-->
<PRE>
# printtool
</PRE>
<!-- END CODE SNIP //-->
<P>from a terminal window. The main printtool dialog will then come up (see Figure 12.1).
First, click the Add button. You'll be asked to select a local, remote, or LAN manager printer.
</P>
<BR>
Figure 12.1.<BR>
The main printtool<BR>
dialog.<BR>
<a href="10rhu01.html"><img src="images/tn_10rhu01_jpg.jpg"></a><BR>
<H4><A NAME="ch12_ 6">
Remote and LAN Printers
</A></H4>
<P>To set up a remote printer, you'll need the following, according to the
printtool program's help information:
</P>
<P><CENTER>
<a href="../ch11/0228-0228.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0233-0235.html">Next</A>
</CENTER></P>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?