⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 0237-0240.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:




<HTML>

<HEAD>

<TITLE>Sams Teach Yourself Linux in 24 Hours:Preparing Documents:EarthWeb Inc.-</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=0672311623 //-->

<!-- TITLE=Sams Teach Yourself Linux in 24 Hours//-->

<!-- AUTHOR=Bill Ball//-->

<!-- PUBLISHER=Macmillan Computer Publishing//-->

<!-- IMPRINT=Sams//-->

<!-- CHAPTER=15 //-->

<!-- PAGES=0229-0242 //-->

<!-- UNASSIGNED1 //-->

<!-- UNASSIGNED2 //-->







<P><CENTER>

<a href="0233-0236.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0241-0242.html">Next</A>

</CENTER></P>



<A NAME="PAGENUM-237"><P>Page 237</P></A>





<TABLE BGCOLOR=#FFFF99><TR><TD>JUST A MINUTE</TD></TR><TR><TD>

<BLOCKQUOTE>

There are many different macros and macro sets included with the

TeX formatting system. Covering the details of complex formatting is beyond

the scope of this book, but you're encouraged to experiment, starting with

simple commands to get a feel for typesetting documents. There are nearly 100

books on using TeX on the market. If you're serious about learning how to use TeX,

a good book is indispensable.

</BLOCKQUOTE></TD></TR></TABLE>





<H3><A NAME="ch15_ 8">

Printing Text Documents

</A></H3>



<P>After you've finished formatting your text files, using either a series of filters or

inserted typesetting commands, you'll want to print your file to produce a typeset document.

In order to control the printing of your documents, you need to understand how Linux

handles printing, and how to start, stop, cancel, or control the printing process.

</P>



<P>There are several printing commands you'll use to control the printing process on

your system. This section first shows you how your printer is described under Linux, and

where the important printer files are located.

</P>



<P>Printers are known as character mode devices, and are listed under the

/dev directory. Look at the following example:

</P>



<!-- CODE SNIP //-->

<PRE>

# ls /dev/lp*

/dev/lp0 /dev/lp1 /dev/lp2

</PRE>

<!-- END CODE SNIP //-->



<P>This shows the three parallel printer devices installed on your system by default.

Chances are good that you have a parallel printer attached to your computer, so this

hour's discussion is limited to parallel printers. Once set up, you'll find little difference

between how parallel and serial printers are handled by Linux.

</P>



<TABLE BGCOLOR=#FFFF99><TR><TD>TIME SAVER</TD></TR><TR><TD>

<BLOCKQUOTE>

Serial printers are serial devices, and have names such as /dev/ttySX, where X

is a number from 0 to 3, similar to your modem ports. Read the

setserial command's manual page to learn how to set your serial port to the fastest baud rate

your printer supports.

</BLOCKQUOTE></TD></TR></TABLE>





<P>To determine if your printer is working, first make sure your printer is plugged in,

attached to your computer's parallel port, and turned on. Then try sending a directory listing to

your printer with the following:

</P>



<!-- CODE SNIP //-->

<PRE>

# ls &gt;/dev/lp1

</PRE>

<!-- END CODE SNIP //-->





<A NAME="PAGENUM-238"><P>Page 238</P></A>





<P>If you've specified the right printer device, your printer should activate and print

the current directory list. If nothing happens, try the following:

</P>



<!-- CODE SNIP //-->

<PRE>

# cat /proc/devices

</PRE>

<!-- END CODE SNIP //-->



<P>to see if the printer device driver was 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

127 pcmcia



Block devices:

 1 ramdisk

 2 fd

 3 ide0

 9 md

22 ide1

</PRE>

<!-- END CODE //-->



<P>If you don't see an lp device listed, make sure that parallel printing is either compiled

into your kernel, or installed using the lp.o module, located under the

/lib/modules/2.0.31/misc directory (see Hour 1, &quot;Preparing to Install Linux,&quot; for kernel configuration details).

</P>



<H4><A NAME="ch15_ 9">

Printing Documents with the lpr Printing System

</A></H4>



<P>If you've installed a printer during the initial Linux installation process, you'll find

your printer defined in the /etc/printcap file. This file is an ASCII database of your system's

local and networked printers, and describes the capabilities of each printer.

</P>





<P>You can have different entries for your printer to handle color or

black-and-white documents, or different paper sizes. Look at the following example:

</P>



<!-- CODE //-->

<PRE>

##PRINTTOOL3## LOCAL cdj500 300x300 letter {} DeskJet500 1 1

lp:\

    :sd=/var/spool/lpd/lp:\

    :mx#0:\

    :sh:\

    :lp=/dev/lp1:\

    :if=/var/spool/lpd/lp/filter:

##PRINTTOOL3## LOCAL cdj500 300x300 letter {} DeskJet500 3 1

lpcolor:\

    :sd=/var/spool/lpd/lp0:\

    :mx#0:\

    :sh:\

    :lp=/dev/lp1:\



    :if=/var/spool/lpd/lp0/filter:

##PRINTTOOL3## LOCAL cdj500 300x300 letter {} DeskJet500 8 1

lpgray:\

    :sd=/var/spool/lpd/lp0:\

    :mx#0:\

    :sh:\

    :lp=/dev/lp1:\

</PRE>

<!-- END CODE //-->





<A NAME="PAGENUM-239"><P>Page 239</P></A>





<!-- CODE //-->

<PRE>

    :if=/var/spool/lpd/lp0/filter:

##PRINTTOOL3## LOCAL cdj500 300x300 letter {} DeskJet500 24 1

lpcolorbest:\

    :sd=/var/spool/lpd/lp0:\

    :mx#0:\

    :sh:\

    :lp=/dev/lp1:\

    :if=/var/spool/lpd/lp0/filter:

</PRE>

<!-- END CODE //-->



<P>This printcap file contains definitions (created with the

printtool command, discussed in the following section, &quot;Defining Printers with

the printtool Command&quot;) for the lp, lpcolor, lpgray, and lpcolorbest printers, but all describe the same printer. These names are

handy as reminders when you want to print different documents (or if you need to change

print cartridges to use color).

</P>



<P>Linux uses a line printer spooling system. When you first boot, Linux starts lpd, the

line printer daemon. The lpd program runs in the background, waiting for print requests.

You start a print request with the lpr command:

</P>



<!-- CODE SNIP //-->

<PRE>

# lpr mydocument.txt

# lpr myfile.ps

</PRE>

<!-- END CODE SNIP //-->



<P>This command line spools, or sends your documents to a file in the

/var/spool/ directory. You also can use the lpr command as a printing filter to print outgoing streams of formatted text:

</P>



<!-- CODE SNIP //-->

<PRE>

# groff -Tascii -mm myfile.txt | lpr

</PRE>

<!-- END CODE SNIP //-->



<P>This command line sends the output of the groff formatting program through the line

printer spooler. You also can spool multiple files, then track your requests by using the

lpq command. See the following example:

</P>





<!-- CODE //-->

<PRE>

# lpr mes.txt

# lpr test.txt

# lpq

lp is ready and printing

Rank   Owner      Job  Files                                 Total Size

active bball      16   mes.txt                               368 bytes

1st    bball      17   test.txt                              359 bytes

</PRE>

<!-- END CODE //-->



<P>To stop either of these print jobs, use the

lprm command:

</P>



<!-- CODE SNIP //-->

<PRE>

# lprm 17

</PRE>

<!-- END CODE SNIP //-->



<P>This command stops the printing of job 17, the file

test.txt. You also can (as the root operator) disable or enable printers, or reorder jobs with the

lpc command. See the lpc man page for details.

</P>



<A NAME="PAGENUM-240"><P>Page 240</P></A>







<H4><A NAME="ch15_ 10">

Defining Printers with the printtool Command

</A></H4>



<P>Installing, changing, or deleting local printers with your Linux

system is a snap, thanks to the Red Hat printtool program, located under the

/usr/bin directory. This program, used with the X Window System, is a printer setup program you can run from the command

line, or through the X11 control-panel program.

</P>



<P>Because these programs run under X11, you'll have to start X, then, making sure

you're the root operator, type the following in a terminal window:

</P>



<!-- CODE SNIP //-->

<PRE>

# control-panel

</PRE>

<!-- END CODE SNIP //-->



<P>or

</P>



<!-- CODE SNIP //-->

<PRE>

# printtool

</PRE>

<!-- END CODE SNIP //-->



<P>If you run the control-panel program, select the

printtool button. Printtool's main window appears and lists all printers defined in the /etc/printcap database. From here, you can

add, delete, or edit existing printer entries. To add a printer, click the Add button. You'll

be asked to select a local, remote, or LAN manager printer. For the sake of example,

assume that you want to set up a printer attached to your computer. Press the local button,

then click the OK button.

</P>



<P>The printtool program then shows which parallel printer devices have

been detected (see Figure 15.1). Note that one of the devices, /dev/lp0, /dev/lp1, or /dev/lp2, should

be detected. If not, your printer is not on, or printing support hasn't been enabled.

</P>





<P>Figure 15.1.<BR>

The Red Hat printtool <br>

program provides an <br>

easy-to-use interface <br>

when you need to <br>

configure a printer<BR>

for Linux.</P>

<P><a href="javascript:displayWindow('images/ch15fg01.jpg', 288, 216)"><img src="images/tn_ch15fg01.jpg"></a><BR>

</P>



<P><CENTER>

<a href="0233-0236.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0241-0242.html">Next</A>

</CENTER></P>











</td>
</tr>
</table>

<!-- begin footer information -->









</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -