psMonitor: Make PDFs without Adobe Acrobat

GhostScriptAt every IT job I’ve worked, I’ve noticed that the ability to create PDF files in business today is nothing less than an absolute necessity. Even with the pricing of Adobe Acrobat skyrocketing (about $250 per seat), and PDF becoming an open standard, it’s still difficult to find a reliable, totally free method for creating PDF documents.

My father’s company, like most, ran into this issue a couple of years ago. So my brother, who was doing the network management at the time, developed a PostScript monitoring service to convert PostScript files to PDFs; a program he called psMonitor. After some coding and setup, anyone in the office could print to a PostScript file in a specific directory and have it automatically spit out a PDF file. Saved the company nearly $3,000 instantly. The savings in a larger firm could be even more astounding. The full version of Acrobat is still crucial for proper PDF editing and markup, but most of us don’t need that. We just need a simple way to convert files.

What follows here is my guide on how to set up your own psMonitor service so that you too may disown Acrobat!

Before we get started, let’s cover what you’ll need to get this set up.

Requirements:

Part 1: Install GhostScript

GhostScript is a GPL-licensed interpreter based on Adobe’s PostScript and PDF formats. This is what will be doing the grunt work of converting your input PostScript file into the output PDF document.

After downloading GhostScript, run the installer and the WinZip self-extractor should run itself.

GhostScript installer

Then just click Install to install GhostScript to its default location.

GhostScript install location

Part 2: Modify GhostScript

This is really the only “hackerish” step in the whole process. You’ll need to find the gssetgs.bat file in the \lib\ directory underneath GhostScript’s install location. Next, locate this line in the file:

if %GSC%/==/ set GSC=gswin32c

and replace the “gswin32c” with the full path to gswin32c.exe, which should be located in the \bin\ directory of the GhostScript installation. (Note: the path can only be in 8.3 format, no spaces; e.g. C:\Progra~1\…). So it probably will look like this (with all defaults):

if %GSC%/==/ set GSC=C:\Progra~1\gs\gs8.60\bin\gswin32c

Part 3: Install the .NET Framework

Run the .NET installer that you’ve already downloaded to install the Framework. Though you almost certainly already have .NET installed if you’re using a recently-updated Windows XP/2003 machine.

Part 4: Install and Configure psMonitor

Copy the psMonitor.exe and psMonitor.exe.config files to a safe place on your computer (such as C:\WINDOWS). The configuration file can be edited to your liking, it’s in a simple XML format. The sample configuration inside this file is one that I use in our office. I’ve got a folder on the server where the psMonitor folders reside, C:\pdfmon. This is shared on the network as \\servername\pdfmon and added to all machines as a network drive (via a login script).

psMonitor Configuration

psMonitor Configuration

Part 5: Install psMonitor as a Windows service

Installing psMonitor as a service will allow a specific folder to be monitored and polled at regular intervals for any .ps (PostScript) files in the input folder, automatically convert them to PDFs, and move them to the output folder. To install as a service, open the command prompt and navigate to the installation path of the .NET Framework (usually C:\WINDOWS\Microsoft.NET\Framework\(Build version), remember that you want 2.0). When you’ve navigated to the .NET path, run this command (replacing the path with the “safe place” from earlier):

InstallUtil "C:\WINDOWS\psMonitor.exe"

psMonitor service installation

psMonitor Service Installation

Now when you browse to the Services snap-in you should see psMonitor set up as a Windows service. You should now start the service and edit the properties to run it automatically at startup.

Part 6: Setting up a PostScript File Printer

To have any of this be effective, you’ll need to have a special printer added to print to a PostScript file. Go to the Printers dialog and select Add Printer, then Local printer. Under “Use the following port:” select FILE:

Print to file

You’ll then be asked to select a driver. I’d recommend using a driver for a standard printer you already have, so I use the HP LaserJet 5000 Series driver, since we have a couple of those.

Select a print driver

Name the printer something that makes sense, like so:

Printer name

And that’s it! Try printing something like a Word document to your new printer by selecting to print to it. When prompted for where to save the file you’re printing to, select the \\servername\pdfmon\in directory. After a few seconds (if the psMonitor service is running), you should receive your input PostScript file and your output PDF file in the “out” folder!

Please feel free to leave questions in the comments and I’ll address them as soon as I can. Enjoy!

Comments

Leave a Reply