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

📄 ch25.htm

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTM
📖 第 1 页 / 共 3 页
字号:


<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>

 -->






 











 

















<H1></H1>







<UL>



	<LI><A HREF="#Heading1">- 25 -</A>



	<UL>



		<LI><A HREF="#Heading2">Ghostscript</A>



		<UL>



			<LI><A HREF="#Heading3">What Is Ghostscript?</A>



			<LI><A HREF="#Heading4">NOTE</A>



			<UL>



				<LI><A HREF="#Heading5">Ghostscript Information</A>



			</UL>



			<LI><A HREF="#Heading6">Installation</A>



			<LI><A HREF="#Heading7">The Ghostscript Interpreter</A>



			<UL>



				<LI><A HREF="#Heading8">FIGURE 25.1.</A>



				<LI><A HREF="#Heading9">FIGURE 25.2.</A>



				<LI><A HREF="#Heading10">FIGURE 25.3.</A>



				<LI><A HREF="#Heading11">FIGURE 25.4.</A>



			</UL>



			<LI><A HREF="#Heading12">Output Devices</A>



			<LI><A HREF="#Heading13">NOTE</A>



			<LI><A HREF="#Heading14">TIP</A>



			<LI><A HREF="#Heading15">The Screen Blanker</A>



			<LI><A HREF="#Heading16">Sending Output to a File</A>



			<LI><A HREF="#Heading17">Paper Size Configuration</A>



			<LI><A HREF="#Heading18">Environment Variables for Ghostscript</A>



			<LI><A HREF="#Heading19">Configuring for X Window</A>



			<LI><A HREF="#Heading20">Command-Line Arguments</A>



			<LI><A HREF="#Heading21">Using Other Fonts</A>



			<LI><A HREF="#Heading22">Getting More Help</A>



			<LI><A HREF="#Heading23">Comments on Output</A>



			<LI><A HREF="#Heading24">Summary</A>



		</UL>



	</UL>



</UL>







<P>



<HR SIZE="4">







<H2 ALIGN="CENTER"><A NAME="Heading1<FONT COLOR="#000077">- 25 -</FONT></H2>



<H2 ALIGN="CENTER"><A NAME="Heading2<FONT COLOR="#000077">Ghostscript</FONT></H2>



<P><I>by Kamran Husain</I></P>



<P>IN THIS CHAPTER</P>







<UL>



	<LI>What Is Ghostscript?



	<P>



	<LI>Installation



	<P>



	<LI>The Ghostscript Interpreter



	<P>



	<LI>Output Devices



	<P>



	<LI>The Screen Blanker



	<P>



	<LI>Sending Output to a File



	<P>



	<LI>Paper Size Configuration



	<P>



	<LI>Environment Variables for Ghostscript



	<P>



	<LI>Configuring for X Window



	<P>



	<LI>Command-Line Arguments



	<P>



	<LI>Using Other Fonts



	<P>



	<LI>Getting More Help



	<P>



	<LI>Comments on Output



</UL>







<P><BR>



This chapter covers the installation and use of Ghostscript, a PostScript interpreter.



Almost all the documentation that is related to Linux is in PostScript. If you have



a PostScript printer, you simply send the file to the printer for a hardcopy.



<H3 ALIGN="CENTER"><A NAME="Heading3<FONT COLOR="#000077">What Is Ghostscript?</FONT></H3>



<P>Ghostscript is actually a set of programs. Collectively, these programs provide



two important features:







<UL>



	<LI>An interpreter for the PostScript language



	<P>



	<LI>A library to display PostScript images



</UL>











<DL>



	<DT></DT>



</DL>











<DL>



	<DD>



<HR>



<A NAME="Heading4<FONT COLOR="#000077"><B>NOTE:</B> </FONT>PostScript is a



	trademark of Adobe Systems, Incorporated. 



<HR>







</DL>







<P>Ghostscript has been ported to several platforms from PCs, OS/2, Apple Macintoshes,



and Ataris to various flavors of UNIX, for example, Sun workstations and IBM AIX



machines. If you support X11, you will probably be able to run Ghostscript. Now you



have it on your Linux machine!</P>



<P>Several executable and font files come with Ghostscript. Some of the executables



are also used by other packages under Linux. For example, HylaFAX (Chapter 64, &quot;<TT>HylaFAX</TT>&quot;)



uses the main Ghostscript program, gs, as its default viewer. In short, if you use



Linux, you will find a need for Ghostscript.



<H4 ALIGN="CENTER"><A NAME="Heading5<FONT COLOR="#000077">Ghostscript Information</FONT></H4>



<P>The Ghostscript package that you get with Linux is from Aladdin Enterprises. The



information about Ghostscript is best summarized in its <TT>README</TT> file: &quot;L.



Peter Deutsch, president of Aladdin Enterprises, was the original creator, and is



the primary developer and maintainer, of Ghostscript. Aladdin Enterprises owns the



copyright on Ghostscript; Ghostscript is distributed with the GNU General Public



License, and is also available for commercial licensing.&quot; Here is the primary



contact for getting information about Ghostscript: <BR>



<BR>



<I>Aladdin Enterprises</I></P>



<P><I>P.O. Box 60264 <BR>



<BR>



Palo Alto, CA 94306</I>



<H3 ALIGN="CENTER"><A NAME="Heading6<FONT COLOR="#000077">Installation</FONT></H3>



<P>To run Ghostscript, you need the executable program and some external initialization



files:</P>



<PRE><FONT COLOR="#0066FF">/usr/lib/ghostscript/bdftops.ps



/usr/lib/ghostscript/decrypt.ps



/usr/lib/ghostscript/font2c.ps



/usr/lib/ghostscript/gs_dbt_e.ps



/usr/lib/ghostscript/gs_dps1.ps



/usr/lib/ghostscript/gs_fonts.ps



/usr/lib/ghostscript/gs_init.ps



/usr/lib/ghostscript/gs_lev2.ps



/usr/lib/ghostscript/gs_statd.ps



/usr/lib/ghostscript/gs_sym_e.ps



/usr/lib/ghostscript/gs_type0.ps



/usr/lib/ghostscript/gslp.ps



/usr/lib/ghostscript/impath.ps



/usr/lib/ghostscript/landscap.ps



/usr/lib/ghostscript/level1.ps



/usr/lib/ghostscript/prfont.ps



/usr/lib/ghostscript/ps2ascii.ps



/usr/lib/ghostscript/ps2epsi.ps



/usr/lib/ghostscript/ps2image.ps



/usr/lib/ghostscript/pstoppm.ps



/usr/lib/ghostscript/quit.ps



/usr/lib/ghostscript/showpage.ps



/usr/lib/ghostscript/type1ops.ps



/usr/lib/ghostscript/wrfont.ps



/usr/lib/ghostscript/uglyr.gsf



/usr/lib/ghostscript/Fontmap



</FONT></PRE>



<P>The Ghostscript file set includes a set of fonts (<TT>.gsf</TT> files). The fonts



for Ghostscript are stored in <TT>/usr/lib/ghostscript/fonts</TT>. You should have



them on your disk if you chose to install Ghostscript when you installed Linux. The



name of the executable is <TT>gs</TT>.</P>



<P>You can build Ghostscript on your machine if you get a later version than what



you have. The versions have not changed in a while, so the files on the CD-ROM will



most likely be the ones you want to work with. The makefiles that come with the sources



install all the files and directories under your <TT>/usr/local</TT> directory.



<H3 ALIGN="CENTER"><A NAME="Heading7<FONT COLOR="#000077">The Ghostscript Interpreter</FONT></H3>



<P>The Ghostscript interpreter is the <TT>gs</TT> command in <TT>/usr/bin/gs</TT>.



This is an interactive interpreter that also reads in files for its input. To invoke



the gs interpreter, use this command:</P>



<PRE><FONT COLOR="#0066FF">gs [filename1] ... [filenameN]



</FONT></PRE>



<P>Each file should contain PostScript data. The interpreter reads in the files in



sequence and interprets them as PostScript files. The gs interpreter continues to



read files from the input after the files have been read, so you can issue more PostScript



commands directly if you want to.</P>



<P>To stop the interpretation, just type <TT>quit</TT> and press Enter. The interpreter



also exits gracefully if it encounters end-of-file (Ctrl-D) or the interrupt character



(Ctrl-C).</P>



<P>See Figure 25.1 for the input to the interpreter. (Your version number might be



different than that shown in the figure.) The output is shown in a separate window,



as shown in Figure 25.2. The file we are viewing in this example is the PostScript



output from a C program that generates images in 3D. I wrote this program to generate



3D images and plots of some devices via a program that talked directly to a PostScript



printer. Rather than waste paper, I used gs to view the intermediate results. My



file was called <TT>samp1.ps</TT>. This is the command I used:</P>



<PRE><FONT COLOR="#0066FF">$ gs samp1.ps



</FONT></PRE>



<H6><FONT COLOR="#0066FF"></FONT></H6>



<P><A NAME="Heading8<A HREF="../art/25/25lnx01.jpg"><FONT COLOR="#000077">FIGURE



25.1.</FONT></A><FONT COLOR="#000077"> </FONT><I>The gs interpreter. </I><BR>



<BR>



The way Ghostscript's interpreter, gs, works is that it reads and interprets PostScript



files. The resulting image data is sent to an output device. In the general case,



the output is sent to your display area. You are not, however, limited to just one



output device because Ghostscript can be built with support of output to multiple



output devices. Ghostscript normally opens the first listed device and directs all



output to it.</P>



<P>If you type <TT>gs</TT> without a filename, you are placed directly into the interactive



interpreter. All the commands you type in the interpreter are acted on immediately



by gs and are rendered in the display window. You will rarely use this option unless



you want to override something like a device setting within a program.</P>



<P>A sister program, called ghostview, comes with Ghostscript. With ghostview you



can look at PostScript files.



<H6></H6>



<P><A NAME="Heading9<A HREF="../art/25/25lnx02.jpg"><FONT COLOR="#000077">FIGURE



25.2.</FONT></A><FONT COLOR="#000077"> </FONT><I>The output from the gs interpreter.



<BR>



</I><BR>



Ghostview was written by, and is copyrighted by, Tim Theisen. The <TT>ghostview</TT>



command shows PostScript documents using Ghostscript. Use the following command line



to view a text file:</P>



<PRE><FONT COLOR="#0066FF">$ ghostview [filename]



</FONT></PRE>



<P>The ghostview program creates an X window, opens the file, and displays it. Ghostview



reads from <TT>stdin</TT> if the filename is <TT>-</TT>. Ghostview has a bewildering

⌨️ 快捷键说明

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