1GS(1)                             Ghostscript                            GS(1)
2
3
4

NAME

6       gs  -  Ghostscript  (PostScript  and  PDF language interpreter and pre‐
7       viewer)
8

SYNOPSIS

10       gs [ options ] [ files ] ... (Unix, VMS)
11       gswin32c [ options ] [ files ] ... (MS Windows)
12       gswin32 [ options ] [ files ] ... (MS Windows 3.1)
13       gsos2 [ options ] [ files ] ... (OS/2)
14

DESCRIPTION

16       The gs (gswin32c,  gswin32,  gsos2)  command  invokes  Ghostscript,  an
17       interpreter of Adobe Systems' PostScript(tm) and Portable Document For‐
18       mat (PDF) languages.  gs reads "files" in sequence and executes them as
19       Ghostscript programs. After doing this, it reads further input from the
20       standard input stream (normally the keyboard), interpreting  each  line
21       separately.  The  interpreter  exits  gracefully when it encounters the
22       "quit" command (either in a file or from the keyboard), at end-of-file,
23       or at an interrupt signal (such as Control-C at the keyboard).
24
25       The  interpreter  recognizes  many  option  switches, some of which are
26       described below. Please see the usage documenation for complete  infor‐
27       mation.  Switches  may appear anywhere in the command line and apply to
28       all files thereafter.  Invoking Ghostscript with the -h  or  -?  switch
29       produces a message which shows several useful switches, all the devices
30       known to that executable, and the search path for  fonts;  on  Unix  it
31       also shows the location of detailed documentation.
32
33       Ghostscript  may be built to use many different output devices.  To see
34       which devices your executable includes, run "gs -h".  Unless you  spec‐
35       ify  a  particular  device, Ghostscript normally opens the first one of
36       those and directs output to it, so if the first one in the list is  the
37       one you want to use, just issue the command
38
39            gs myfile.ps
40
41       You  can  also  check  the  set of available devices from within Ghost‐
42       script: invoke Ghostscript and type
43
44            devicenames ==
45
46       but the first device on the resulting  list  may  not  be  the  default
47       device  you determine with "gs -h".  To specify "AbcXyz" as the initial
48       output device, include the switch
49
50            -sDEVICE=AbcXyz
51
52       For example, for output to an Epson printer you might use the command
53
54            gs -sDEVICE=epson myfile.ps
55
56       The "-sDEVICE=" switch must precede the first  mention  of  a  file  to
57       print, and only the switch's first use has any effect.
58
59       Finally,  you  can specify a default device in the environment variable
60       GS_DEVICE.  The order of precedence for these alternatives from highest
61       to lowest (Ghostscript uses the device defined highest in the list) is:
62
63       Some devices can support different resolutions (densities).  To specify
64       the resolution on such a printer, use the "-r" switch:
65
66            gs -sDEVICE=<device> -r<xres>x<yres>
67
68       For example, on a 9-pin Epson-compatible printer, you get  the  lowest-
69       density (fastest) mode with
70
71            gs -sDEVICE=epson -r60x72
72
73       and the highest-density (best output quality) mode with
74
75            gs -sDEVICE=epson -r240x72.
76
77       If  you  select a printer as the output device, Ghostscript also allows
78       you to choose where Ghostscript sends the output --  on  Unix  systems,
79       usually  to  a temporary file.  To send the output to a file "foo.xyz",
80       use the switch
81
82            -sOutputFile=foo.xyz
83
84       You might want to print each page separately.  To  do  this,  send  the
85       output to a series of files "foo1.xyz, foo2.xyz, ..." using the "-sOut‐
86       putFile=" switch with "%d" in a filename template:
87
88            -sOutputFile=foo%d.xyz
89
90       Each resulting file receives one page of output, and the files are num‐
91       bered in sequence.  "%d" is a printf format specification; you can also
92       use a variant like "%02d".
93
94       On Unix and MS Windows systems you can also send output to a pipe.  For
95       example,  to pipe output to the "lpr" command (which, on many Unix sys‐
96       tems, directs it to a printer), use the option
97
98            -sOutputFile=%pipe%lpr
99
100       Note that the '%' characters need to be doubled on MS Windows to  avoid
101       mangling by the command interpreter.
102
103       You can also send output to standard output:
104
105            -sOutputFile=-
106       or
107            -sOutputFile=%stdout%
108
109       In  this  case  you must also use the -q switch, to prevent Ghostscript
110       from writing messages to standard output.
111
112       To select a specific paper size, use the command line switch
113
114            -sPAPERSIZE=<paper_size>
115
116       for instance
117
118            -sPAPERSIZE=a4
119       or
120            -sPAPERSIZE=legal
121
122       Most ISO and US paper sizes are recognized. See the  usage  documenata‐
123       tion  for  a  full  list, or the definitions in the initialization file
124       "gs_statd.ps".
125
126       Ghostscript can do many things other than print or view PostScript  and
127       PDF  files.   For  example,  if  you want to know the bounding box of a
128       PostScript (or EPS) file, Ghostscript provides a special "device"  that
129       just prints out this information.
130
131       For  example,  using  one  of the example files distributed with Ghost‐
132       script,
133
134            gs -sDEVICE=bbox golfer.ps
135
136       prints out
137
138            %%BoundingBox: 0 25 583 732
139            %%HiResBoundingBox: 0.808497 25.009496 582.994503 731.809445
140

OPTIONS

142       -- filename arg1 ...
143              Takes the next argument as a file name as usual, but  takes  all
144              remaining  arguments  (even  if  they have the syntactic form of
145              switches) and defines the name "ARGUMENTS"  in  "userdict"  (not
146              "systemdict")  as  an array of those strings, before running the
147              file.  When Ghostscript finishes executing the  file,  it  exits
148              back to the shell.
149
150       -Dname=token
151       -dname=token
152              Define  a  name  in "systemdict" with the given definition.  The
153              token must be exactly one token (as defined by the "token" oper‐
154              ator) and may contain no whitespace.
155
156       -Dname
157       -dname Define a name in "systemdict" with value=null.
158
159       -Sname=string
160       -sname=string
161              Define  a  name  in  "systemdict"  with a given string as value.
162              This is different from -d.  For example, -dname=35 is equivalent
163              to the program fragment
164                   /name 35 def
165              whereas -sname=35 is equivalent to
166                   /name (35) def
167
168       -q     Quiet startup: suppress normal startup messages, and also do the
169              equivalent of -dQUIET.
170
171       -gnumber1xnumber2
172              Equivalent to -dDEVICEWIDTH=number1 and  -dDEVICEHEIGHT=number2.
173              This  is  for  the benefit of devices (such as X11 windows) that
174              require (or allow) width and height to be specified.
175
176       -rnumber
177       -rnumber1xnumber2
178              Equivalent to -dDEVICEXRESOLUTION=number1  and  -dDEVICEYRESOLU‐
179              TION=number2.  This is for the benefit of devices such as print‐
180              ers that support multiple X and Y resolutions.  If only one num‐
181              ber is given, it is used for both X and Y resolutions.
182
183       -Idirectories
184              Adds  the  designated  list  of  directories  at the head of the
185              search path for library files.
186
187       -      This is not really a switch, but indicates to  Ghostscript  that
188              standard  input is coming from a file or a pipe and not interac‐
189              tively from the command line.  Ghostscript reads  from  standard
190              input  until it reaches end-of-file, executing it like any other
191              file, and then continues with processing the command line.  When
192              the  command line has been entirely processed, Ghostscript exits
193              rather than going into its interactive mode.
194
195       Note that the normal initialization file  "gs_init.ps"  makes  "system‐
196       dict"  read-only, so the values of names defined with -D, -d, -S, or -s
197       cannot be changed (although, of course, they can be superseded by defi‐
198       nitions in "userdict" or other dictionaries.)
199

SPECIAL NAMES

201       -dDISKFONTS
202              Causes  individual character outlines to be loaded from the disk
203              the first time  they  are  encountered.   (Normally  Ghostscript
204              loads  all  the  character outlines when it loads a font.)  This
205              may allow loading more fonts into RAM, at the expense of  slower
206              rendering.
207
208       -dNOCACHE
209              Disables character caching.  Useful only for debugging.
210
211       -dNOBIND
212              Disables the "bind" operator.  Useful only for debugging.
213
214       -dNODISPLAY
215              Suppresses the normal initialization of the output device.  This
216              may be useful when debugging.
217
218       -dNOPAUSE
219              Disables the prompt and pause at the end of each page.  This may
220              be  desirable  for applications where another program is driving
221              Ghostscript.
222
223       -dNOPLATFONTS
224              Disables the use of fonts supplied by  the  underlying  platform
225              (for  instance  X  Windows).  This may be needed if the platform
226              fonts look undesirably different from the scalable fonts.
227
228       -dSAFER
229              Disables the "deletefile" and  "renamefile"  operators  and  the
230              ability  to  open  files in any mode other than read-only.  This
231              strongly recommended for spoolers, conversion scripts  or  other
232              sensitive  environments where a badly written or malicious Post‐
233              Script program code must be prevented  from  changing  important
234              files.
235
236       -dWRITESYSTEMDICT
237              Leaves  "systemdict"  writable.   This is necessary when running
238              special utility programs such as font2c and pcharstr, which must
239              bypass normal PostScript access protection.
240
241       -sDEVICE=device
242              Selects an alternate initial output device, as described above.
243
244       -sOutputFile=filename
245              Selects  an alternate output file (or pipe) for the initial out‐
246              put device, as described above.
247

FILES

249       The locations of many Ghostscript run-time files are compiled into  the
250       executable  when  it  is  built.   On Unix these are typically based in
251       /usr/local, but this may be different on your system.  Under  DOS  they
252       are  typically  based in C:\GS, but may be elsewhere, especially if you
253       install Ghostscript with GSview.  Run "gs -h" to find the  location  of
254       Ghostscript  documentation  on your system, from which you can get more
255       details.
256
257       /usr/local/share/ghostscript/#.##/*
258              Startup files, utilities, and basic font definitions
259
260       /usr/local/share/ghostscript/fonts/*
261              More font definitions
262
263       /usr/local/share/ghostscript/#.##/examples/*
264              Ghostscript demonstration files
265
266       /usr/local/share/ghostscript/#.##/doc/*
267              Diverse document files
268

INITIALIZATION FILES

270       When looking for the initialization files "gs_*.ps", the files  related
271       to  fonts,  or the file for the "run" operator, Ghostscript first tries
272       to open the file with the name as  given,  using  the  current  working
273       directory  if  no  directory is specified.  If this fails, and the file
274       name doesn't specify an explicit  directory  or  drive  (for  instance,
275       doesn't  contain  "/"  on  Unix  systems or "\" on MS Windows systems),
276       Ghostscript tries directories in this order:
277
278       1.  the directories specified by the -I switches in  the  command  line
279           (see below), if any;
280
281       2.  the  directories  specified  by the GS_LIB environment variable, if
282           any;
283
284       3.  the directories specified by the GS_LIB_DEFAULT macro in the Ghost‐
285           script makefile when the executable was built.  When gs is built on
286           Unix,   GS_LIB_DEFAULT    is    usually    "/usr/local/share/ghost‐
287           script/#.##:/usr/local/share/ghostscript/fonts" where "#.##" repre‐
288           sents the Ghostscript version number.
289
290       Each of these (GS_LIB_DEFAULT, GS_LIB, and -I parameter) may be  either
291       a single directory or a list of directories separated by ":".
292

ENVIRONMENT

294       GS_OPTIONS
295              String  of  options  to  be  processed  before  the command line
296              options
297
298       GS_DEVICE
299              Used to specify an output device
300
301       GS_FONTPATH
302              Path names used to search for fonts
303
304       GS_LIB Path names for initialization files and fonts
305
306       TEMP   Where temporary files are made
307

X RESOURCES

309       Ghostscript, or more properly the X11 display  device,  looks  for  the
310       following resources under the program name "Ghostscript":
311
312       borderWidth
313              The border width in pixels (default = 1).
314
315       borderColor
316              The name of the border color (default = black).
317
318       geometry
319              The window size and placement, WxH+X+Y (default is NULL).
320
321       xResolution
322              The  number  of  x  pixels  per  inch  (default is computed from
323              WidthOfScreen and WidthMMOfScreen).
324
325       yResolution
326              The number of y  pixels  per  inch  (default  is  computed  from
327              HeightOfScreen and HeightMMOfScreen).
328
329       useBackingPixmap
330              Determines  whether  backing store is to be used for saving dis‐
331              play window (default = true).
332
333       See the usage document for a more complete list of resources.   To  set
334       these  resources on Unix, put them in a file such as "~/.Xresources" in
335       the following form:
336
337            Ghostscript*geometry:     612x792-0+0
338            Ghostscript*xResolution: 72
339            Ghostscript*yResolution: 72
340
341       Then merge these resources into the X server's resource database:
342
343            % xrdb -merge ~/.Xresources
344

SEE ALSO

346       The various Ghostscript document files (above), especially Use.htm.
347

BUGS

349       See the Usenet news group comp.lang.postscript.
350

VERSION

352       This document was last revised for Ghostscript version 8.15.
353

AUTHOR

355       artofcode LLC and Artifex Software, bug-gs at ghostscript.com, are  the
356       primary  maintainers of Ghostscript.  Russell J. Lang, gsview at ghost‐
357       gum.com.au, is the author of most of the  MS  Windows  code  in  Ghost‐
358       script.
359
360
361
3628.15                           22 September 2004                         GS(1)
Impressum