How to use Ghostscript
Table of contents
This document describes how to use the command line Ghostscript client. Ghostscript is also used as a general engine inside other applications (for viewing files for example). Please refer to the documentation for those applications for using Ghostscript in other contexts.
The command line to invoke Ghostscript is essentially the same on all systems, although the name of the executable program itself may differ among systems. For instance, to invoke Ghostscript on unix-like systems type:
Here are some basic examples. The details of how these work are described below.
To view a file: You’ll be prompted to press return between pages.
To convert a figure to an image file:
To render the same image at 300 dpi:
To render a figure in grayscale:
To rasterize a whole document:
There are also a number of utility scripts for common to convert a PostScript document to PDF: The output is saved as file.pdf.
There are other utility scripts besides ps2pdf. including pdf2ps. ps2epsi. pdf2dsc. ps2ascii. ps2ps and ps2ps2. These just call Ghostscript with the appropriate (if complicated) set of options. You can use the ‘ps2’ set with eps files.
Ghostscript is capable of interpreting PostScript, encapsulated PostScript (EPS), DOS EPS (EPSF), and Adobe Portable Document Format (PDF). The interpreter reads and executes the files in sequence, using the method described under «File searching » to find them.
The interpreter runs in interactive mode by default. After processing the files given on the command line (if any) it reads further lines of PostScript language commands from the primary input stream, by the keyboard, interpreting each line separately. To quit the interpreter, type » quit «. The -dBATCH -dNOPAUSE options in the examples above disable the interactive prompting. The interpreter also quits gracefully if it encounters end-of-file or control-C.
The interpreter recognizes many options. An option may appear anywhere in the command line, and applies to all files named after it on the line. Many of them include » = » followed by a parameter. The most important are described in detail here. Please see the reference sections on options and devices for a more complete listing.
Help at the command line: gs -h
You can get a brief help message by invoking Ghostscript with the -h or -? switch, like this:
The message for that shows version of the Ghostscript executable:
- the version information and release
- the general format of the command line
- a few of the most useful options
- the formats it can interpret
- the available output devices
- the search path
- the bug report address
On other systems the executable may have a different name:
Короткий опис статті: hp printer error 0xc18a0001
Джерело: How to use Ghostscript