2 |
- |
1 |
.\" $Id: gs.1,v 1.38 2005/10/20 19:46:55 ray Exp $
|
|
|
2 |
.TH GS 1 "20 October 2005" 8.53 Ghostscript \" -*- nroff -*-
|
|
|
3 |
.SH NAME
|
|
|
4 |
gs \- Ghostscript (PostScript and PDF language interpreter and previewer)
|
|
|
5 |
.SH SYNOPSIS
|
|
|
6 |
\fBgs\fR [ \fIoptions\fR ] [ \fIfiles\fR ] ... \fB(Unix, VMS)\fR
|
|
|
7 |
.br
|
|
|
8 |
\fBgswin32c\fR [ \fIoptions\fR ] [ \fIfiles\fR ] ... \fB(MS Windows)\fR
|
|
|
9 |
.br
|
|
|
10 |
\fBgswin32\fR [ \fIoptions\fR ] [ \fIfiles\fR ] ... \fB(MS Windows 3.1)\fR
|
|
|
11 |
.br
|
|
|
12 |
\fBgsos2\fR [ \fIoptions\fR ] [ \fIfiles\fR ] ... \fB(OS/2)\fR
|
|
|
13 |
.de TQ
|
|
|
14 |
.br
|
|
|
15 |
.ns
|
|
|
16 |
.TP \\$1
|
|
|
17 |
..
|
|
|
18 |
.SH DESCRIPTION
|
|
|
19 |
The \fBgs\fR (\fBgswin32c\fR, \fBgswin32\fR, \fBgsos2\fR)
|
|
|
20 |
command invokes \fBGhostscript\fR, an interpreter of Adobe Systems'
|
|
|
21 |
\fBPostScript\fR(tm) and \fBPortable Document Format\fR (PDF) languages.
|
|
|
22 |
\fBgs\fR reads "files" in sequence and executes them as Ghostscript
|
|
|
23 |
programs. After doing this, it reads further input from the standard input
|
|
|
24 |
stream (normally the keyboard), interpreting each line separately. The
|
|
|
25 |
interpreter exits gracefully when it encounters the "quit" command (either
|
|
|
26 |
in a file or from the keyboard), at end-of-file, or at an interrupt signal
|
|
|
27 |
(such as Control-C at the keyboard).
|
|
|
28 |
.PP
|
|
|
29 |
The interpreter recognizes many option switches, some of which are described
|
|
|
30 |
below. Please see the usage documenation for complete information. Switches
|
|
|
31 |
may appear anywhere in the command line and apply to all files thereafter.
|
|
|
32 |
Invoking Ghostscript with the \fB\-h\fR or \fB\-?\fR switch produces a
|
|
|
33 |
message which shows several useful switches, all the devices known to
|
|
|
34 |
that executable, and the search path for fonts; on Unix it also shows the
|
|
|
35 |
location of detailed documentation.
|
|
|
36 |
.PP
|
|
|
37 |
Ghostscript may be built to use many different output devices. To see
|
|
|
38 |
which devices your executable includes, run "\fBgs -h\fR". Unless you
|
|
|
39 |
specify a particular device, Ghostscript normally opens the first one of
|
|
|
40 |
those and directs output to it, so if the first one in the list is the one
|
|
|
41 |
you want to use, just issue the command
|
|
|
42 |
.PP
|
|
|
43 |
.nf
|
|
|
44 |
gs myfile.ps
|
|
|
45 |
.fi
|
|
|
46 |
.PP
|
|
|
47 |
You can also check the set of available devices from within Ghostscript:
|
|
|
48 |
invoke Ghostscript and type
|
|
|
49 |
.PP
|
|
|
50 |
.nf
|
|
|
51 |
devicenames ==
|
|
|
52 |
.fi
|
|
|
53 |
.PP
|
|
|
54 |
but the first device on the resulting list may not be the default device
|
|
|
55 |
you determine with "\fBgs -h\fR". To specify "AbcXyz" as the
|
|
|
56 |
initial output device, include the switch
|
|
|
57 |
.PP
|
|
|
58 |
.nf
|
|
|
59 |
\-sDEVICE=AbcXyz
|
|
|
60 |
.fi
|
|
|
61 |
.PP
|
|
|
62 |
For example, for output to an Epson printer you might use the command
|
|
|
63 |
.PP
|
|
|
64 |
.nf
|
|
|
65 |
gs \-sDEVICE=epson myfile.ps
|
|
|
66 |
.fi
|
|
|
67 |
.PP
|
|
|
68 |
The "\-sDEVICE=" switch must precede the first mention of a file to print,
|
|
|
69 |
and only the switch's first use has any effect.
|
|
|
70 |
.PP
|
|
|
71 |
Finally, you can specify a default device in the environment variable
|
|
|
72 |
\fBGS_DEVICE\fR. The order of precedence for these alternatives from
|
|
|
73 |
highest to lowest (Ghostscript uses the device defined highest in the list)
|
|
|
74 |
is:
|
|
|
75 |
.PP
|
|
|
76 |
Some devices can support different resolutions (densities). To specify
|
|
|
77 |
the resolution on such a printer, use the "\-r" switch:
|
|
|
78 |
.PP
|
|
|
79 |
.nf
|
|
|
80 |
gs \-sDEVICE=<device> \-r<xres>x<yres>
|
|
|
81 |
.fi
|
|
|
82 |
.PP
|
|
|
83 |
For example, on a 9-pin Epson-compatible printer, you get the
|
|
|
84 |
lowest-density (fastest) mode with
|
|
|
85 |
.PP
|
|
|
86 |
.nf
|
|
|
87 |
gs \-sDEVICE=epson \-r60x72
|
|
|
88 |
.fi
|
|
|
89 |
.PP
|
|
|
90 |
and the highest-density (best output quality) mode with
|
|
|
91 |
.PP
|
|
|
92 |
.nf
|
|
|
93 |
gs \-sDEVICE=epson \-r240x72.
|
|
|
94 |
.fi
|
|
|
95 |
.PP
|
|
|
96 |
If you select a printer as the output device, Ghostscript also allows you
|
|
|
97 |
to choose where Ghostscript sends the output \-\- on Unix systems, usually
|
|
|
98 |
to a temporary file. To send the output to a file "foo.xyz",
|
|
|
99 |
use the switch
|
|
|
100 |
.PP
|
|
|
101 |
.nf
|
|
|
102 |
\-sOutputFile=foo.xyz
|
|
|
103 |
.fi
|
|
|
104 |
.PP
|
|
|
105 |
You might want to print each page separately. To do this, send the output
|
|
|
106 |
to a series of files "foo1.xyz, foo2.xyz, ..." using the "\-sOutputFile="
|
|
|
107 |
switch with "%d" in a filename template:
|
|
|
108 |
.PP
|
|
|
109 |
.nf
|
|
|
110 |
\-sOutputFile=foo%d.xyz
|
|
|
111 |
.fi
|
|
|
112 |
.PP
|
|
|
113 |
Each resulting file receives one page of output, and the files are numbered
|
|
|
114 |
in sequence. "%d" is a printf format specification; you can also use a
|
|
|
115 |
variant like "%02d".
|
|
|
116 |
.PP
|
|
|
117 |
On Unix and MS Windows systems you can also send output to a pipe. For example, to
|
|
|
118 |
pipe output to the "\fBlpr\fR" command (which, on many Unix systems,
|
|
|
119 |
directs it to a printer), use the option
|
|
|
120 |
.PP
|
|
|
121 |
.nf
|
|
|
122 |
\-sOutputFile=%pipe%lpr
|
|
|
123 |
.fi
|
|
|
124 |
.PP
|
|
|
125 |
Note that the '%' characters need to be doubled on MS Windows to avoid
|
|
|
126 |
mangling by the command interpreter.
|
|
|
127 |
.PP
|
|
|
128 |
You can also send output to standard output:
|
|
|
129 |
.PP
|
|
|
130 |
.nf
|
|
|
131 |
\-sOutputFile=\-
|
|
|
132 |
.fi
|
|
|
133 |
or
|
|
|
134 |
.nf
|
|
|
135 |
\-sOutputFile=%stdout%
|
|
|
136 |
.fi
|
|
|
137 |
.PP
|
|
|
138 |
In this case you must also use the \fB\-q\fR switch, to prevent Ghostscript
|
|
|
139 |
from writing messages to standard output.
|
|
|
140 |
.PP
|
|
|
141 |
To select a specific paper size, use the command line switch
|
|
|
142 |
.PP
|
|
|
143 |
.nf
|
|
|
144 |
-sPAPERSIZE=<paper_size>
|
|
|
145 |
.fi
|
|
|
146 |
.PP
|
|
|
147 |
for instance
|
|
|
148 |
.PP
|
|
|
149 |
.nf
|
|
|
150 |
-sPAPERSIZE=a4
|
|
|
151 |
.fi
|
|
|
152 |
or
|
|
|
153 |
.nf
|
|
|
154 |
-sPAPERSIZE=legal
|
|
|
155 |
.fi
|
|
|
156 |
.PP
|
|
|
157 |
Most ISO and US paper sizes are recognized. See the usage documenatation for
|
|
|
158 |
a full list, or the definitions in the initialization file "gs_statd.ps".
|
|
|
159 |
.PP
|
|
|
160 |
Ghostscript can do many things other than print or view PostScript and
|
|
|
161 |
PDF files. For example, if you want to know the bounding box of a
|
|
|
162 |
PostScript (or EPS) file, Ghostscript provides a special "device" that
|
|
|
163 |
just prints out this information.
|
|
|
164 |
.PP
|
|
|
165 |
For example, using one of the example files distributed with Ghostscript,
|
|
|
166 |
.PP
|
|
|
167 |
.nf
|
|
|
168 |
gs \-sDEVICE=bbox golfer.ps
|
|
|
169 |
.fi
|
|
|
170 |
.PP
|
|
|
171 |
prints out
|
|
|
172 |
.PP
|
|
|
173 |
.nf
|
|
|
174 |
%%BoundingBox: 0 25 583 732
|
|
|
175 |
%%HiResBoundingBox: 0.808497 25.009496 582.994503 731.809445
|
|
|
176 |
.fi
|
|
|
177 |
.SH OPTIONS
|
|
|
178 |
.TP
|
|
|
179 |
.BI \-\- " filename arg1 ..."
|
|
|
180 |
Takes the next argument as a file name as usual, but takes all remaining
|
|
|
181 |
arguments (even if they have the syntactic form of switches) and defines
|
|
|
182 |
the name "ARGUMENTS" in "userdict" (not "systemdict") as an
|
|
|
183 |
array of those strings, \fBbefore\fR running the file. When Ghostscript
|
|
|
184 |
finishes executing the file, it exits back to the shell.
|
|
|
185 |
.TP
|
|
|
186 |
.BI \-D name = token
|
|
|
187 |
.TQ
|
|
|
188 |
.BI \-d name = token
|
|
|
189 |
Define a name in "systemdict" with the given definition. The token must be
|
|
|
190 |
exactly one token (as defined by the "token" operator) and may contain no
|
|
|
191 |
whitespace.
|
|
|
192 |
.TP
|
|
|
193 |
.BI \-D name
|
|
|
194 |
.TQ
|
|
|
195 |
.BI \-d name
|
|
|
196 |
Define a name in "systemdict" with value=null.
|
|
|
197 |
.TP
|
|
|
198 |
.BI \-S name = string
|
|
|
199 |
.TQ
|
|
|
200 |
.BI \-s name = string
|
|
|
201 |
Define a name in "systemdict" with a given string as value. This is
|
|
|
202 |
different from \fB\-d\fR. For example, \fB\-dname=35\fR is equivalent to the
|
|
|
203 |
program fragment
|
|
|
204 |
.br
|
|
|
205 |
/name 35 def
|
|
|
206 |
.br
|
|
|
207 |
whereas \fB\-sname=35\fR is equivalent to
|
|
|
208 |
.br
|
|
|
209 |
/name (35) def
|
|
|
210 |
.TP
|
|
|
211 |
.B \-q
|
|
|
212 |
Quiet startup: suppress normal startup messages, and also do the
|
|
|
213 |
equivalent of \fB\-dQUIET\fR.
|
|
|
214 |
.TP
|
|
|
215 |
.BI \-g number1 x number2
|
|
|
216 |
Equivalent to \fB\-dDEVICEWIDTH=\fR\fInumber1\fR and
|
|
|
217 |
\fB\-dDEVICEHEIGHT=\fR\fInumber2\fR. This is for the benefit of devices
|
|
|
218 |
(such as X11 windows) that require (or allow) width and height to be
|
|
|
219 |
specified.
|
|
|
220 |
.TP
|
|
|
221 |
.BI \-r number
|
|
|
222 |
.TQ
|
|
|
223 |
.BI \-r number1 x number2
|
|
|
224 |
Equivalent to \fB\-dDEVICEXRESOLUTION=\fR\fInumber1\fR and
|
|
|
225 |
\fB\-dDEVICEYRESOLUTION=\fR\fInumber2\fR. This is for the benefit of
|
|
|
226 |
devices such as printers that support multiple X and Y resolutions. If
|
|
|
227 |
only one number is given, it is used for both X and Y resolutions.
|
|
|
228 |
.TP
|
|
|
229 |
.BI \-I directories
|
|
|
230 |
Adds the designated list of directories at the head of the
|
|
|
231 |
search path for library files.
|
|
|
232 |
.TP
|
|
|
233 |
.B \-
|
|
|
234 |
This is not really a switch, but indicates to Ghostscript that standard
|
|
|
235 |
input is coming from a file or a pipe and not interactively from the
|
|
|
236 |
command line. Ghostscript reads from standard input until it reaches
|
|
|
237 |
end-of-file, executing it like any other file, and then continues with
|
|
|
238 |
processing the command line. When the command line has been entirely
|
|
|
239 |
processed, Ghostscript exits rather than going into its interactive mode.
|
|
|
240 |
.PP
|
|
|
241 |
Note that the normal initialization file "gs_init.ps" makes "systemdict"
|
|
|
242 |
read-only, so the values of names defined with \fB\-D\fR, \fB\-d\fR,
|
|
|
243 |
\fB\-S\fR, or \fB\-s\fR cannot be changed (although, of course, they can be
|
|
|
244 |
superseded by definitions in "userdict" or other dictionaries.)
|
|
|
245 |
.SH "SPECIAL NAMES"
|
|
|
246 |
.TP
|
|
|
247 |
.B \-dDISKFONTS
|
|
|
248 |
Causes individual character outlines to be loaded from the disk
|
|
|
249 |
the first time they are encountered. (Normally Ghostscript loads all the
|
|
|
250 |
character outlines when it loads a font.) This may allow loading more
|
|
|
251 |
fonts into RAM, at the expense of slower rendering.
|
|
|
252 |
.TP
|
|
|
253 |
.B \-dNOCACHE
|
|
|
254 |
Disables character caching. Useful only for debugging.
|
|
|
255 |
.TP
|
|
|
256 |
.B \-dNOBIND
|
|
|
257 |
Disables the "bind" operator. Useful only for debugging.
|
|
|
258 |
.TP
|
|
|
259 |
.B \-dNODISPLAY
|
|
|
260 |
Suppresses the normal initialization of the output device.
|
|
|
261 |
This may be useful when debugging.
|
|
|
262 |
.TP
|
|
|
263 |
.B \-dNOPAUSE
|
|
|
264 |
Disables the prompt and pause at the end of each page. This may be
|
|
|
265 |
desirable for applications where another program is driving Ghostscript.
|
|
|
266 |
.TP
|
|
|
267 |
.B \-dNOPLATFONTS
|
|
|
268 |
Disables the use of fonts supplied by the underlying platform (for instance
|
|
|
269 |
X Windows). This may be needed if the platform fonts look undesirably
|
|
|
270 |
different from the scalable fonts.
|
|
|
271 |
.TP
|
|
|
272 |
.B \-dSAFER
|
|
|
273 |
Disables the "deletefile" and "renamefile" operators and the ability to
|
|
|
274 |
open files in any mode other than read-only. This strongly recommended for
|
|
|
275 |
spoolers, conversion scripts or other sensitive environments where a badly
|
|
|
276 |
written or malicious PostScript program code must be prevented from changing
|
|
|
277 |
important files.
|
|
|
278 |
.TP
|
|
|
279 |
.B \-dWRITESYSTEMDICT
|
|
|
280 |
Leaves "systemdict" writable. This is necessary when running special
|
|
|
281 |
utility programs such as \fBfont2c\fR and \fBpcharstr\fR, which must bypass
|
|
|
282 |
normal PostScript access protection.
|
|
|
283 |
.TP
|
|
|
284 |
.BI \-sDEVICE= device
|
|
|
285 |
Selects an alternate initial output device, as described above.
|
|
|
286 |
.TP
|
|
|
287 |
.BI \-sOutputFile= filename
|
|
|
288 |
Selects an alternate output file (or pipe) for the initial output
|
|
|
289 |
device, as described above.
|
|
|
290 |
.SH FILES
|
|
|
291 |
.PP
|
|
|
292 |
The locations of many Ghostscript run-time files are compiled into the
|
|
|
293 |
executable when it is built. On Unix these are typically based in
|
|
|
294 |
\fB/usr/local\fR, but this may be different on your system. Under DOS they
|
|
|
295 |
are typically based in \fBC:\\GS\fR, but may be elsewhere, especially if
|
|
|
296 |
you install Ghostscript with \fBGSview\fR. Run "\fBgs -h\fR" to find the
|
|
|
297 |
location of Ghostscript documentation on your system, from which you can
|
|
|
298 |
get more details.
|
|
|
299 |
.TP
|
|
|
300 |
.B /usr/local/share/ghostscript/#.##/*
|
|
|
301 |
Startup files, utilities, and basic font definitions
|
|
|
302 |
.TP
|
|
|
303 |
.B /usr/local/share/ghostscript/fonts/*
|
|
|
304 |
More font definitions
|
|
|
305 |
.TP
|
|
|
306 |
.B /usr/local/share/ghostscript/#.##/examples/*
|
|
|
307 |
Ghostscript demonstration files
|
|
|
308 |
.TP
|
|
|
309 |
.B /usr/local/share/ghostscript/#.##/doc/*
|
|
|
310 |
Diverse document files
|
|
|
311 |
.SH "INITIALIZATION FILES"
|
|
|
312 |
When looking for the initialization files "gs_*.ps", the files related to
|
|
|
313 |
fonts, or the file for the "run" operator, Ghostscript first tries to open
|
|
|
314 |
the file with the name as given, using the current working directory if no
|
|
|
315 |
directory is specified. If this fails, and the file name doesn't specify
|
|
|
316 |
an explicit directory or drive (for instance, doesn't contain "/" on Unix
|
|
|
317 |
systems or "\\" on MS Windows systems), Ghostscript tries directories in this
|
|
|
318 |
order:
|
|
|
319 |
.TP 4
|
|
|
320 |
1.
|
|
|
321 |
the directories specified by the \fB\-I\fR switches in the command
|
|
|
322 |
line (see below), if any;
|
|
|
323 |
.TP
|
|
|
324 |
2.
|
|
|
325 |
the directories specified by the \fBGS_LIB\fR environment variable,
|
|
|
326 |
if any;
|
|
|
327 |
.TP
|
|
|
328 |
3.
|
|
|
329 |
the directories specified by the \fBGS_LIB_DEFAULT\fR macro in the
|
|
|
330 |
Ghostscript makefile when the executable was built. When \fBgs\fR is built
|
|
|
331 |
on Unix, \fBGS_LIB_DEFAULT\fR is usually
|
|
|
332 |
"/usr/local/share/ghostscript/#.##:/usr/local/share/ghostscript/fonts"
|
|
|
333 |
where "#.##" represents the Ghostscript version number.
|
|
|
334 |
.PP
|
|
|
335 |
Each of these (\fBGS_LIB_DEFAULT\fR, \fBGS_LIB\fR, and \fB\-I\fR parameter)
|
|
|
336 |
may be either a single directory or a list of directories separated by
|
|
|
337 |
":".
|
|
|
338 |
.SH ENVIRONMENT
|
|
|
339 |
.TP
|
|
|
340 |
.B GS_OPTIONS
|
|
|
341 |
String of options to be processed before the command line options
|
|
|
342 |
.TP
|
|
|
343 |
.B GS_DEVICE
|
|
|
344 |
Used to specify an output device
|
|
|
345 |
.TP
|
|
|
346 |
.B GS_FONTPATH
|
|
|
347 |
Path names used to search for fonts
|
|
|
348 |
.TP
|
|
|
349 |
.B GS_LIB
|
|
|
350 |
Path names for initialization files and fonts
|
|
|
351 |
.TP
|
|
|
352 |
.B TEMP
|
|
|
353 |
Where temporary files are made
|
|
|
354 |
.SH X RESOURCES
|
|
|
355 |
Ghostscript, or more properly the X11 display device, looks for the
|
|
|
356 |
following resources under the program name "Ghostscript":
|
|
|
357 |
.TP
|
|
|
358 |
.B borderWidth
|
|
|
359 |
The border width in pixels (default = 1).
|
|
|
360 |
.TP
|
|
|
361 |
.B borderColor
|
|
|
362 |
The name of the border color (default = black).
|
|
|
363 |
.TP
|
|
|
364 |
.B geometry
|
|
|
365 |
The window size and placement, WxH+X+Y (default is NULL).
|
|
|
366 |
.TP
|
|
|
367 |
.B xResolution
|
|
|
368 |
The number of x pixels per inch (default is computed from \fBWidthOfScreen\fR
|
|
|
369 |
and \fBWidthMMOfScreen\fR).
|
|
|
370 |
.TP
|
|
|
371 |
.B yResolution
|
|
|
372 |
The number of y pixels per inch (default is computed from
|
|
|
373 |
\fBHeightOfScreen\fR and \fBHeightMMOfScreen\fR).
|
|
|
374 |
.TP
|
|
|
375 |
.B useBackingPixmap
|
|
|
376 |
Determines whether backing store is to be used for saving display window
|
|
|
377 |
(default = true).
|
|
|
378 |
.PP
|
|
|
379 |
See the usage document for a more complete list of resources. To set these
|
|
|
380 |
resources on Unix, put them in a file such as "~/.Xresources" in the
|
|
|
381 |
following form:
|
|
|
382 |
.PP
|
|
|
383 |
.nf
|
|
|
384 |
Ghostscript*geometry: 612x792\-0+0
|
|
|
385 |
Ghostscript*xResolution: 72
|
|
|
386 |
Ghostscript*yResolution: 72
|
|
|
387 |
.fi
|
|
|
388 |
.PP
|
|
|
389 |
Then merge these resources into the X server's resource database:
|
|
|
390 |
.PP
|
|
|
391 |
.nf
|
|
|
392 |
% xrdb \-merge ~/.Xresources
|
|
|
393 |
.fi
|
|
|
394 |
.SH SEE ALSO
|
|
|
395 |
The various Ghostscript document files (above), especially \fBUse.htm\fR.
|
|
|
396 |
.SH BUGS
|
|
|
397 |
See the Usenet news group comp.lang.postscript.
|
|
|
398 |
.SH VERSION
|
|
|
399 |
This document was last revised for Ghostscript version 8.53.
|
|
|
400 |
.SH AUTHOR
|
|
|
401 |
artofcode LLC and Artifex Software, bug-gs at ghostscript.com, are the
|
|
|
402 |
primary maintainers of Ghostscript.
|
|
|
403 |
Russell J. Lang, gsview at ghostgum.com.au, is the author of most of the
|
|
|
404 |
MS Windows code in Ghostscript.
|