Creating a free PDFWriter using Ghostscript

This web page provides step by step instructions on how to create a simple but functional PDF Writer on Windows 98/2000/XP using the freely available Ghostscript and RedMon utilities. A PDF Writers is a virtual printer that allows you to "print" (i.e. create) PDF files from your applications. There are quite a few steps and these instructions are not for novice computer users. The steps below where captured on a Windows XP system and they may vary under Windows 98 or 2000.

This process through which the conversion from document to PDF file happens is as as follows:

Document → Virtual Postscript Printer → RedMon → Ghostscript → GS pdfwrite device → PDF file

The steps required to get this to work are:

    1. Download  Required Packages.
    2. Install Ghostscript.
    3. Install GSview (optional).
    4. Install RedMon.
    5. Create the Ghostscript Options File.
    6. Create the Virtual PDF Printer.
    7. Configure the Virtual PDF Printer.
    8. Configure the RPT1: Port.
    9. Print a Test Page.
I'd appreciate any feedback and comments on this page and these instructions. Send feedback to .

The first step is to download the Ghostscript and RedMon software package. A companion package called GSview is not needed, but it may be a good idea to install both since GSview is a graphical interface to Ghostscript. At the time of this writing the Ghostscript package was at version 8.14 and the GSview package was at version 4.6. Click here and download the files called gs814w32.exe (needed) redmon17.zip (needed, click to download) and gsv46w32.exe (optional). For Windows 7, Vista and XP SP3 use redmon 1.9 (the instructions below assume the use of RedMon 1.7, but most users will want to use Redmon 1.9 and will have to adjust accordingly). Note: the file names will be different for newer versions of the programs.


Synopsis: We install Ghostscript to the folder C:\gs. We note the version number.

Double click on gs814w32.exe:

and click on Setup:

Note the version number the Ghostscript we are installing in this case it is 8.14 (you may need this later). Select the where you want to install the program under the Install to Directory. If you are not sure what to place here, leave the default C:\gs. All directions below presume Ghostscript was installed in C:\gs. You need to adjust all instructions for the actual installation path you choose. Make sure Install Fonts is checked. Click on Install to proceed. If no error messages appear, Ghostscript is now installed. The setup file gs814w32.exe can now be deleted (though you may want to wait until you know the entire setup is working).


Synopsis: We install the optional package GSview using the default setup options.

We now install GSview, a GUI front end for Ghostscript. GSview useful for previewing Postscript (and EPS and  PDF) files using Ghostscript. Double click on gsv46w32.exe:

and click on Setup:

Proceed by clicking repeatedly on Next leaving the default options as they are until you reach the last screen:

Click on Finish and then on Exit. GSview will now be installed. You can find it under the Start Menu folder Ghostgum. You can now delete the file gsv46w32.exe.


Synopsis: We extract RedMon into the C:\gs\redmon folder and install it.

RedMon is the utility that will enable you to convert Ghostscript into a virtual printer that creates the PDF files. We need to extract the redmon17.zip archive into the C:\gs\redmon folder and install RedMon. The following instruction will work on Windows XP, but not earlier versions of Windows since those do not have build-in ZIP archive extraction. If you need a utility to extract ZIP files I recommend IZArc (freeware). Extract the ZIP archive to C:\gs\redmon and go here to continue.

Click on Next and this window will appear:

Enter C:\gs\redmon under Files will be extracted to this directory:.Click on Next to proceed.

Make sure the Show extracted files is checked and click on Finish.

The following folder should appear. Note: The folder may look different depending on how Windows XP is configured to display folders.

Double-click on setup.exe:

and click on Yes:

and then on OK to finish. If all goes well RedMon will be installed on your computer. You can now delete the file redmon17.zip. Do not delete the C:\gs\redmon folder!


Synopsis: We create the Ghostscript Options file pdfwrite.txt that specifies the type of PDF file we want to create.

Now we need to create an options file pdfwrite.txt which will tell Ghostscript what kinds of PDF file we want to create.  Start the Notepad program usually found in Start > Programs > Accessories menu folder and enter the following:

Alternatively download the above pdfwrite.txt file from here. Note that the path (the first line) must be correct for the version of Ghostscript you installed. Change the 8.14 to whatever version number  you noted when you installed Ghostscript. European users should change the paper size from letter to a4. The PDF compatibility level 1.4 will create PDF files that can be displayed with Acrobat Reader 5 or later. Use compatibility level 1.2 to create file Acrobat Reader 3 or later can display. This file is read every time a PDF file is created and it can be changed at any time to suit your needs.

Note: If your path names contains spaces you will need to put quotes around the paths specification C:\gs\gs8.14\lib;C:\gs\fonts. Thanks to Jonathan Sefton for pointing this out.

The PDFSETTINGS=/prepress option creates high quality PDF files at the expense of space (this is often visible in images). Other options are /printer, /ebook and /screen which will create smaller PDF files at the expense (mainly) of  image quality. For more information on what options are available see here:  http://www.cs.wisc.edu/~ghost/doc/cvs/Ps2pdf.htm.

Note: A good option to add may be to add auto-page-orientation. Add:

-dAutoRotatePages=/PageByPage (or /All)

to enable it. This will auto-rotate the pages to landscape when necessary. See the Ps2pdf link above for more information. Thanks to John Harald Apeland for suggesting this.

Save the options file File > Save as pdfwrite.txt into the C:\gs folder:


For Windows 98 click here to continue.


Synopsis: We create a redirected port RPT1: and associate a color PostScript printer to this new port.

We now create the virtual PDF printer. We need to run the Add a printer Wizard found in the Windows Printers control panel:

Click on Next:

and make sure the Local printer attached to this computer option is checked and all other items are unchecked. Click on Next:

and select Create a new port and choose Redirected Port as the Type of Port.

Click on Next and

accept the default Port Name of RPT1: by clicking OK. Select the default printer to associate with this port.

Select the HP printer HP Color Laserjet 4550 PS. Even if you do not own this printer select this choice. Certain other (but not all)  printer selection will work here. Important is that printer be a color PostScript printer. Some printers seem to give better font quality output then others. I have had good success with this one. Under Windows 2000 select the HP C LaserJet 4500-PS printer. Click on Next until you must name your printer:

Name the printer GS PDFWriter and you probably do not want it to be your default printer. Click on Next and Next again on the Printer Sharing page until you reach the Print Test Page dialog box:

Make sure you do not print a test page. Click on Next and then Finish to actually install the printer.


Synopsis: Configure the newly created  virtual PDF printer.

Find the newly created GS PDFWriter printer in the Printer and Faxes control panel. Right-click on it and select Properties:

Select the Advanced tab:

and select Print directly to the printer (this prevents spooling the PDF output to the disk twice). Now select the Device Settings tab:

and set Send CTRL-D After Each Job to No. Also change the Wait Timeout to 1 seconds:

These two Device Settings modifications avoid the

ERROR: undefined

OFFENDING COMMAND:_

STACK:

error message that some user report on the last page of the PDF output. Thanks to David Taft and Brent Powers for suggesting this solution.


Synopsis: Configure the newly created RPT1: port to use Ghostscript to create PDF files.

Select the Ports tab of the GS PDFWriter printer control panel:

and click on Configure Port...:

and fill out the dialog box as shown above. Make sure the program path C:\gs\gs8.14\bin\gswin32c.exe points to the gswin32c.exe executable. Change version 8.14 in the path to match the version that was actually installed. Make sure the Arguments for this program are: as indicated above (listed here again for reference and easy cut-and-paste):

@C:\gs\pdfwrite.txt -sOutputFile="%1" -c .setpdfwrite -f -

Note the dash at the end of the line and the period at the beginning of ".setpdfwrite". The path name after the "@" points to the options file pdfwrite.txt we created above. The Output: needs to be Prompt for filename, the Printer: is irrelevant and the Run: box should say Hidden. Click on OK when done.

Note: It may be necessary to check the Run as User box if the user's credentials are necessary to access required resources. For example, writing the PDF file to a network drive may require the users permissions. Thanks to Bryan Wilson for pointing this out.

Note: For Windows 7 (and anyone using RedMon 1.9), please make sure the "Output" field is set to "Program handles output:" and additional check "Run as User". See here. Thanks to Heinrich Bauer for this information when using RedMon 1.9.

Note: If your path names contains spaces you will need to put quotes around the path C:\gs\pdfwrite.txt. Thanks Jonathan Sefton for pointing this out.

Note: You can modify the port argument to "-sOutputFile="%1.pdf". This will, by default, add the .pdf extension to the output filename. Thanks to Justin S. Cohen for pointing this out.


Select the General tab from the GS PDFWriter Properties page:

and select Print Test Page

and, hopefully, a dialog box prompting you for the file name of the PDF file should open. Enter a file name with the .pdf file extension (the program does not automatically add it), select a location and print (i.e. create) the PDF file. View the newly create PDF file (in this case test.pdf) with a PDF viewer.

Note: If the color on the PDF output file is wrong (i.e. the black is not black), remove all the Color Profiles in the Color Management tab of the GS PDFWriter printer.


If everything work correctly your PDFWriter is now functional. You can create a PDF file by selecting the GS PDFWriter printer from any applications that can print a file. Please let me know if you succesully used these instructions to create a Ghostscript based PDFWriter. Email me at .


This page is Copyright 2004 by Henrik Schmiediche.