home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / os2 / gspm25.zip / use.doc < prev    next >
Text File  |  1992-09-06  |  17KB  |  463 lines

  1.    Copyright (C) 1989, 1992 Aladdin Enterprises.  All rights reserved.
  2.    Distributed by Free Software Foundation, Inc.
  3.  
  4. This file is part of Ghostscript.
  5.  
  6. Ghostscript is distributed in the hope that it will be useful, but
  7. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  8. to anyone for the consequences of using it or for whether it serves any
  9. particular purpose or works at all, unless he says so in writing.  Refer
  10. to the Ghostscript General Public License for full details.
  11.  
  12. Everyone is granted permission to copy, modify and redistribute
  13. Ghostscript, but only under the conditions described in the Ghostscript
  14. General Public License.  A copy of this license is supposed to have been
  15. given to you along with Ghostscript so you can know your rights and
  16. responsibilities.  It should be in a file named COPYING.  Among other
  17. things, the copyright notice and this notice must be preserved on all
  18. copies.
  19.  
  20. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  21.  
  22. This file, use.doc, describes how to use the Ghostscript language
  23. interpreter.
  24.  
  25. For an overview of Ghostscript and a list of the documentation files, see
  26. README.  
  27.  
  28. ********
  29. ******** How to use the Ghostscript interpreter ********
  30. ********
  31.  
  32. The file name of the Ghostscript interpreter is gs.exe (MS-DOS and VMS) or
  33. gs (Unix).  To run it, you also need some external initialization files:
  34.     gs_*.ps (gs_2asc.ps, gs_dps1.ps,
  35.          gs_fonts.ps, gs_init.ps, gs_lev2.ps, gs_statd.ps)
  36.     sym__enc.ps
  37.     uglyr.gsf
  38.     Fontmap
  39. as well as any other fonts from the Ghostscript distribution (.gsf and
  40. .pfa files).
  41.  
  42. To invoke the interpreter, give the command
  43.     gs <filename1> ... <filenameN>
  44. The interpreter will read in the files in sequence and execute them.
  45. After doing this, it reads further input from the primary input stream
  46. (normally the keyboard).  Each line (i.e. characters up to a <return>) is
  47. interpreted separately.  To exit from the interpreter, type quit<return>.
  48. The interpreter also exits gracefully if it encounters end-of-file.
  49. Typing the interrupt character, e.g., control-C, is also safe.
  50.  
  51. The interpreter recognizes several switches described below, which may appear
  52. anywhere in the command line and apply to all files thereafter.
  53.  
  54. You can get a help message by invoking Ghostscript with
  55.     gs -h
  56. or
  57.     gs -?
  58. This message also lists the available devices.  For a little more
  59. information, a one-line description of each device appears near the
  60. beginning of the file devs.mak.
  61.  
  62. Choosing the output device
  63. --------------------------
  64.  
  65. Ghostscript may be built with multiple output devices.  Ghostscript
  66. normally opens the first one and directs output to it.  To use device xyz
  67. as the initial output device, include the switch
  68.     -sDEVICE=xyz
  69. in the command line.  Note that this switch must precede the first .ps
  70. file, and only its first invocation has any effect.  For example, for
  71. printer output in a normal configuration that includes an Epson printer
  72. driver, you might use the shell command
  73.     gs -sDEVICE=epson myfile.ps
  74. instead of just
  75.     gs myfile.ps
  76. Alternatively, you can type
  77.     (epson) selectdevice
  78.     (myfile.ps) run
  79. All output then goes to the printer instead of the display until further
  80. notice.  You can switch devices at any time by using the selectdevice
  81. procedure, e.g.,
  82.     (vga) selectdevice
  83. or
  84.     (epson) selectdevice
  85. As yet a third alternative, you can define an environment variable
  86. GS_DEVICE as the desired default device name.  The order of precedence for
  87. these alternatives, highest to lowest, is:
  88.     selectdevice
  89.     (command line)
  90.     GS_DEVICE
  91.     (first device in build list)
  92.  
  93. To select the density on a printer, use
  94.     gs -sDEVICE=<device> -r<xres>x<yres>
  95. For example, on a 9-pin Epson-compatible printer, you can get the
  96. lowest-density (fastest) mode with
  97.     gs -sDEVICE=epson -r60x72
  98. and the highest-density mode with
  99.     gs -sDEVICE=epson -r240x72.
  100. On a 24-pin printer, the lowest density is
  101.     gs -sDEVICE=epson -r60x60
  102. and the highest-density 24-pin mode is
  103.     gs -sDEVICE=epson -r360x180
  104.  
  105. If you select a printer as the output device, Ghostscript also allows you
  106. to control where the device sends its output.  Normally, output goes
  107. directly to the printer (PRN) on MS-DOS systems, and to a scratch file on
  108. Unix or VMS systems.  To send the output to a series of files foo1.xyz,
  109. foo2.xyz, ..., use the switch
  110.     -sOutputFile=foo%d.xyz
  111. (For compatibility with older versions of Ghostscript, -sOUTPUTFILE=
  112. also works.)  The %d is a printf format specification; you can use
  113. other formats like %02d.  Each file will receive one page of output.
  114. Alternatively, to send the output to a single file foo.xyz, with all
  115. the pages concatenated, use the switch
  116.     -sOutputFile=foo.xyz
  117.  
  118. On Unix systems, you can send the output directly to a pipe.  For
  119. example, to pipe the output to the command `lpr' (which, on many Unix
  120. systems, is the command that spools output for a printer), use the
  121. switch
  122.     -sOutputFile=\|lpr
  123.  
  124. To find out what devices are available, type
  125.     devicenames ==
  126. after starting up Ghostscript.  Alternatively you can use the -h or
  127. -? switch in the command line, as described above.
  128.  
  129. Device configuration
  130. --------------------
  131.  
  132. Ghostscript is normally configured to expect U.S. letter paper,
  133. although there is a way to make A4 paper the default for certain
  134. printers at compilation time (see devs.mak for details).  To select a
  135. different paper size as the default, use the switch
  136.     -sPAPERSIZE=a_known_paper_size
  137. e.g.,
  138.     -sPAPERSIZE=a4
  139. or
  140.     -sPAPERSIZE=legal
  141. You can use any paper size listed in the table at the beginning of
  142. gs_statd.ps.  (Individual documents can also specify a paper size,
  143. which will take precedence over the one specified on the command
  144. line.)
  145.  
  146. Printing on a Hewlett-Packard DeskJet or LaserJet at full resolution
  147. (300 DPI) requires a printer with at least 1.5 Mb of memory.  150 DPI
  148. printing requires only .5 Mb.  You can select 150 DPI printing with
  149. the command line switch
  150.     -r150
  151.  
  152. On MS-DOS systems using the Borland compiler, if Ghostscript gives
  153. you a 'limitcheck in setdevice' error, it may mean Ghostscript's
  154. standard buffer size wasn't large enough.  Likewise, if Ghostscript
  155. gives you a 'VMerror in setdevice' error, it means the buffer size
  156. was too large.  You can use the -dBufferSpace= switch to set the
  157. buffer size to a different value, e.g.,
  158.     -dBufferSpace=50000
  159. The default value is 25000; the smallest value Ghostscript accepts is
  160. 10000; the largest valid value is 65000.
  161.  
  162. File searching
  163. --------------
  164.  
  165. When looking for the initialization files (gs_*.ps), the files related to
  166. fonts, or the file for the 'run' operator, Ghostscript first tries opening
  167. the file with the name as given (i.e., using the current working directory
  168. if none is specified).  If this fails, and the file name doesn't specify
  169. an explicit directory or drive (i.e., doesn't begin with '/' on Unix
  170. systems; doesn't contain a ':' or begin with a '/' or '\' on MS-DOS
  171. systems; doesn't contain a ':' or a square bracket on VMS systems),
  172. Ghostscript will try directories in the following order:
  173.  
  174.     - The directory/ies specified by the -I switch(es) in the command
  175.       line (see below), if any;
  176.  
  177.     - The directory/ies specified by the GS_LIB environment variable,
  178.       if any;
  179.  
  180.     - The directory/ies specified by the GS_LIB_DEFAULT macro in the
  181.       Ghostscript makefile, if any.
  182.  
  183. Each of these (GS_LIB_DEFAULT, GS_LIB, and -I parameter) may be either a
  184. single directory, or a list of directories separated by a character
  185. appropriate for the operating system (':' on Unix systems, ';' on VMS
  186. systems, ';' on MS-DOS systems).
  187.  
  188. VMS-specific notes
  189. ------------------
  190.  
  191. On VMS systems, the last character of each "directory" name indicates what
  192. sort of entity the "directory" references.  If the "directory" name ends
  193. with a colon, it is taken as referring to a logical device, e.g.:
  194.         $ DEFINE GHOSTSCRIPT_DEVICE DUA1:[GHOSTSCRIPT_14]
  195.         $ DEFINE GS_LIB GHOSTSCRIPT_DEVICE:
  196. If the "directory" name ends with a closing square bracket, it is taken as
  197. referring to a real directory, e.g.:
  198.         $ DEFINE GS_LIB DUA1:[GHOSTSCRIPT]
  199.  
  200. To run Ghostscript with switches, you must type a command like
  201.  
  202.     $ gs "-dNODISPLAY"
  203.  
  204. because the C run time library will convert the command
  205. parameters/arguments to lowercase unless you enclose them in double quotes
  206. which preserves the case.
  207.  
  208. If you are on an X Windows display (for which gs is built), you can do
  209.  
  210.     $ set display/create/node="domain-name"/transport=tcpip
  211.  
  212. For example,
  213.  
  214.     $ set display/create/node="doof.city.com"/transport=tcpip
  215.  
  216. and then run Ghostscript
  217.  
  218.     $ gs
  219.  
  220. If you write printer output to a file and then want to print the file
  221. later, use the "/PASSALL" qualifier to the PRINT command.
  222.  
  223. MS-DOS notes
  224. ------------
  225.  
  226. There are three MS-DOS executables in the standard Ghostscript
  227. distribution:
  228.     - GS.EXE runs on any MS-DOS machine, but is limited to 640K.
  229.     - GS386.EXE runs on any 386 or 486 machine, and will use all
  230. available extended (not expanded) memory.
  231.     - GSWIN.EXE runs under Microsoft Windows 3.n in enhanced
  232. mode, and will use all available memory.
  233.  
  234. If you are running Ghostscript on a MS-DOS machine with a display
  235. that is not EGA/VGA compatible, you must use the Borland compiler.
  236. You must build Ghostscript with the BGI driver as the default, and
  237. you will need the appropriate .BGI file from the Borland Turbo C
  238. library.  (Ghostscript includes the EGA/VGA driver in the
  239. executable.)
  240.  
  241. If you are using the BGI driver, two additional environment variables
  242. become relevant:
  243.  
  244.     BGIPATH - defines the directory where Ghostscript will look for
  245. the appropriate BGI driver.  If BGIPATH is not defined, Ghostscript will
  246. look in the directory defined as BGIDIR in the makefile.  In either case,
  247. if no driver is found in the designated directory, Ghostscript will look
  248. in the current directory.
  249.  
  250.     BGIUSER - a string of the form nn.dname, where nn is a hexadecimal
  251. number giving a display mode and dname is the name of a file containing a
  252. user-supplied BGI driver.  If BGIUSER is defined and the BGI device is
  253. selected, Ghostscript will supply nn as the display mode and will obtain
  254. the driver from the file named dname.
  255.  
  256. Some applications, such as Microsoft Word, require a prologue in front of
  257. the PostScript files they output.  In the case of Word, this is one of the
  258. *.ini files included with the Word distribution.  Other applications may
  259. require other prologues.  These may be specified on the Ghostscript
  260. command line, e.g.,
  261.     gs prologue.ini myfile.ps
  262.  
  263. X Windows resources
  264. -------------------
  265.  
  266. Ghostscript looks for the following resources under the program name
  267. "Ghostscript":
  268.  
  269.     borderWidth - the border width in pixels
  270.         default = 1
  271.     borderColor - the name of the border color
  272.         default = black
  273.     geometry - the window size and placement, WxH+X+Y
  274.         default = ???
  275.     xResolution - the number of x pixels per inch
  276.         default is computed from WidthOfScreen and WidthMMOfScreen
  277.     yResolution - the number of y pixels per inch
  278.         default is computed from HeightOfScreen and HeightMMOfScreen
  279.  
  280. To set these resources, put them in a file (such as ~/.Xdefaults) in the
  281. following form:
  282.  
  283. Ghostscript*geometry:    612x792-0+0
  284. Ghostscript*xResolution: 72
  285. Ghostscript*yResolution: 72
  286.  
  287. Then load the defaults into the X server:
  288.  
  289. % xrdb -merge ~/.Xdefaults
  290.  
  291. Normal switches
  292. ---------------
  293.  
  294.     @filename
  295.         Causes Ghostscript to read filename and treat its
  296.         contents the same as the command line.  (This is
  297.         intended primarily for getting around DOS'
  298.         128-character limit on the length of a command line.)
  299.         Switches or file names in the file may be separated by
  300.         any amount of white space (space, tab, line break);
  301.         there is no limit on the size of the file.
  302.  
  303.     -- filename arg1 ...
  304.         Takes the next argument as a file name as usual, but takes
  305.         all remaining arguments (even if they have the syntactic
  306.         form of switches) and defines the name ARGUMENTS in
  307.         userdict (not systemdict) as an array of those strings,
  308.         *before* running the file.  When Ghostscript finishes
  309.         executing the file, it exits back to the shell.
  310.  
  311.     -Dname=token
  312.     -dname=token
  313.         Define a name in systemdict with the given definition.
  314.         The token must be exactly one token (as defined by the
  315.         'token' operator) and must not contain any whitespace.
  316.  
  317.     -Dname
  318.     -dname
  319.         Define a name in systemdict with value=null.
  320.  
  321.     -Sname=string
  322.     -sname=string
  323.         Define a name in systemdict with a given string as value.
  324.         This is different from -d.  For example,
  325.             -dname=35
  326.         is equivalent to the program fragment
  327.             /name 35 def
  328.         whereas
  329.             -sname=35
  330.         is equivalent to
  331.             /name (35) def
  332.  
  333.     -q
  334.         Quiet startup -- suppress normal startup messages,
  335.         and also do the equivalent of -dQUIET.
  336.  
  337.     -gnumber1xnumber2
  338.         Equivalent to -dDEVICEWIDTH=number1 and
  339.         -dDEVICEHEIGHT=number2.  This is for the benefit of
  340.         devices (such as X11 windows and VESA displays) that require
  341.         (or allow) width and height to be specified.
  342.  
  343.     -rnumber
  344.     -rnumber1xnumber2
  345.         Equivalent to -dDEVICEXRESOLUTION=number1 and
  346.         -dDEVICEYRESOLUTION=number2.  This is for the benefit of
  347.         devices (such as printers) that support multiple
  348.         X and Y resolutions.
  349.  
  350.     -Idirectories
  351.         Adds the designated list of directories at the head of the
  352.         search path for library files.
  353.  
  354.     -
  355.         This is not really a switch.  It indicates to Ghostscript
  356.         that the standard input is coming from a file or a pipe.
  357.         Ghostscript reads from stdin until reaching end-of-file,
  358.         executing it like any other file, and then continues
  359.         processing the command line.  At the end of the command
  360.         line, Ghostscript exits rather than going into its
  361.         interactive mode.
  362.  
  363. Note that gs_init.ps makes systemdict read-only, so the values of names
  364. defined with -D/d/S/s cannot be changed (although, of course, they can be
  365. superseded by definitions in userdict or other dictionaries.)
  366.  
  367. Special names
  368. -------------
  369.  
  370. -dDISKFONTS
  371.     causes individual character outlines to be loaded from the disk
  372. the first time they are encountered.  (Normally Ghostscript loads all the
  373. character outlines when it loads a font.)  This may allow loading more
  374. fonts into RAM, at the expense of slower rendering.
  375.  
  376. -dNOBIND
  377.     disables the 'bind' operator.  Only useful for debugging.
  378.  
  379. -dNOCACHE
  380.     disables character caching.  Only useful for debugging.
  381.  
  382. -dNODISPLAY
  383.     suppresses the normal initialization of the output device.  This
  384. may be useful when debugging.
  385.  
  386. -dNOPAUSE
  387.     disables the prompt and pause at the end of each page.  This may
  388. be desirable for applications where another program is 'driving'
  389. Ghostscript.
  390.  
  391. -dSAFER
  392.     disables the deletefile and renamefile operators, and the
  393. ability to open files in any mode other than read-only.  This may be
  394. desirable for spoolers or other sensitive environments.
  395.  
  396. -dWRITESYSTEMDICT
  397.     leaves systemdict writable.  This is necessary when running
  398. special utility programs such as font2c and pcharstr, which must bypass
  399. normal PostScript access protection.
  400.  
  401. -sDEVICE=device
  402.     selects an alternate initial output device, as described above.
  403.  
  404. -sOutputFile=filename
  405.     selects an alternate output file (or pipe) for the initial output
  406. device, as described above.
  407.  
  408. Debugging switches
  409. ------------------
  410.  
  411. The -Z switch only applies if the interpreter was built for a
  412. debugging configuration (DEBUG=1 or -DDEBUG selected at compile
  413. time).
  414.  
  415.     -A    Turn on allocator debugging (gs_malloc and gs_free).
  416.  
  417.     -e    Turn on tracing of error returns from operators.
  418.  
  419.     -E    Abort when any operator returns with an error.
  420.  
  421.     -Mn    Force the interpreter's allocator to acquire additional
  422.         memory in units of nK, rather than the default (currently
  423.         20K on MS-DOS systems, 50K on Unix).  n is a positive
  424.         decimal integer (not exceeding 63 on MS-DOS systems).
  425.  
  426.     -Zxxx    Turn on debugging printout.
  427.         Each of the xxx characters selects an option:
  428.         if the string is empty, all options are selected.
  429.         Case is significant.
  430.             1 = type 1 font interpreter (type1addpath)
  431.             2 = curve subdivider/rasterizer
  432.             a = allocator (large blocks only)
  433.               A = allocator (all calls)
  434.             b = bitmap image processor
  435.               B = bitmap images, detail
  436.             c = color/halftone mapper
  437.             d = dictionary put/undef
  438.             f = fill algorithm (summary)
  439.               F = fill algorithm (detail)
  440.             g = gsave/grestore[all]
  441.             h = halftone renderer
  442.             i = interpreter, just names
  443.               I = interpreter, everything
  444.             k = character cache
  445.               K = character cache, every access
  446.             l = command lists, bands
  447.               L = command lists, everything
  448.             m = makefont and font cache
  449.             n = name lookup (new names only)
  450.             o = outliner (stroke)
  451.             p = path tracer
  452.             q = clipping
  453.             r = arc renderer
  454.             s = scanner
  455.             t = tiling algorithm
  456.             u = undo saver (for save/restore)
  457.               U = undo saver, more detail
  458.             v = rectangle fill
  459.               V = device-level output
  460.             w = compression encoder/decoder
  461.             x = transformations
  462.             z = trapezoid fill
  463.