Ghostscript Help

Overview

  1. Convert each of your word-processor documents into a PostScript file.
  2. Make a “command file” containing all the commands and information needed by Ghostscript to combine and convert your multiple PostScript files into one .pdf file.
  3. Run Ghostscript, telling it to look in the “command file” for additional instructions.

Instructions

Convert each of your word-processor documents into a PostScript file

Note that when you follow the steps outlined on the web-page above, you will end up with a bunch of files ending with the extension “.prn” (short for “printer”). These are PostScript files (meaning that they contain printer instructions written in the PostScript language). From here on out, they will be referred to as “.prn” files.

Install a PostScript printer driver

What you are doing here is installing the software that Windows uses to talk to a printer (that’s what a “printer driver” is.) Instead of sending the printer instructions (put a blob of black here, there, and there) to a physical printer attached to your machine, the instructions are saved to a file. So now you have a file that says “put a blob of black here…”. That file can be opened and read by lots of different programs which can convert printer instructions into “screen instructions” (“put a 10 pixels of black in the upper left corner…”).

Note: The details of installing a printer vary slightly from one version of Windows to another. The instructions below are general. For more detail, read the Windows help files, or the manual. (You do know where your manual is, right?)

  1. Click on the Start Button
  2. Go to “Settings”
  3. If “Printers” doesn’t appear in the Settings sub-menu, click on “Control Panel,” and “Printers” should appear within the Control Panel
  4. Look for the icon labelled “Add Printer”
  5. Double click on the “Add Printer” icon
  6. You will be asked a bunch of questions about the new printer you’re installing. We won’t try to answer them all here, but we’ll cover the important ones:
    1. This should be a “local”, not “network printer
    2. The printer we recommend choosing is the “Apple LaserWriter Pro 600.” Note:There are several other printer drivers that are worth experimenting with if your .ps/.prn files don’t look correct when you open them in GhostView: Adobe Generic PostScript Printer Driver for Windows, and for Mac. If you have color images, you may want to try the “Apple Color LW 12/660 PS” or some other PS printer driver with the word “color” in its name (e.g., some of the HP printers).
    3. When you are asked what port this printer will connect to, tell it to use “FILE” (i.e., it will print to a file rather than an actual printer).
    4. Do not set this as the default printer for your system…unless you really want to.
Convert your word processor file to PostScript format
  1. With your document open in your wordprocessor program, tell the program to print your file.
  2. When the program asks you which printer to use, select the “Apple LaserWriter Pro 600” which you installed earlier.
  3. If you didn’t specify that the printer should use the “FILE” port when you installed it, tell the wordprocessor that you want to print your document to a file (look for the “print to file” option).MS Print
  4. After you click on “OK”, you will be asked to name the file that will be generated by the printing process. Please follow the instructions below about putting numbers at the beginning of your file names. Please do not put any spaces in the filename. The file generated by this process will have the suffix “.prn” (printer). There is no need to remove or change this suffix. This file contains instructions for printers written in the PostScript language.
  5. Repeat the conversion process for all the files you have

Making a working directory

  1. Make a new directory where you will do all the following work
  2. Copy (DON’T MOVE) the .prn files to this new directory

Making a “command file”

The “command file” contains all the commands and information needed by Ghostscript to combine and convert your multiple .prn files into one .pdf file.

  1. In your new working directory, create a new text file. Call it anything you like; we recommend “gscommands.txt.” We will refer to this file as the “command file” from here on out.
  2. Open your new “command file,” and insert the following text (all one line):
    -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=<name of the final pdf file> -dBATCH <name of the first .prn file> <name of the next .prn file> … <name of the last .prn file>For example:
    -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=myThesis.pdf -dBATCH abstract.prn “title page.prn” approval.prn dedication.prn “table of contents.prn” “chapter 1.prn” “chapter 2.prn” conclusion.prn “references cited.prn” 

    Note: If the name of a file has a space in it (e.g., “title page.prn”), you need to put quotation marks around it. If the filename doesn’t have a space in it, you don’t need quotation marks.

    All the information in the “command file” needs to go on one line. A lot of text editors/word processors/etc. will wrap the line around for you if you have “word wrap” turned on, so it will look like multiple lines. Turn off word wrap, or turn on “view hidden symbols” or “view codes” or whatever you have to do to make sure there are no returns/line-feeds/new-lines/new paragraphs anywhere in the text of the command line.

    Suggestion:
    Make life easier on yourself. When you are converting your wordprocessor files into .prn files, don’t put any spaces in the names of the .prn files. Even better, name them as numbers. If you do this, you can change the text in the “command file” to:

    -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=myThesis.pdf -dBATCH 1.prn 2.prn 3.prn 4.prn 5.prn

    Who knows, maybe this is more trouble than it’s worth. That’s up to you.

  3. Save your modified “command file.” You can close it or leave it open to edit it further if necessary. Remember to save it again if you make and subsequent changes.

Run Ghostscript, telling it to look in the “command file” for additional instructions

  1. Open a DOS command prompt
  2. Telling your computer where to find Ghostscript (i.e., put Ghostscript on your “path”)
    1. Find out where Ghostscript has been squirreled away on your system, and find its “program file directory” where the “bin” (binary) and “lib” (library) directories are stored.
      For example:
      C:\Program Files\gs\gs7.00\bin
      C:\Program Files\gs\gs7.00\lib
      or
      C:\gs\gs7.00\bin
      C:\gs\gs7.00\lib
      In the above case the “program file directory” is “C:\gs\gs7.00”
    2. Finding out the name of the Ghostscript program file: Look in the the “bin” directory you found in the previous step. The program file is probably called something like: “gswin32.exe”. You’ll need to remember this for later. We’ll refer to it as the “Ghostscript command”.
    3. Tell DOS how to find these directories by typing the following command:SET PATH=%PATH%;<program file directory>\bin; <program file directory>\lib
      replacing <program file directory> with the name of the “program file directory”, which you determined in the previous step. Note that you need to put quotations around a directory name if it has any spaces in it. For example: “C:\Program Files\gs\gs7.00\bin”.
      For example:
      SET PATH=%PATH%;”C:\Program Files\gs\gs7.00\bin”;”C:\Program Files\gs\gs7.00\lib”
      or
      SET PATH=%PATH%;C:\gs\gs7.00\bin;C:\gs\gs7.00\libNote: At this point, you can test to see if your modification of the “path” has worked. Type the following command:
      echo %PATH%
      and DOS should respond by showing you all the different directory names stored in the PATH variable. The ones you just added should appear at the end. If they don’t, try again. If they still don’t you should probably contact us for help. 

      Different versions of DOS work slightly differently. Consult your DOS documentation for full (yeah, right) details, and contact us if you have any questions.

Navigating your already-open DOS command prompt to your working directory

Use the “cd” (change directory) command as follows:

cd <full path name of your new working directory>

For example: cd “c:\personal files\gradschool\dissertation\tempPDFoutput”

Run Ghostscript

Execute the “Ghostscript command” and tell it to use your “command file” in the following way:

<Ghostscript command> @<name of your command file>

For example: gswin32.exe @gscommands.txt
Once you do this, a new window will open up. This is the ghostscript console. It will rapidly scroll through a bunch of messages as it processes your files. You don’t have to pay any attention to them or the window itself. The window will close of its own accord.

Check to see if everything worked correctly

  1. Click your “working directory” window
  2. Check if your pdf file was created
  3. Open it to see if it was created correctly

Congratulate yourselfSmiley