📄 use.htm
字号:
<td><b><tt>gs</tt></b>XXXXXX
<td>
<td>Current directory
<tr valign=top> <td>Unix
<td>
<td><b><tt>gs_</tt></b>XXXXX
<td>
<td><b><tt>/tmp</tt></b>
</table></blockquote>
<p>
You can change in which directory Ghostscript creates temporary files by
setting the <b><tt>TEMP</tt></b> environment variable to the name of the
directory you want used. Ghostscript currently doesn't do a very good job
of deleting temporary files when it exits; you may have to delete them
manually from time to time.
<h1><a name="Environment_variables"></a>Summary of environment variables</h1>
<dl>
<dt><a href="#GS_DEVICE"><b><tt>GS_DEVICE</tt></b></a>
<dd>Defines the default output device.
</dl>
<dl>
<dt><a href="#Font_lookup"><b><tt>GS_FONTPATH</tt></b></a>
<dd>Specifies a list of directories to scan for fonts if a font requested
can't be found anywhere on the search path.
</dl>
<dl>
<dt><a href="#Finding_files"><b><tt>GS_LIB</tt></b></a>
<dd>Provides a search path for initialization files and fonts.
</dl>
<dl>
<dt><b><tt>GS_OPTIONS</tt></b>
<dd>Defines a list of command-line arguments to be processed before the
ones actually specified on the command line. For example, setting
<b><tt>GS_DEVICE</tt></b> to XYZ is equivalent to setting
<b><tt>GS_OPTIONS</tt></b> to <b><tt>-sDEVICE=XYZ</tt></b>. The contents
of <b><tt>GS_OPTIONS</tt></b> are not limited to switches; they may include
actual file names or even <a href="#Input_control">"@file" arguments</a>.
</dl>
<dl>
<dt><a href="#Temp_files"><b><tt>TEMP</tt></b></a>
<dd>Defines a directory name for temporary files.
</dl>
<hr>
<h1><a name="PDF"></a>Using Ghostscript with PDF files</h1>
<p>
Ghostscript is normally built (except on 16-bit DOS platforms) to interpret
both PostScript and PDF files, examining each file to determine
automatically whether its contents are PDF or PostScript. All the normal
switches and procedures for interpreting PostScript files also apply to PDF
files, with a few exceptions. In addition, the
<b><tt>pdf2ps</tt></b> utility uses Ghostscript to convert
PDF to (Level 2) PostScript.
<h2><a name="PDF_stdin"></a>PDF files from standard input</h2>
<p>
Using the <a href="#Pipe_input">"<b><tt>-</tt></b>" switch</a> you can
provide PDF input from a file, but not from a pipe, because the PDF
language, unlike the PostScript language, inherently requires random access
to the file, while a pipe is always sequential. That is,
<blockquote><table cellpadding=0 cellspacing=0>
<tr> <td><b><tt>gs - <somefile.pdf</tt></b>
<td>
<td>(<b><em>is</em></b> permissible)
<tr> <td>{some program producing PDF} <b><tt>| gs -</tt></b>
<td>
<td>(is <b><em>not</em></b> permissible)
</table></blockquote>
<h2><a name="PDF_switches"></a>Switches for PDF files</h2>
<dl>
<dt><b><tt>-dFirstPage=pagenumber</tt></b>
<dd>Begins interpreting on the designated page of the document.
</dl>
<dl>
<dt><b><tt>-dLastPage=pagenumber</tt></b>
<dd>Stops interpreting after the designated page of the document.
</dl>
<dl>
<dt><b><tt>-sPSFile=filename</tt></b>
<dd>Writes the PostScript equivalent of the PDF input into the given file.
</dl>
<hr>
<h1><a name="Platforms"></a>Notes on specific platforms</h1>
<h2><a name="Unix"></a>Unix</h2>
<p>
The Ghostscript distribution includes some Unix shell scripts to use with
Ghostscript in different environments. These are all user-contributed
code, so if you have questions, please contact the user identified in the
file, not Aladdin Enterprises.
<dl>
<dt><b><tt>pv.sh</tt></b>
<dd>Preview a specified page of a <b><tt>dvi</tt></b> file in an X window
</dl>
<dl>
<dt><b><tt>sysvlp.sh</tt></b>
<dd>System V 3.2 lp interface for parallel printer
</dl>
<dl>
<dt><b><tt>pj-gs.sh</tt></b>
<dd>Printing on an H-P PaintJet under HP-UX
</dl>
<dl>
<dt><b><tt>unix-lpr.sh</tt></b>
<dd>Queue filter for <b><tt>lpr</tt></b> under Unix;
<a href="Unix-lpr.htm">its documentation</a> is intended for system
administrators
</dl>
<dl>
<dt><b><tt>lprsetup.sh</tt></b>
<dd>Setup for <b><tt>unix-lpr.sh</tt></b>
</dl>
<hr>
<h2><a name="VMS"></a>VMS</h2>
<ul>
<li>To be able to specify switches and file names when invoking the
interpreter, define <b><tt>gs</tt></b> as a foreign command:
<blockquote>
<b><tt>$ gs == "$</tt></b><em>disk</em><b><tt>:[</tt></b><em>directory</em><b><tt>]gs.exe</tt></b>"
</blockquote>
<p>
where the "<em>disk</em>" and "<em>directory</em>" specify where
the Ghostscript executable is located. For instance,
<blockquote><b><tt>
$ gs == "$dua1:[ghostscript]gs.exe"
</tt></b></blockquote>
<li>On VMS systems, the last character of each "directory" name indicates
what sort of entity the "directory" refers to. If the "directory" name
ends with a colon "<b><tt>:</tt></b>", it is taken to refer to a logical
device, for instance
<blockquote><b><tt>
$ define ghostscript_device dua1:[ghostscript_510]<br>
$ define gs_lib ghostscript_device:
</tt></b></blockquote>
<p>
If the "directory" name ends with a closing square bracket
"<b><tt>]</tt></b>", it is taken to refer to a real directory, for instance
<blockquote><b><tt>
$ define gs_lib dua1:[ghostscript]
</tt></b></blockquote>
<li>Defining the logical <b><tt>GS_LIB</tt></b>
<blockquote>
<b><tt>$ define gs_lib</tt></b> <em>disk</em><b><tt>:[</tt></b><em>directory</em><b><tt>]</tt></b>
</blockquote>
<p>
allows Ghostscript to find its initialization files in the Ghostscript
directory even if that's not where the executable resides.<br>
<li>Although VMS DCL itself converts unquoted parameters to upper case, C
programs such as Ghostscript receive their parameters through the C runtime
library, which forces all unquoted command-line parameters to lower case.
That is, with the command
<blockquote><b><tt>
$ gs -Isys$login:
</tt></b></blockquote>
<p>
Ghostscript sees the switch as <b><tt>-isys$login</tt></b>,
which doesn't work. To preserve the case of switches, quote them like
this:
<blockquote><b><tt>
$ gs "-Isys$login:"
</tt></b></blockquote>
<li>If you write printer output to a file with
<b><tt>-sOutputFile=</tt></b> and then want to print the file later, use
"<b><tt>PRINT/PASSALL</tt></b>".
<li>PDF files (or PostScript files that use the
<b><tt>setfileposition</tt></b> operator) must be "stream LF" type files to
work properly on VMS systems. (<b><em>Note:</em></b> This matters only if
Ghostscript was compiled with DEC C; there is no known way to get these
files to work properly if Ghostscript was compiled with the old VAX C
compiler. This is unlikely to be a problem, however.) Because of this, if
you transfer files by FTP, you probably need to do one of these two things
after the transfer:
<ol>
<li>If the FTP transfer was in text (ASCII) mode:
<blockquote>
<b><tt>$ convert/fdl=streamlf.fdl</tt></b> input-file output-file
</blockquote>
<p>
where the contents of the file <b><tt>STREAMLF.FDL</tt></b> are
<blockquote><font size="-1">
<pre>FILE
ORGANIZATION sequential
RECORD
BLOCK_SPAN yes
CARRIAGE_CONTROL carriage_return
FORMAT stream_lf
</pre></font></blockquote>
<li>If the FTP transfer was in binary mode:
<blockquote><b><tt>
$ set file/attribute=(rfm:stmlf)
</tt></b></blockquote>
</ol>
</ul>
<h3><a name="VMS_X_Windows"></a>Using X Windows on VMS</h3>
<p>
If you are using on an X Windows display, you can set it up with the node
name and network transport, for instance
<blockquote><b><tt>
$ set display/create/node="doof.city.com"/transport=tcpip
</tt></b></blockquote>
<p>
and then run Ghostscript by typing <b><tt>gs</tt></b> at the command line.
<hr>
<h2><a name="DOS"></a>DOS</h2>
<ul>
<li>
Ghostscript supports many SuperVGA displays directly, most of them with
more than 16 colors. The complete list is in the file
<b><tt>devs.mak</tt></b>, part of Ghostscript's
<a href="#Source_code">source code</a>.
<li>
Some applications, such as Microsoft Word, require a prologue in front of
the PostScript files they produce. In the case of MS Word, this prologue
is one of the *.ini files Microsoft includes with Word. Other applications
may require other prologues. You may specify a prologue on the Ghostscript
command line, for instance
<blockquote><b><tt>
gs386 prologue.ini myfile.ps
</tt></b></blockquote>
<li>
If you have a SuperVGA display that supports a 16-color mode with 800x600
pixels and you know the display mode number for this mode, you can select
it by using the command line switches
<blockquote>
<b><tt>-sDEVICE=svga16 -dDisplayMode=</tt></b><em>NNN</em>
</blockquote>
<p>
where <em>NNN</em> is the display mode number in decimal. Here are modes
for some popular display chipsets; the ones that use the default value are
marked "*". If your card's chipset doesn't appear on this list, or if you
try the value here and it doesn't work, please send the name of the chipset
and its correct display mode to Aladdin
<<a href="mailto:ghost@aladdin.com">ghost@aladdin.com</a>> to include
in future releases.
<blockquote><table cellpadding=0 cellspacing=0>
<tr><th colspan=6 bgcolor="#CCCC00"><hr><font size="+1">Display modes for PC display chipsets</font><hr>
<tr> <td>
<th>Chipset
<td>
<th>Decimal
<td>
<th>Hex
<tr> <td colspan=6><hr>
<tr> <td>
<td>Acumos AVGA2, AVGA3
<td>
<td align=center>88
<td>
<td align=right><tt>0x58</tt>
<tr> <td>
<td>Advance Logic AL2101
<td>
<td align=center>43
<td>
<td align=right><tt>0x2B</tt>
<tr> <td>
<td>Ahead V5000
<td>
<td align=center>113
<td>
<td align=right><tt>0x71</tt>
<tr> <td>
<td>ATI VGAWONDER, Graphics Ultra etc.
<td>
<td align=center>84
<td>
<td align=right><tt>0x54</tt>
<tr> <td>
<td>Chips and Technologies
<td>
<td align=center>106
<td>
<td align=right><tt>0x6A</tt>
<tr> <td>
<td>Cirrus Logic CL-GD 500/600
<td>
<td align=center>100
<td>
<td align=right><tt>0x64</tt>
<tr> <td>
<td>Cirrus Logic GD 5422
<td>
<td align=center>88
<td>
<td align=right><tt>0x58</tt>
<tr> <td>
<td>Compaq VGA
<td>
<td align=center>89
<td>
<td align=right><tt>0x59</tt>
<tr> <td>
<td>CTI
<td>
<td align=center>106
<td>
<td align=right><tt>0x6A</tt>
<tr> <td>*
<td>Genoa 5xxx, Sigma VGA
<td>
<td align=center>41
<td>
<td align=right><tt>0x29</tt>
<tr> <td>
<td>Genoa 6xxx
<td>
<td align=center>106
<td>
<td align=right><tt>0x6A</tt>
<tr> <td>
<td>MXIC MX 68010
<td>
<td align=center>85
<td>
<td align=right><tt>0x55</tt>
<tr> <td>
<td>NCR 77C22
<td>
<td align=center>88
<td>
<td align=right><tt>0x58</tt>
<tr> <td>
<td>OAK Technologies OTI-067, OTI-077, OTI037C
<td>
<td align=center>82
<td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -