Creating PDFs, free and open-source, with Ghostscript.


For a file that's an open standard, according to the developer, PDF (Portable Document Format) creation is often not easy for the end user. Case in point: Even big bad Microsoft backed off plans to incorporate "Export to PDF" capability because of disagreements with Adobe.

Today, there are a few free and low cost options out there. I personally haven't tried a product like PrimoPDF. In fact, from what it seems to offer - it may seem to good to be true, but definitely worth a look. However, I'm more comfortable with my free, open-source solution.

Using this "hack" to have Ghostscript create PDFs for you is nothing new. For me though, I've always just done this on a Linux machine. I've never bothered trying it with Windows.

You don't need one physically installed, but we need to convince Windows that we have a PostScript capable printer configured on our system. To do this, go into your control panel, select printers, and add printer. Tell Windows this will be a local printer. If asked, go ahead and select using LPT1: even if something else is using that port. Once you click next at this point, you should be prompted with the list of supported printers built into Windows.

Here's a part that's up for debate. I'm sure there is some purely PostScript compatible printer out there. I've seen many suggestions, including Apple Printers and the Microsoft Publisher options under the "Generic" category. I am currently having the most luck with the HP LaserJet 8150. The other ones sometimes cause me conversion errors, but with the HP LaserJet 8150, it's been smooth sailing. Your mileage may vary.

Now let's install GhostScript. Go to the website, download and install the most recent stable version. Once that's done (and this is key) you'll need to configure your Windows environment path settings to include a few directories that were installed. For me, I installed version 8.54. The paths that I needed to add were C:\Program Files\gs\gs8.54\bin and C:\Program Files\gs\gs8.54\lib.

Right click on "My Computer" and then select properties. Click on the advanced tab. Down near the bottom you should see "environment variables" - click on it. You'll see this screen.

Click on the line with "Path" and then select "Edit"

Paste in the complete two paths (bin and lib as mentioned above) separated by a semicolon. (Indicated in image).

That's it for installation. To test it out, bring up almost any program that can send a document to the printer. Select your "mock" HP LaserJet 8150 (or whatever printer you selected). Select the "Print to file" option (not all programs will let you do this). Once you click "Print" - a dialog will display asking you where to save this file. Remember where you save it and what you name it.

This will generally save a file with the extension of ".prn" - you'll have to rename this to something with an extension of ".ps" (for postscript). I'm assuming you know how to do this; you're not always able to do this with a default Windows extension.

After that, you can right-click on the ".ps" file, click the "Open With" option - and navigate to the lib directory of GhostScript. In my case, it's C:\Program Files\gs\gs8.54\lib. You'll see a series of batch files called ps2pdf. Any of them will work, the only real difference is which PDF standard they adhere to, but any one of them will output content compatible with today's readers. On the "Open With" screen, feel free to select the "Always use this program" option. This way, the next time you right click on a ".ps" file, everything will be ready to go.

You can even automate the process further by creating a batch file to rename the file to a ".ps" file and send it directly to the desired ps2pdf command.