MAN page from Other ghostscript-docs-8.54-3.i386.rpm
GS
Section: Ghostscript (1)
Updated: 17 May 2006
Index NAME
gs - Ghostscript (PostScript and PDF language interpreter and previewer)
SYNOPSIS
gs [
options ] [
files ] ...
(Unix, VMS)gswin32c [
options ] [
files ] ...
(MS Windows)gswin32 [
options ] [
files ] ...
(MS Windows 3.1)gsos2 [
options ] [
files ] ...
(OS/2) DESCRIPTION
The
gs (
gswin32c,
gswin32,
gsos2)command invokes
Ghostscript, an interpreter of Adobe Systems'
PostScript(tm) and
Portable Document Format (PDF) languages.
gs reads "files" in sequence and executes them as Ghostscriptprograms. After doing this, it reads further input from the standard inputstream (normally the keyboard), interpreting each line separately. Theinterpreter exits gracefully when it encounters the "quit" command (eitherin a file or from the keyboard), at end-of-file, or at an interrupt signal(such as Control-C at the keyboard).
The interpreter recognizes many option switches, some of which are describedbelow. Please see the usage documenation for complete information. Switchesmay appear anywhere in the command line and apply to all files thereafter.Invoking Ghostscript with the -h or -? switch produces amessage which shows several useful switches, all the devices known tothat executable, and the search path for fonts; on Unix it also shows thelocation of detailed documentation.
Ghostscript may be built to use many different output devices. To seewhich devices your executable includes, run "gs -h". Unless youspecify a particular device, Ghostscript normally opens the first one ofthose and directs output to it, so if the first one in the list is the oneyou want to use, just issue the command
gs myfile.ps
You can also check the set of available devices from within Ghostscript:invoke Ghostscript and type
devicenames ==
but the first device on the resulting list may not be the default deviceyou determine with "gs -h". To specify "AbcXyz" as theinitial output device, include the switch
-sDEVICE=AbcXyz
For example, for output to an Epson printer you might use the command
gs -sDEVICE=epson myfile.ps
The "-sDEVICE=" switch must precede the first mention of a file to print,and only the switch's first use has any effect.
Finally, you can specify a default device in the environment variableGS_DEVICE. The order of precedence for these alternatives fromhighest to lowest (Ghostscript uses the device defined highest in the list)is:
Some devices can support different resolutions (densities). To specifythe resolution on such a printer, use the "-r" switch:
gs -sDEVICE=<device> -r<xres>x<yres>
For example, on a 9-pin Epson-compatible printer, you get thelowest-density (fastest) mode with
gs -sDEVICE=epson -r60x72
and the highest-density (best output quality) mode with
gs -sDEVICE=epson -r240x72.
If you select a printer as the output device, Ghostscript also allows youto choose where Ghostscript sends the output -- on Unix systems, usuallyto a temporary file. To send the output to a file "foo.xyz",use the switch
-sOutputFile=foo.xyz
You might want to print each page separately. To do this, send the outputto a series of files "foo1.xyz, foo2.xyz, ..." using the "-sOutputFile="switch with "%d" in a filename template:
-sOutputFile=foo%d.xyz
Each resulting file receives one page of output, and the files are numberedin sequence. "%d" is a printf format specification; you can also use avariant like "%02d".
On Unix and MS Windows systems you can also send output to a pipe. For example, topipe output to the "lpr" command (which, on many Unix systems,directs it to a printer), use the option
-sOutputFile=%pipe%lpr
Note that the '%' characters need to be doubled on MS Windows to avoid mangling by the command interpreter.
You can also send output to standard output:
-sOutputFile=-
or
-sOutputFile=%stdout%
In this case you must also use the -q switch, to prevent Ghostscriptfrom writing messages to standard output.
To select a specific paper size, use the command line switch
-sPAPERSIZE=<paper_size>
for instance
-sPAPERSIZE=a4
or
-sPAPERSIZE=legal
Most ISO and US paper sizes are recognized. See the usage documenatation fora full list, or the definitions in the initialization file "gs_statd.ps".
Ghostscript can do many things other than print or view PostScript andPDF files. For example, if you want to know the bounding box of aPostScript (or EPS) file, Ghostscript provides a special "device" thatjust prints out this information.
For example, using one of the example files distributed with Ghostscript,
gs -sDEVICE=bbox golfer.ps
prints out
%%BoundingBox: 0 25 583 732 %%HiResBoundingBox: 0.808497 25.009496 582.994503 731.809445
OPTIONS
- -- filename arg1 ...
- Takes the next argument as a file name as usual, but takes all remainingarguments (even if they have the syntactic form of switches) and definesthe name "ARGUMENTS" in "userdict" (not "systemdict") as anarray of those strings, before running the file. When Ghostscriptfinishes executing the file, it exits back to the shell.
- -Dname=token
- -dname=token
- Define a name in "systemdict" with the given definition. The token must beexactly one token (as defined by the "token" operator) and may contain nowhitespace.
- -Dname
- -dname
- Define a name in "systemdict" with value=null.
- -Sname=string
- -sname=string
- Define a name in "systemdict" with a given string as value. This isdifferent from -d. For example, -dname=35 is equivalent to theprogram fragment
/name 35 def
whereas -sname=35 is equivalent to
/name (35) def
- -q
- Quiet startup: suppress normal startup messages, and also do theequivalent of -dQUIET.
- -gnumber1xnumber2
- Equivalent to -dDEVICEWIDTH=number1 and-dDEVICEHEIGHT=number2. This is for the benefit of devices(such as X11 windows) that require (or allow) width and height to bespecified.
- -rnumber
- -rnumber1xnumber2
- Equivalent to -dDEVICEXRESOLUTION=number1 and-dDEVICEYRESOLUTION=number2. This is for the benefit ofdevices such as printers that support multiple X and Y resolutions. Ifonly one number is given, it is used for both X and Y resolutions.
- -Idirectories
- Adds the designated list of directories at the head of thesearch path for library files.
- -
- This is not really a switch, but indicates to Ghostscript that standardinput is coming from a file or a pipe and not interactively from thecommand line. Ghostscript reads from standard input until it reachesend-of-file, executing it like any other file, and then continues withprocessing the command line. When the command line has been entirelyprocessed, Ghostscript exits rather than going into its interactive mode.
Note that the normal initialization file "gs_init.ps" makes "systemdict"read-only, so the values of names defined with -D, -d,-S, or -s cannot be changed (although, of course, they can besuperseded by definitions in "userdict" or other dictionaries.)
SPECIAL NAMES
- -dDISKFONTS
- Causes individual character outlines to be loaded from the diskthe first time they are encountered. (Normally Ghostscript loads all thecharacter outlines when it loads a font.) This may allow loading morefonts into RAM, at the expense of slower rendering.
- -dNOCACHE
- Disables character caching. Useful only for debugging.
- -dNOBIND
- Disables the "bind" operator. Useful only for debugging.
- -dNODISPLAY
- Suppresses the normal initialization of the output device.This may be useful when debugging.
- -dNOPAUSE
- Disables the prompt and pause at the end of each page. This may bedesirable for applications where another program is driving Ghostscript.
- -dNOPLATFONTS
- Disables the use of fonts supplied by the underlying platform (for instanceX Windows). This may be needed if the platform fonts look undesirablydifferent from the scalable fonts.
- -dSAFER
- Disables the "deletefile" and "renamefile" operators and the ability toopen files in any mode other than read-only. This strongly recommended forspoolers, conversion scripts or other sensitive environments where a badly written or malicious PostScript program code must be prevented from changingimportant files.
- -dWRITESYSTEMDICT
- Leaves "systemdict" writable. This is necessary when running specialutility programs such as font2c and pcharstr, which must bypassnormal PostScript access protection.
- -sDEVICE=device
- Selects an alternate initial output device, as described above.
- -sOutputFile=filename
- Selects an alternate output file (or pipe) for the initial outputdevice, as described above.
FILES
The locations of many Ghostscript run-time files are compiled into theexecutable when it is built. On Unix these are typically based in/usr/local, but this may be different on your system. Under DOS theyare typically based in C:\GS, but may be elsewhere, especially ifyou install Ghostscript with GSview. Run "gs -h" to find thelocation of Ghostscript documentation on your system, from which you canget more details.
- /usr/local/share/ghostscript/#.##/*
- Startup files, utilities, and basic font definitions
- /usr/local/share/ghostscript/fonts/*
- More font definitions
- /usr/local/share/ghostscript/#.##/examples/*
- Ghostscript demonstration files
- /usr/local/share/ghostscript/#.##/doc/*
- Diverse document files
INITIALIZATION FILES
When looking for the initialization files "gs_*.ps", the files related tofonts, or the file for the "run" operator, Ghostscript first tries to openthe file with the name as given, using the current working directory if nodirectory is specified. If this fails, and the file name doesn't specifyan explicit directory or drive (for instance, doesn't contain "/" on Unixsystems or "\" on MS Windows systems), Ghostscript tries directories in thisorder:
- 1.
- the directories specified by the -I switches in the commandline (see below), if any;
- 2.
- the directories specified by the GS_LIB environment variable,if any;
- 3.
- the directories specified by the GS_LIB_DEFAULT macro in theGhostscript makefile when the executable was built. When gs is builton Unix, GS_LIB_DEFAULT is usually"/usr/local/share/ghostscript/#.##:/usr/local/share/ghostscript/fonts"where "#.##" represents the Ghostscript version number.
Each of these (GS_LIB_DEFAULT, GS_LIB, and -I parameter)may be either a single directory or a list of directories separated by":".
ENVIRONMENT
- GS_OPTIONS
- String of options to be processed before the command line options
- GS_DEVICE
- Used to specify an output device
- GS_FONTPATH
- Path names used to search for fonts
- GS_LIB
- Path names for initialization files and fonts
- TEMP
- Where temporary files are made
X RESOURCES
Ghostscript, or more properly the X11 display device, looks for the following resources under the program name "Ghostscript":
- borderWidth
- The border width in pixels (default = 1).
- borderColor
- The name of the border color (default = black).
- geometry
- The window size and placement, WxH+X+Y (default is NULL).
- xResolution
- The number of x pixels per inch (default is computed from WidthOfScreenand WidthMMOfScreen).
- yResolution
- The number of y pixels per inch (default is computed fromHeightOfScreen and HeightMMOfScreen).
- useBackingPixmap
- Determines whether backing store is to be used for saving display window(default = true).
See the usage document for a more complete list of resources. To set theseresources on Unix, put them in a file such as "~/.Xresources" in thefollowing form:
Ghostscript*geometry: 612x792-0+0 Ghostscript*xResolution: 72 Ghostscript*yResolution: 72
Then merge these resources into the X server's resource database:
% xrdb -merge ~/.Xresources
SEE ALSO
The various Ghostscript document files (above), especially
Use.htm.
BUGS
See
http://bugs.ghostscript.com/ and the Usenet news group comp.lang.postscript.
VERSION
This document was last revised for Ghostscript version 8.54.
AUTHOR
Artifex Software, Inc. and artofcode LLC are the primary maintainersof Ghostscript.Russell J. Lang, gsview at ghostgum.com.au, is the author of most of the MS Windows code in Ghostscript.
Index
- NAME
- SYNOPSIS
- DESCRIPTION
- OPTIONS
- SPECIAL NAMES
- FILES
- INITIALIZATION FILES
- ENVIRONMENT
- X RESOURCES
- SEE ALSO
- BUGS
- VERSION
- AUTHOR
This document was created byman2html,using the manual pages.