old-www/HOWTO/Printing-Usage-HOWTO-3.html

188 lines
5.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
<TITLE>The Linux Printing Usage HOWTO: Printing files</TITLE>
<LINK HREF="Printing-Usage-HOWTO-4.html" REL=next>
<LINK HREF="Printing-Usage-HOWTO-2.html" REL=previous>
<LINK HREF="Printing-Usage-HOWTO.html#toc3" REL=contents>
</HEAD>
<BODY>
<A HREF="Printing-Usage-HOWTO-4.html">Next</A>
<A HREF="Printing-Usage-HOWTO-2.html">Previous</A>
<A HREF="Printing-Usage-HOWTO.html#toc3">Contents</A>
<HR>
<H2><A NAME="s3">3. Printing files</A></H2>
<P>
<!--
printing!by file type
-->
This section covers printing the kinda of files that you'll run across in a
Linux setup.
<P>
<H2><A NAME="ss3.1">3.1 Printing graphics files</A>
</H2>
<P>
<!--
printing!graphics files
-->
Printing graphics files through a printer usually depends on the kind of
graphics you're converting, and the kind of printer you want to send to. Dot
matrix is usually out of the question due to differences in the way
dot-matrix handles graphics. Your best bet in this situation is to see if
your printer is compatable with an Epson or an IBM ProPrinter, then convert
the graphics file to PostScript, then use Ghostscript (see next section) to
print the graphics.
<P>If you have a laser printer, things are a bit easier since many are
compatable with PCL. This now gives you a few options. Some programs may
output directly in PCL. If not, programs like <EM>NetPBM</EM> can convert
into PCL. Last option is to use ghostscript (see next section).
<P>Your absolutely best option is to install packages like NetPBM and Ghostscript
then installing a magic filter to process the graphics files automagically.
<P>
<H2><A NAME="ss3.2">3.2 Printing PostScript files</A>
</H2>
<P>
<!--
printing!Postscript files
-->
<!--
Postscript!printing
-->
Printing PostScript files on a printer that has a PostScript interpreter
is simple; just use <EM>lpr</EM>, and the printer will take care of all
of the details for you. For those of us that don't have printers with
PostScript capabilities, we have to resort to other means. Luckily, there
are programs available that can make sense of PostScript, and translate
it into a language that most printers will understand. Probably the most
well known of these programs is Ghostscript.
<P>Ghostscript's responsibility is to convert all of the descriptions in a
PostScript file to commands that the printer will understand. To print
a PostScript file using Ghostscript, you might do something like
<P>
<BLOCKQUOTE><CODE>
<PRE>
$ gs -dSAFER -dNOPAUSE -sDEVICE=deskjet -sOutputFile=\|lpr thesis.ps
</PRE>
</CODE></BLOCKQUOTE>
<P>Notice in the above example that we are actually piping the output of
Ghostscript to the <EM>lpr</EM> command by using the -<B>sOutputFile</B>
option.
<P>Ghostview is an interface to Ghostscript for the X Window System. It allows
you to preview a PostScript file before you print it. Ghostview and
Ghostscript can both be swiped from
<A HREF="ftp://prep.ai.mit.edu/pub/gnu/">ftp://prep.ai.mit.edu/pub/gnu/</A>.
<P>
<H2><A NAME="ss3.3">3.3 Printing PDF files</A>
</H2>
<P>
<!--
printing!PDF files
-->
<!--
printing!Acrobat files
-->
<!--
PDF files!printing
-->
<!--
Acrobat files!printing
-->
Adobe has released an Acrobat reader for Linux, and it's available on the
Adobe home page
<A HREF="http://www.adobe.com">http://www.adobe.com</A>. Its predecessor, xpdf, is
also available. Both should print to a postscript device.
<P>
<H2><A NAME="ss3.4">3.4 Printing TeX files</A>
</H2>
<P>
<!--
printing!TeX files
-->
<!--
TeX files!printing
-->
One of the easiest ways to print TeX files is to convert them to PostScript
and then print them using Ghostscript. To do this, you first need to
convert them from TeX to a format known as DVI (which stands for
device-independent). You can do this with the <EM>tex</EM>(1) command. Then
you need to convert the DVI file to a PostScript file using <EM>dvips</EM>.
All of this would look like the following when typed in.
<P>
<BLOCKQUOTE><CODE>
<PRE>
$ tex thesis.tex
$ dvips thesis.dvi
</PRE>
</CODE></BLOCKQUOTE>
<P>Now you are ready to print the resulting PostScript file as described above.
<P>
<H2><A NAME="ss3.5">3.5 Printing <CODE>troff</CODE> formatted files</A>
</H2>
<P>
<!--
printing!troff files
-->
<!--
troff files!printing
-->
<P>
<BLOCKQUOTE><CODE>
<PRE>
$ groff -Tascii thesis.tr | lpr
</PRE>
</CODE></BLOCKQUOTE>
<P>or, if you prefer,
<P>
<BLOCKQUOTE><CODE>
<PRE>
$ groff thesis.tr > thesis.ps
</PRE>
</CODE></BLOCKQUOTE>
<P>and then print the PostScript file as described above.
<P>
<H2><A NAME="ss3.6">3.6 Printing <CODE>man</CODE> pages</A>
</H2>
<P>
<!--
printing!man pages
-->
<!--
man pages!printing
-->
<P>
<BLOCKQUOTE><CODE>
<PRE>
$ man man | col -b | lpr
</PRE>
</CODE></BLOCKQUOTE>
<P>The man pages contain pre-formatted <CODE>troff</CODE> data, so we have to strip
out any highlighting, underlines, etc. The 'col' program does this just
nicely, and since we're piping data, the <CODE>man</CODE> program won`t use
<CODE>more</CODE>.
<HR>
<A HREF="Printing-Usage-HOWTO-4.html">Next</A>
<A HREF="Printing-Usage-HOWTO-2.html">Previous</A>
<A HREF="Printing-Usage-HOWTO.html#toc3">Contents</A>
</BODY>
</HTML>