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

📄 use.htm

📁 GhostScript的源代码
💻 HTM
📖 第 1 页 / 共 5 页
字号:
	<td><b><tt>ABC1.xyz</tt></b> ... <b><tt>ABC10.xyz</tt></b> ...
<tr valign=top>	<td><b><tt>-sOutputFile=ABC%03d.xyz</tt></b>
	<td>&nbsp;
	<td><b><tt>ABC001.xyz</tt></b> ... <b><tt>ABC010.xyz</tt></b> ...
</table></blockquote>

<h3><a name="Pipe_output"></a>Output to a pipe</h3>

<p>
On Unix systems you can use this switch to send output directly to a pipe.
For example, to pipe the output to <b><tt>lpr</tt></b>, use
the command

<blockquote><b><tt>
	gs -sOutputFile=\|lpr
</tt></b></blockquote>

<p>
You can also send output to standard output for piping in the usual way
supported by the system:

<blockquote>
<b><tt>gs -sOutputFile=- -q |</tt></b> ...
</blockquote>

<p>
(In this case you must also use the <a href="#Quiet"><b><tt>-q</tt></b>
switch</a> to prevent Ghostscript from writing messages to standard output
which become mixed with the intended output stream.)

<h3><a name="Output_to_graphics"></a>Output to graphics file formats</h3>

<p>
File formats like PCX and PBM are also "devices".  When you select a file
format as the "device", you must also specify an output file, for instance

<blockquote><b><tt>
gs -sDEVICE=pcxmono -sOutputFile=xyz.pcx
</tt></b></blockquote>

<p>
Here, as with printable files, you can use "<b><tt>%d</tt></b>"
to specify <a href="#One_page_per_file">one page per output file</a>.

<h2><a name="Paper_size"></a>Choosing paper size</h2>

<p>
Ghostscript is distributed configured to use U.S. letter paper as its
default page size, but it knows about many others, listed by name and size
in the section on <a href="#Paper sizes">paper sizes known to
Ghostscript</a>.  To select one of these as the default paper size for a
single invocation of Ghostscript, you can use the
<b><tt>-sPAPERSIZE=</tt></b> switch, for instance

<blockquote><b><tt>
-sPAPERSIZE=a4<br>
-sPAPERSIZE=legal
</tt></b></blockquote>

<p>
Individual documents can (and often do) specify a paper size, which takes
precedence over the default size.  To force a specific paper size and
ignore the paper size specified in the document, select a paper size as
just described, and also include the
<a href="#FIXEDMEDIA"><b><tt>-dFIXEDMEDIA</tt></b> switch</a> on the
command line.

<h2><a name="Change_default_size"></a>Changing the installed default paper size</h2>

<p>
You can change the installed default paper size in installing Ghostscript
or later, by editing the initialization file <b><tt>gs_init.ps</tt></b>.
Find the consecutive lines

<blockquote><b><tt>
%&nbsp;Optionally&nbsp;choose&nbsp;a&nbsp;default&nbsp;paper&nbsp;size&nbsp;other&nbsp;than&nbsp;U.S.&nbsp;letter.<br>
%&nbsp;(a4)
</tt></b></blockquote>

<p>
Then to make A4 the default paper size, uncomment the second line to change
this to

<blockquote><b><tt>
%&nbsp;Optionally&nbsp;choose&nbsp;a&nbsp;default&nbsp;paper&nbsp;size&nbsp;other&nbsp;than&nbsp;U.S.&nbsp;letter.<br>
(a4)
</tt></b></blockquote>

<p>
For <b><tt>a4</tt></b> you can substitute any
<a href="#Paper sizes">paper size Ghostscript knows</a>.

<h1><a name="Finding_files"></a>How Ghostscript finds files</h1>

<p>
When looking for initialization files (<b><tt>gs_*.ps</tt></b>,
<b><tt>pdf_*.ps</tt></b>), font files, the <b><tt>Fontmap</tt></b> file,
and files named on the command line, Ghostscript first tests whether the
file name specifies an explicit directory.

<blockquote><table cellpadding=0 cellspacing=0>
<tr><th colspan=3 bgcolor="#CCCC00"><hr><font size="+1">Testing a file name for an explicit directory</font><hr>
<tr>	<th align=left>System
	<td>&nbsp;&nbsp;
	<th align=left>Does the name ...
<tr>	<td colspan=3><hr>
<tr>	<td valign=top>Unix
	<td>&nbsp;
	<td>Begin with <b><tt><u>/</u></tt></b>, <b><tt><u>./</u></tt></b> or <b><tt><u>../</u></tt></b> ?
<tr>	<td valign=top>DOS or MS Windows
	<td>&nbsp;
	<td>Have <b><tt><u>:</u></tt></b> as its second character, or
		begin with <b><tt><u>/</u></tt></b>, <b><tt><u>\</u></tt></b>,
		<b><tt><u>./</u></tt></b>, <b><tt><u>../</u></tt></b>, <b><tt><u>.\</u></tt></b>, or <b><tt><u>..\</u></tt></b> ?
<tr>	<td valign=top>VMS
	<td>&nbsp;
	<td>Contain a node, device, root, or directory specification?
</table></blockquote>

<p><a name="General_search_path"></a> If the test succeeds, the file name
specifies an explicit directory and Ghostscript tries to open the file
using the name given.  Otherwise it tries directories in this order:

<ol>
<li>The current directory (unless disabled by the
<a href="#P-_switch"><b><tt>-P-</tt></b> switch</a>);

<li>The directories specified by <a href="#I_switch"><b><tt>-I</tt></b>
switches</a> in the command line, if any;

<li>The directories specified by the <b><tt>GS_LIB</tt></b>
environment variable, if any;

<li>The directories specified by the
<b><tt>GS_LIB_DEFAULT</tt></b> macro (if any) in the makefile
when this executable was built.
</ol>

<p>
<b><tt>GS_LIB_DEFAULT</tt></b>,
<b><tt>GS_LIB</tt></b>, and the
<b><tt>-I</tt></b> parameter may specify either a single
directory or a list of directories separated by a character appropriate for
the operating system ("<b><tt>:</tt></b>" on Unix systems,
"<b><tt>,</tt></b>" on VMS systems, and
"<b><tt>;</tt></b>" on DOS systems).  We think that trying
the current directory first is a very bad idea -- it opens serious security
loopholes and can lead to very confusing errors if one has more than one
version of Ghostscript in one's environment -- but when we attempted to
change it, users insisted that we change it back.  You can disable looking
in the current directory first by using the
<a href="#P_switch"><b><tt>-P-</tt></b> switch</a>.

<p>
Note that Ghostscript does not use this file searching algorithm for the
<b><tt>run</tt></b> or <b><tt>file</tt></b>
operators: for these operators, it simply opens the file with the name
given.  To run a file using the searching algorithm, use
<b><tt>runlibfile</tt></b> instead of
<b><tt>run</tt></b>.

<h2><a name="PS_resources"></a>Finding PostScript Level 2 resources</h2>

<p>
Ghostscript uses a completely different rule for looking for files
containing PostScript Level 2 "resources": per the Adobe documentation, it
concatenates together

<ol>
<li>the value of the system parameter
<b><tt>GenericResourceDir</tt></b> (initially
<b><tt>/Resource/</tt></b>)

<li>the name of the resource category (for instance, <b><tt>ProcSet</tt></b>)

<li>the value of the system parameter
<b><tt>GenericResourcePathSep</tt></b> (initially
"<b><tt>/</tt></b>")

<li>the name of the resource instance (for instance, <b><tt>CIDInit</tt></b>)
</ol>

<p>
To look up fonts, after exhausting the search method described in <a href="#Font_lookup">the
next section</a>, it concatenates together

<ol>
<li>the value of the system parameter
<b><tt>FontResourceDir</tt></b> (initially
<b><tt>/Resource/Font/</tt></b>)

<li>the name of the resource font (for instance, <b><tt>Times-Roman</tt></b>)
</ol>

<p>
Note that even though the system parameters are named "somethingDir", they
are not just plain directory names: they have
"<b><tt>/</tt></b>" on the end, so that they can be
concatenated with the category name or font name.

<h2><a name="Font_lookup"></a>Font lookup</h2>

<p>
Ghostscript has a slightly different way to find the file containing a font
with a given name.  This rule uses not only the search path defined by
<b><tt>-I</tt></b>, <b><tt>GS_LIB</tt></b>,
and <b><tt>GS_LIB_DEFAULT</tt></b>
<a href="#General_search_path">as described above</a>, but also an
additional list of directories which is the value of the
<b><tt>GS_FONTPATH</tt></b> environment variable (or the value provided
with the <b><tt>-sFONTPATH=</tt></b> switch, if present).

<p>
When Ghostscript needs to find a font that isn't already loaded into
memory, it begins by looking for <b><tt>Fontmap</tt></b>
files in every directory on the search path: these files are catalogs of
fonts and the files that contain them.  (See
<a href="Fonts.htm#Fontmap">the documentation of fonts</a> for details.)
If it can't find a font in any Fontmap file in the search path (or in the
list provided with the <b><tt>-sFONTMAP=</tt></b> switch, if
present), it looks at the <b><tt>GS_FONTPATH</tt></b>
environment variable (or the value provided with the
<b><tt>-sFONTPATH=</tt></b> switch, if present), which is
also a list of directories.  It goes to those directories one by one
looking for all files that appear to contain PostScript fonts; it then
effectively adds all those files and fonts to its internal copy of the
Fontmap.

<blockquote><table cellpadding=0 cellspacing=0>
<tr><th colspan=3 bgcolor="#CCCC00"><hr><font size="+1">Differences between search path and font path</font><hr>
<tr>	<th>Search path
	<td>&nbsp;&nbsp;&nbsp;
	<th>Font path
<tr>	<td colspan=3><hr>
<tr>	<td><b><tt>-I</tt></b> switch
	<td>&nbsp;
	<td><b><tt>-sFONTPATH=</tt></b> switch
<tr>	<td>&nbsp;
<tr>	<td><b><tt>GS_LIB</tt></b> and <b><tt>GS_LIB_DEFAULT</tt></b>
	    environment variables
	<td>&nbsp;
	<td><b><tt>-sFONTPATH=</tt></b> and the <b><tt>GS_FONTPATH</tt></b>
	    environment variable
<tr>	<td>&nbsp;
<tr>	<td valign=top>Consulted first
	<td>&nbsp;
	<td valign=top>Consulted only if search path doesn't provide the file.
<tr>	<td>&nbsp;
<tr>	<td valign=top>Font-name-to-file-name mapping given in Fontmap
	    files; aliases are possible, and there need not be any relation
	    between the font name in the Fontmap and the
	    <b><tt>FontName</tt></b> in the file.
	<td>&nbsp; <td valign=top>Font-name-to-file-name mapping is
	    implicit -- the <b><tt>FontName</tt></b> in the file is
	    used. Aliases are not possible.
<tr>	<td>&nbsp;
<tr>	<td valign=top>Only fonts and files named in Fontmap are used.
	<td>&nbsp;
	<td valign=top>Every Type 1 font file in each directory is
	    available; if TrueType fonts are supported (the
	    <b><tt>ttfont.dev</tt></b> feature was included when the
	    executable was built), they are also available.
</table></blockquote>

<p>
If you are using one of the following types of computer, you may wish to
set the environment variable <b><tt>GS_FONTPATH</tt></b> to
the value indicated so that Ghostscript will automatically acquire all the
installed Type 1 (and, if supported, TrueType) fonts (but see below for
notes on systems marked with "*"):

<blockquote><table cellpadding=0 cellspacing=0>
<tr><th colspan=5 bgcolor="#CCCC00"><hr><font size="+1">Suggested <b><tt>GS_FONTPATH</tt></b> for different systems</font><hr>
<tr>	<td>&nbsp;
	<td>&nbsp;&nbsp;
	<th align=left>System type
	<td>&nbsp;&nbsp;
	<th valign=bottom align=left><b><tt>GS_FONTPATH</tt></b>
<tr>	<td colspan=5><hr>
<tr>	<td>&nbsp;
	<td>&nbsp;
	<td valign=top>Digital Unix
	<td>&nbsp;
	<td><b><tt>/usr/lib/X11/fonts/Type1Adobe</tt></b>
<tr>	<td>&nbsp;
	<td>&nbsp;
	<td valign=top>Ultrix
	<td>&nbsp;
	<td><b><tt>/usr/lib/DPS/outline/decwin</tt></b>
<tr>	<td>&nbsp;
	<td>&nbsp;
	<td valign=top>HP-UX 9
	<td>&nbsp;
	<td><b><tt>/usr/lib/X11/fonts/type1.st/typefaces</tt></b>
<tr>	<td>&nbsp;
	<td>&nbsp;
	<td valign=top>IBM AIX
	<td>&nbsp;
	<td><b><tt>/usr/lpp/DPS/fonts/outlines
		<br>/usr/lpp/X11/lib/X11/fonts/Type1
		<br>/usr/lpp/X11/lib/X11/fonts/Type1/DPS</tt></b>
<tr>	<td>&nbsp;
	<td>&nbsp;
	<td valign=top>NeXT
	<td>&nbsp;
	<td><b><tt>/NextLibrary/Fonts/outline</tt></b>
<tr>	<td>&nbsp;
	<td>&nbsp;
	<td valign=top>SGI IRIX
	<td>&nbsp;
	<td><b><tt>/usr/lib/DPS/outline/base
		<br>/usr/lib/X11/fonts/Type1</tt></b>
<tr>	<td>&nbsp;
	<td>&nbsp;
	<td valign=top>SunOS 4.x<br>(NeWSprint only)
	<td>&nbsp;
	<td valign=top><b><tt>newsprint_2.5/SUNWsteNP/reloc/$BASEDIR/NeWSprint/<br>&nbsp;&nbsp;&nbsp;&nbsp;small_openwin/lib/fonts</tt></b>
<tr>	<td>*
	<td>&nbsp;
	<td valign=top>SunOS 4.x
	<td>&nbsp;
	<td><b><tt>/usr/openwin/lib/X11/fonts/Type1/outline</tt></b>
<tr>	<td>*
	<td>&nbsp;
	<td valign=top>Solaris 2.x
	<td>&nbsp;
	<td><b><tt>/usr/openwin/lib/X11/fonts/Type1/outline</tt></b>
<tr>	<td>&nbsp;
	<td>&nbsp;
	<td valign=top>VMS
	<td>&nbsp;
	<td><b><tt>SYS$COMMON:[SYSFONT.XDPS.OUTLINE]</tt></b>
</table>

<hr align=left width="25%"><b>*</b> On Solaris systems simply setting
<b><tt>GS_FONTPATH</tt></b> may not work, because for some reason some
versions of Ghostscript can't seem to find any of the Type1 fonts in
<b><tt>/usr/openwin/lib/X11/fonts/Type1/outline</tt></b>. (It says: "15
files, 15 scanned, 0 new fonts".) See <b><tt>Fontmap.Sol</tt></b> instead.
Also, on Solaris 2.x it's probably not worth your while to add Sun's fonts
to your font path and Fontmap.  The fonts Sun distributes on Solaris 2.x in
the directories

<blockquote><b><tt>
	/usr/openwin/lib/X11/fonts/Type1<br>
	/usr/openwin/lib/X11/fonts/Type1/outline
</tt></b></blockquote>

<p>
are already represented among the ones distributed as part of Ghostscript;
and on some test files, Sun's fonts have been shown to cause incorrect
displays with Ghostscript.

</blockquote>

<p>
These paths may not be exactly right for your installation; if the indicated
directory doesn't contain files whose names are familiar font names like
Courier and Helvetica, you may wish to ask your system administrator where
to find these fonts.

<p>
Adobe Acrobat comes with a set of fourteen Type 1 fonts, on Unix typically
in a directory called ...<b><tt>/Acrobat3/Fonts</tt></b>.  There is no
particular reason to use these instead of the corresponding professional
fonts in the Ghostscript distribution, except to save about a megabyte of
disk space, but the installation documentation explains how to do it
<a href="Install.htm#Use_Acrobat_fonts_Unix">on Unix</a> and
<a href="Install.htm#Use_platform_fonts_DOS">on DOS</a> (where you can also
use Adobe Type Manager fonts).

<h2><a name="Temp_files"></a>Temporary files</h2>

<blockquote><table cellpadding=0 cellspacing=0>
<tr><th colspan=5 bgcolor="#CCCC00"><hr><font size="+1">Where Ghostscript puts temporary files</font><hr>
<tr valign=bottom>
	<th align=left>Platform
	<td>&nbsp;&nbsp;&nbsp;
	<th align=left>Filename
	<td>&nbsp;&nbsp;&nbsp;
	<th align=left>Location
<tr>	<td colspan=5><hr>
<tr valign=top>	<td>DOS and OpenVMS
	<td>&nbsp;
	<td><b><tt>_temp_</tt></b>XX.XXX
	<td>&nbsp;
	<td>Current directory
<tr valign=top>	<td>OS/2
	<td>&nbsp;

⌨️ 快捷键说明

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