?? 426-430.html
字號:
<HTML>
<HEAD>
<TITLE>Linux Unleashed, Third Edition:Ghostscript and Ghostview</TITLE>
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!--ISBN=0672313723//-->
<!--TITLE=Linux Unleashed, Third Edition//-->
<!--AUTHOR=Tim Parker//-->
<!--PUBLISHER=Macmillan Computer Publishing//-->
<!--IMPRINT=Sams//-->
<!--CHAPTER=24//-->
<!--PAGES=426-430//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="423-426.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="430-432.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H4 ALIGN="LEFT"><A NAME="Heading3"></A><FONT COLOR="#000077">Using Ghostscript</FONT></H4>
<P>The primary program in the Ghostscript set is <TT>gs</TT>, which is the Ghostscript interpreter. The <TT>gs</TT> utility reads in any files you tell it to and interprets them for you, displaying a properly formatted document in an X window. Running <TT>gs</TT> from a character terminal doesn’t accomplish much since a graphics window is required to show the results of its operation.</P>
<P>To display one or more files in X windows with Ghostscript, issue the following command, where <TT>file1.ps</TT> is the filename (with <TT>.ps</TT> extension, usually, to show it’s a PostScript format file):</P>
<!-- CODE SNIP //-->
<PRE>
gs file1.ps …
</PRE>
<!-- END CODE SNIP //-->
<P>You can specify more than one filename, and each file is displayed in sequence. When you issue the <TT>gs</TT> command you’ll see a message such as “Initializing…” and a bunch of messages from the Ghostscript interpreter, and then a window will open with the contents of the file displayed. The exact messages and appearance of the X window differ depending on your version of Ghostscript. Figure 24.2 shows the output in an Xterm when you issue the <TT>gs</TT> command, and Figure 24.3 shows the window that Ghostscript displays with the contents of the selected file formatted properly.</P>
<P><A NAME="Fig2"></A><A HREF="javascript:displayWindow('images/24-02.jpg',751,388 )"><IMG SRC="images/24-02t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/24-02.jpg',751,388)"><FONT COLOR="#000077"><B>Figure 24.2.</B></FONT></A> When you issue a <TT>gs</TT> command Ghostscript displays status messages.
</P>
<P><A NAME="Fig3"></A><A HREF="javascript:displayWindow('images/24-03.jpg',804,843 )"><IMG SRC="images/24-03t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/24-03.jpg',804,843)"><FONT COLOR="#000077"><B>Figure 24.3.</B></FONT></A> Ghostscript displays PostScript files in a window for you to view directly.</P>
<P>If you want to suppress all the messages Ghostscript generates (shown in Figure 24.2), use the <TT>-q</TT> (quiet) option, which suppresses all but major messages.</P>
<P>You can get help about the <TT>gs</TT> command through the man pages, which are often difficult to read, or from the command line by using either the <TT>-h</TT> or the <TT>-?</TT> option. When you use either option (both display the same screen output) you will see all the available options and command usage for the <TT>gs</TT> command. Since the output of the help screens take up more than one page, you should pipe the output to the <TT>more</TT> command, like this:</P>
<!-- CODE SNIP //-->
<PRE>
gs -h | more
</PRE>
<!-- END CODE SNIP //-->
<P>You’ll see a screen like that in Figure 24.4. To move to the next page of help, press the space key. To quit the more utility, use the <TT>q</TT> command or Ctrl+C.</P>
<P><A NAME="Fig4"></A><A HREF="javascript:displayWindow('images/24-04.jpg',654,398 )"><IMG SRC="images/24-04t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/24-04.jpg',654,398)"><FONT COLOR="#000077"><B>Figure 24.4.</B></FONT></A> Using the <TT>more</TT> command to display the help screen for the <TT>gs</TT> command.
</P>
<P><FONT SIZE="+1"><B>Configuring Ghostscript for X</B></FONT></P>
<P>Some versions of Linux come with the X system premodified to handle Ghostscript output, but most do not. Ghostscript uses a set of X resources that are usually stored under the program name ghostscript and class name Ghostscript in the <TT>.Xdefaults</TT> file. Your <TT>.Xdefaults</TT> file should have three entries at a minimum in it, like this:</P>
<CENTER>
<TABLE WIDTH="90%"><TR>
<TD WIDTH="40%" ALIGN="LEFT">Ghostscript*geometry:
<TD WIDTH="60%" ALIGN="LEFT">-0+0
<TR>
<TD>Ghostscript*xResolution:
<TD>72
<TR>
<TD>Ghostscript*yResolution:
<TD>72
</TABLE>
</CENTER>
<P>If these entries are missing from your <TT>.Xdefaults</TT> file, enter them using an editor and reload the defaults either by restarting the server or by issuing the following command, assuming you are in your home directory:</P>
<!-- CODE SNIP //-->
<PRE>
xrdb -merge ./.Xdefaults
</PRE>
<!-- END CODE SNIP //-->
<P>If not, specify the path to your <TT>.Xdefaults</TT> file.</P>
<P>Ghostscript can make use of a number of resources in the <TT>.Xdefaults</TT> file, although most are of little use to you since defaults work just fine. The resources you can set in Ghostscript are shown in Table 24.1.</P>
<TABLE WIDTH="100%"><CAPTION ALIGN=LEFT><B>Table 24.1.</B> X resources supported by Ghostscript.
<TR>
<TH COLSPAN="3"><HR>
<TR>
<TH WIDTH="35%" ALIGN="LEFT">Resource name
<TH WIDTH="35%" ALIGN="LEFT">Class of resource
<TH WIDTH="30%" ALIGN="LEFT">Default value
<TR>
<TH COLSPAN="3"><HR>
<TR>
<TD>background
<TD>Background
<TD>white
<TR>
<TD>foreground
<TD>Foreground
<TD>black
<TR>
<TD>borderColor
<TD>BorderColor
<TD>black
<TR>
<TD>borderWidth
<TD>BorderWidth
<TD>1
<TR>
<TD>geometry
<TD>Geometry
<TD>NULL
<TR>
<TD>xResolution
<TD>Resolution
<TD>calculated
<TR>
<TD>yResolution
<TD>Resolution
<TD>calculated
<TR>
<TD>useExternalFonts
<TD>UseExternalFonts
<TD>true
<TR>
<TD>useScalableFonts
<TD>UseScalableFonts
<TD>true
<TR>
<TD>logExternalFonts
<TD>LogExternalFonts
<TD>false
<TR>
<TD>externalFontTolerance
<TD>ExternalFontTolerance
<TD>10.0
<TR>
<TD>palette
<TD>Palette
<TD>Color
<TR>
<TD>maxGrayRamp
<TD>MaxGrayRamp
<TD>128
<TR>
<TD>maxRGBRamp
<TD>MaxRGBRamp
<TD>5
<TR>
<TD>useBackingPixmap
<TD>UseBackingPixmap
<TD>true
<TR>
<TD>useXPutImage
<TD>UseXPutImage
<TD>true
<TR>
<TD>useXSetTile
<TD>UseXSetTile
<TD>true
<TR>
<TD>regularFonts
<TD>RegularFonts
<TD>none
<TR>
<TD>symbolFonts
<TD>SymbolFonts
<TD>none
<TR>
<TD>dingbatFonts
<TD>DingbatFonts
<TD>none
<TR>
<TD COLSPAN="3"><HR>
</TABLE>
<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="423-426.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="430-432.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -