Ghostscript has several main uses:
An example of a very simple PostScript file is:
%! /Helvetica findfont 72 scalefont setfont 72 72 moveto (Hello, world!) show showpageThe first line is a PostScript comment. It is ignored by the PostScript interpreter, but enables other programs to recognise that the file contains PostScript commands. The second line says to find the Helvetica font, scale it to 72 points high (1 inch) and then set it as the current font. The third line moves the current point to 1 inch in from the left and bottom edges of the page. The fourth line draws the text into the page bitmap at the current point. The final line causes the page bitmap to be output to paper or the display.
The information below assumes the use of Windows 95 or NT, but Windows 3.1, OS/2 and Unix are similar.
c:\gs3.53\gswin32.exe -Ic:\gs3.53;c:\gs3.53\fontsThe -I option tells Ghostscript to look for its configuration files and fonts in the two directories listed. After Ghostscript starts it will display
Aladdin Ghostscript 3.53 (1996-1-10) Copyright (c) 1995 Aladdin Enterprises, Menlo Park, CA. All rights reserved. This software comes with NO WARRANTY: see the file PUBLIC for details. GS>Ghostscript is now waiting for you to tell it what to do. Typing (example.ps) run will produce
GS>(example.ps) run Loading NimbusSansL-Regular font from C:\gs3.53\fonts\n019003l.gsf... 1758852 452265 1300076 12334 0 done. >>showpage, press <return> to continue<<An image window will appear with the text "Hello, world!" near the bottom. You will need to scroll down to see it. When you have finished viewing the image window, switch to the text window and press the <return> key. You will be returned to the GS> prompt. Type quit to close Ghostscript.
GS>quitIf the file is not in the current directory, then you will need to give a full path. You must use forward slashes to separate directory names - do not use MS-DOS back slashes. For example, (c:/gs3.53/example.ps) run.
So now you know how to display a PostScript file. Some example PostScript files that come with Ghostscript are colorcir.ps, chess.ps and tiger.ps. These should be in the c:\gs3.53 directory.
c:\gs3.53\gswin32.exe -Ic:\gs3.53;c:\gs3.53\fonts -sDEVICE=djet500The output will be sent to the default printer queue. For the Windows and OS/2 version, this does not happen until Ghostscript exits. Ghostscript will come up with the GS> prompt again, we give it a file name, and after processing each page it will pause. This is probably undesirable. A better way to start Ghostscript is:
c:\gs3.53\gswin32.exe -Ic:\gs3.53;c:\gs3.53\fonts -sDEVICE=djet500 -dNOPAUSE example.ps -c quitThis tells Ghostscript not to pause after each showpage, to interpret the file example.ps and afterwards to exit. This is much more useful.
To get a list of available printer devices, start Ghostscript for displaying, then type:
GS>devicenames ==What if the printer isn't on the default queue? The destination for the printed output can be specified on the command line. To output to the file c:\out.prn, add -sOutputFile="c:/out.prn" somewhere before the name of the PostScript file. To output to a Windows 95 queue named HP DeskJet Portable Printer, use -sOutputFile="\\spool\HP DeskJet Portable Printer". Get the spelling exact or it won't work. For Windows 3.1 or Win32s, to output to port LPT2:, use -sOutputFile="LPT2:"
A similar program called GV exists for X11 on Unix or VMS.