701 lines
12 KiB
HTML
701 lines
12 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<HTML
|
|
><HEAD
|
|
><TITLE
|
|
>Printing files</TITLE
|
|
><META
|
|
NAME="GENERATOR"
|
|
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
|
|
REL="HOME"
|
|
TITLE="Introduction to Linux"
|
|
HREF="index.html"><LINK
|
|
REL="UP"
|
|
TITLE="Printers and printing"
|
|
HREF="chap_08.html"><LINK
|
|
REL="PREVIOUS"
|
|
TITLE="Printers and printing"
|
|
HREF="chap_08.html"><LINK
|
|
REL="NEXT"
|
|
TITLE="The server side"
|
|
HREF="sect_08_02.html"></HEAD
|
|
><BODY
|
|
CLASS="sect1"
|
|
BGCOLOR="#FFFFFF"
|
|
TEXT="#000000"
|
|
LINK="#0000FF"
|
|
VLINK="#840084"
|
|
ALINK="#0000FF"
|
|
><DIV
|
|
CLASS="NAVHEADER"
|
|
><TABLE
|
|
SUMMARY="Header navigation table"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TH
|
|
COLSPAN="3"
|
|
ALIGN="center"
|
|
>Introduction to Linux: </TH
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="left"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="chap_08.html"
|
|
ACCESSKEY="P"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="80%"
|
|
ALIGN="center"
|
|
VALIGN="bottom"
|
|
>Chapter 8. Printers and printing</TD
|
|
><TD
|
|
WIDTH="10%"
|
|
ALIGN="right"
|
|
VALIGN="bottom"
|
|
><A
|
|
HREF="sect_08_02.html"
|
|
ACCESSKEY="N"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"></DIV
|
|
><DIV
|
|
CLASS="sect1"
|
|
><H1
|
|
CLASS="sect1"
|
|
><A
|
|
NAME="sect_08_01"
|
|
></A
|
|
>8.1. Printing files</H1
|
|
><DIV
|
|
CLASS="sect2"
|
|
><H2
|
|
CLASS="sect2"
|
|
><A
|
|
NAME="sect_08_01_01"
|
|
></A
|
|
>8.1.1. Command line printing</H2
|
|
><DIV
|
|
CLASS="sect3"
|
|
><H3
|
|
CLASS="sect3"
|
|
><A
|
|
NAME="sect_08_01_01_01"
|
|
></A
|
|
>8.1.1.1. Getting the file to the printer</H3
|
|
><P
|
|
>Printing from within an application is very easy, selecting the <SPAN
|
|
CLASS="guimenuitem"
|
|
>Print</SPAN
|
|
> option from the menu.</P
|
|
><P
|
|
>From the command line, use the <B
|
|
CLASS="command"
|
|
>lp</B
|
|
> or <B
|
|
CLASS="command"
|
|
>lpr</B
|
|
> command.</P
|
|
><P
|
|
><B
|
|
CLASS="command"
|
|
>lp <TT
|
|
CLASS="filename"
|
|
>file(s)</TT
|
|
></B
|
|
> </P
|
|
><P
|
|
><B
|
|
CLASS="command"
|
|
>lpr <TT
|
|
CLASS="filename"
|
|
>file(s)</TT
|
|
></B
|
|
> </P
|
|
><P
|
|
>These commands can read from a pipe, so you can print the output of commands using</P
|
|
><P
|
|
><B
|
|
CLASS="command"
|
|
>command | lp</B
|
|
> </P
|
|
><P
|
|
>There are many options available to tune the page layout, the number of copies, the printer that you want to print to if you have more than one available, paper size, one-side or double-sided printing if your printer supports this feature, margins and so on. Read the man pages for a complete overview.</P
|
|
></DIV
|
|
><DIV
|
|
CLASS="sect3"
|
|
><H3
|
|
CLASS="sect3"
|
|
><A
|
|
NAME="sect_08_01_01_02"
|
|
></A
|
|
>8.1.1.2. Status of your print jobs</H3
|
|
><P
|
|
>Once the file is accepted in the print queue, an identification number for the print job is assigned:</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="screen"
|
|
> <TT
|
|
CLASS="prompt"
|
|
>davy:~></TT
|
|
> <B
|
|
CLASS="command"
|
|
>lp /etc/profile</B
|
|
>
|
|
request id is blob-253 (1 file(s))
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>To view (query) the print queue, use the <B
|
|
CLASS="command"
|
|
>lpq</B
|
|
> or <B
|
|
CLASS="command"
|
|
>lpstat</B
|
|
> command. When entered without arguments, it displays the contents of the default print queue.</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="screen"
|
|
> <TT
|
|
CLASS="prompt"
|
|
>davy:~></TT
|
|
> <B
|
|
CLASS="command"
|
|
>lpq</B
|
|
>
|
|
blob is ready and printing
|
|
Rank Owner Job File(s) Total Size
|
|
active davy 253 profile 1024 bytes
|
|
<TT
|
|
CLASS="prompt"
|
|
>davy:~></TT
|
|
> <B
|
|
CLASS="command"
|
|
>lpstat</B
|
|
>
|
|
blob-253 davy 1024 Tue 25 Jul 2006 10:20_01 AM CEST
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
><DIV
|
|
CLASS="sect3"
|
|
><H3
|
|
CLASS="sect3"
|
|
><A
|
|
NAME="sect_08_01_01_03"
|
|
></A
|
|
>8.1.1.3. Status of your printer</H3
|
|
><P
|
|
>Which is the default printer on a system that has access to multiple printers?</P
|
|
><P
|
|
><B
|
|
CLASS="command"
|
|
>lpstat <TT
|
|
CLASS="option"
|
|
>-d</TT
|
|
></B
|
|
> </P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="screen"
|
|
> <TT
|
|
CLASS="prompt"
|
|
>davy:~></TT
|
|
> <B
|
|
CLASS="command"
|
|
>lpstat <TT
|
|
CLASS="option"
|
|
>-d</TT
|
|
></B
|
|
>
|
|
system default destination: blob
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>What is the status of my printer(s)?</P
|
|
><P
|
|
><B
|
|
CLASS="command"
|
|
>lpstat <TT
|
|
CLASS="option"
|
|
>-p</TT
|
|
></B
|
|
> </P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="screen"
|
|
> <TT
|
|
CLASS="prompt"
|
|
>davy:~></TT
|
|
> <B
|
|
CLASS="command"
|
|
>lpstat <TT
|
|
CLASS="option"
|
|
>-p</TT
|
|
></B
|
|
>
|
|
printer blob now printing blob-253. enabled since Jan 01 18:01
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
><DIV
|
|
CLASS="sect3"
|
|
><H3
|
|
CLASS="sect3"
|
|
><A
|
|
NAME="sect_08_01_01_04"
|
|
></A
|
|
>8.1.1.4. Removing jobs from the print queue</H3
|
|
><P
|
|
>If you don't like what you see from the status commands, use <B
|
|
CLASS="command"
|
|
>lprm</B
|
|
> or <B
|
|
CLASS="command"
|
|
>cancel</B
|
|
> to delete jobs.</P
|
|
><TABLE
|
|
BORDER="0"
|
|
BGCOLOR="#E0E0E0"
|
|
WIDTH="100%"
|
|
><TR
|
|
><TD
|
|
><FONT
|
|
COLOR="#000000"
|
|
><PRE
|
|
CLASS="screen"
|
|
> <TT
|
|
CLASS="prompt"
|
|
>davy:~></TT
|
|
> <B
|
|
CLASS="command"
|
|
>lprm <TT
|
|
CLASS="parameter"
|
|
><I
|
|
>253</I
|
|
></TT
|
|
></B
|
|
>
|
|
</PRE
|
|
></FONT
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><P
|
|
>In the graphical environment, you may see a popup window telling you that the job has been canceled.</P
|
|
><P
|
|
>In larger environments, <B
|
|
CLASS="command"
|
|
>lpc</B
|
|
> may be used to control multiple printers. See the <SPAN
|
|
CLASS="application"
|
|
>Info</SPAN
|
|
> or man pages on each command.</P
|
|
><P
|
|
>There are many GUI print tools used as a front-end to <B
|
|
CLASS="command"
|
|
>lp</B
|
|
>, and most graphical applications have a print function that uses <B
|
|
CLASS="command"
|
|
>lp</B
|
|
>. See the built-in Help functions and program specific documentation for more.</P
|
|
><DIV
|
|
CLASS="note"
|
|
><P
|
|
></P
|
|
><TABLE
|
|
CLASS="note"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
><TR
|
|
><TD
|
|
WIDTH="25"
|
|
ALIGN="CENTER"
|
|
VALIGN="TOP"
|
|
><IMG
|
|
SRC="../images/note.gif"
|
|
HSPACE="5"
|
|
ALT="Note"></TD
|
|
><TH
|
|
ALIGN="LEFT"
|
|
VALIGN="CENTER"
|
|
><B
|
|
>Why are there two commands for every task related to printing?</B
|
|
></TH
|
|
></TR
|
|
><TR
|
|
><TD
|
|
> </TD
|
|
><TD
|
|
ALIGN="LEFT"
|
|
VALIGN="TOP"
|
|
><P
|
|
>Printing on UNIX and alikes has a long history. There used to be two rather different approaches: the BSD-style printing and the SystemV-style printing. For compatibility, Linux with CUPS supports the commands from both styles. Also note that <B
|
|
CLASS="command"
|
|
>lp</B
|
|
> does not behave exactly like <B
|
|
CLASS="command"
|
|
>lpr</B
|
|
>, <B
|
|
CLASS="command"
|
|
>lpq</B
|
|
> has somewhat different options than <B
|
|
CLASS="command"
|
|
>lpstat</B
|
|
> and <B
|
|
CLASS="command"
|
|
>lprm</B
|
|
> is almost, but not quite, like <B
|
|
CLASS="command"
|
|
>cancel</B
|
|
>. Which one you use is not important, just pick the commands that you are comfortable with, or that you may know from previous experiences with UNIX-like systems.</P
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></DIV
|
|
></DIV
|
|
><DIV
|
|
CLASS="sect2"
|
|
><H2
|
|
CLASS="sect2"
|
|
><A
|
|
NAME="sect_08_01_02"
|
|
></A
|
|
>8.1.2. Formatting</H2
|
|
><DIV
|
|
CLASS="sect3"
|
|
><H3
|
|
CLASS="sect3"
|
|
><A
|
|
NAME="sect_08_01_02_01"
|
|
></A
|
|
>8.1.2.1. Tools and languages</H3
|
|
><P
|
|
>If we want to get something sensible out of the printer, files should be formatted first. Apart from an abundance of formatting software, Linux comes with the basic UNIX formatting tools and languages.</P
|
|
><P
|
|
>Modern Linux systems support direct printing, without any formatting by the user, of a range of file types: text, PDF, PostScript and several image formats like PNG, JPEG, BMP and GIF.</P
|
|
><P
|
|
>For those file formats that do need formatting, Linux comes with a lot of formatting tools, such as the <B
|
|
CLASS="command"
|
|
>pdf2ps</B
|
|
>, <B
|
|
CLASS="command"
|
|
>fax2ps</B
|
|
> and <B
|
|
CLASS="command"
|
|
>a2ps</B
|
|
> commands, that convert other formats to PostScript. These commands can create files that can then be used on other systems that don't have all the conversion tools installed.</P
|
|
><P
|
|
>Apart from these command line tools there are a lot of graphical word processing programs. Several complete office suites are available, many are free. These do the formatting automatically upon submission of a print job. Just to name a few: <SPAN
|
|
CLASS="application"
|
|
>OpenOffice.org</SPAN
|
|
>, <SPAN
|
|
CLASS="application"
|
|
>KOffice</SPAN
|
|
>, <SPAN
|
|
CLASS="application"
|
|
>AbiWord</SPAN
|
|
>, <SPAN
|
|
CLASS="application"
|
|
>WordPerfect</SPAN
|
|
>, etc.</P
|
|
><P
|
|
>The following are common languages in a printing context:</P
|
|
><P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
><B
|
|
CLASS="command"
|
|
>groff</B
|
|
>: GNU version of the UNIX <B
|
|
CLASS="command"
|
|
>roff</B
|
|
> command. It is a front-end to the groff document formatting system. Normally it runs the <B
|
|
CLASS="command"
|
|
>troff</B
|
|
> command and a post-processor appropriate for the selected device. It allows generation of PostScript files.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
><SPAN
|
|
CLASS="application"
|
|
>TeX</SPAN
|
|
> and the macro package <SPAN
|
|
CLASS="application"
|
|
>LaTeX</SPAN
|
|
>: one of the most widely used markup languages on UNIX systems. Usually invoked as <B
|
|
CLASS="command"
|
|
>tex</B
|
|
>, it formats files and outputs a corresponding device-independent representation of the typeset document.</P
|
|
><P
|
|
>Technical works are <EM
|
|
>still</EM
|
|
> frequently written in <SPAN
|
|
CLASS="application"
|
|
>LaTeX</SPAN
|
|
> because of its support for mathematic formulas, although efforts are being made at <A
|
|
HREF="http://www.w3.org"
|
|
TARGET="_top"
|
|
>W3C</A
|
|
> (the World Wide Web Consortium) to include this feature in other applications.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>SGML and XML: Free parsers are available for UNIX and Linux. XML is the next generation SGML, it forms the basis for DocBook XML, a document system (this book is written in XML, for instance).</P
|
|
></LI
|
|
></UL
|
|
><DIV
|
|
CLASS="tip"
|
|
><P
|
|
></P
|
|
><TABLE
|
|
CLASS="tip"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
><TR
|
|
><TD
|
|
WIDTH="25"
|
|
ALIGN="CENTER"
|
|
VALIGN="TOP"
|
|
><IMG
|
|
SRC="../images/tip.gif"
|
|
HSPACE="5"
|
|
ALT="Tip"></TD
|
|
><TH
|
|
ALIGN="LEFT"
|
|
VALIGN="CENTER"
|
|
><B
|
|
>Printing documentation</B
|
|
></TH
|
|
></TR
|
|
><TR
|
|
><TD
|
|
> </TD
|
|
><TD
|
|
ALIGN="LEFT"
|
|
VALIGN="TOP"
|
|
><P
|
|
>The man pages contain pre-formatted <B
|
|
CLASS="command"
|
|
>troff</B
|
|
> data which has to be formatted before it can roll out of your printer. Printing is done using the <TT
|
|
CLASS="option"
|
|
>-t</TT
|
|
> option to the <B
|
|
CLASS="command"
|
|
>man</B
|
|
> command:</P
|
|
><P
|
|
><B
|
|
CLASS="command"
|
|
>man <TT
|
|
CLASS="option"
|
|
>-t</TT
|
|
> <TT
|
|
CLASS="parameter"
|
|
><I
|
|
>command</I
|
|
></TT
|
|
> > <TT
|
|
CLASS="filename"
|
|
>man-command.ps</TT
|
|
></B
|
|
> </P
|
|
><P
|
|
>Then print the PostScript file. If a default print destination is configured for your system/account, you can just issue the command <B
|
|
CLASS="command"
|
|
>man <TT
|
|
CLASS="option"
|
|
>-t</TT
|
|
> <TT
|
|
CLASS="parameter"
|
|
><I
|
|
>command</I
|
|
></TT
|
|
></B
|
|
> to send the formatted page to the printer directly.</P
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></DIV
|
|
><DIV
|
|
CLASS="sect3"
|
|
><H3
|
|
CLASS="sect3"
|
|
><A
|
|
NAME="sect_08_01_02_02"
|
|
></A
|
|
>8.1.2.2. Previewing formatted files</H3
|
|
><P
|
|
>Anything that you can send to the printer can normally be sent to the screen as well. Depending on the file format, you can use one of these commands:</P
|
|
><P
|
|
></P
|
|
><UL
|
|
><LI
|
|
><P
|
|
>PostScript files: with the <B
|
|
CLASS="command"
|
|
>gv</B
|
|
> (GhostView) command.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>TeX dvi files: with <B
|
|
CLASS="command"
|
|
>xdvi</B
|
|
>, or with <SPAN
|
|
CLASS="application"
|
|
>KDE</SPAN
|
|
>'s <B
|
|
CLASS="command"
|
|
>kdvi</B
|
|
>.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>PDF files: <B
|
|
CLASS="command"
|
|
>xpdf</B
|
|
>, <B
|
|
CLASS="command"
|
|
>kpdf</B
|
|
>, <B
|
|
CLASS="command"
|
|
>gpdf</B
|
|
> or Adobe's viewer, <B
|
|
CLASS="command"
|
|
>acroread</B
|
|
>, which is also available for free but is not free software. Adobe's reader supports PDF 1.6, the others only support PDF versions up to 1.5. The version of a PDF file can be determined using the <B
|
|
CLASS="command"
|
|
>file</B
|
|
> command.</P
|
|
></LI
|
|
><LI
|
|
><P
|
|
>From within applications, such as Firefox or OpenOffice, you can usually select <SPAN
|
|
CLASS="guimenu"
|
|
>Print Preview</SPAN
|
|
> from one of the menus.</P
|
|
></LI
|
|
></UL
|
|
></DIV
|
|
></DIV
|
|
></DIV
|
|
><DIV
|
|
CLASS="NAVFOOTER"
|
|
><HR
|
|
ALIGN="LEFT"
|
|
WIDTH="100%"><TABLE
|
|
SUMMARY="Footer navigation table"
|
|
WIDTH="100%"
|
|
BORDER="0"
|
|
CELLPADDING="0"
|
|
CELLSPACING="0"
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="chap_08.html"
|
|
ACCESSKEY="P"
|
|
>Prev</A
|
|
></TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="index.html"
|
|
ACCESSKEY="H"
|
|
>Home</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="sect_08_02.html"
|
|
ACCESSKEY="N"
|
|
>Next</A
|
|
></TD
|
|
></TR
|
|
><TR
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="left"
|
|
VALIGN="top"
|
|
>Printers and printing</TD
|
|
><TD
|
|
WIDTH="34%"
|
|
ALIGN="center"
|
|
VALIGN="top"
|
|
><A
|
|
HREF="chap_08.html"
|
|
ACCESSKEY="U"
|
|
>Up</A
|
|
></TD
|
|
><TD
|
|
WIDTH="33%"
|
|
ALIGN="right"
|
|
VALIGN="top"
|
|
>The server side</TD
|
|
></TR
|
|
></TABLE
|
|
></DIV
|
|
></BODY
|
|
></HTML
|
|
> |