Printing for the PostScript-Challenged

Printing for the PostScript-Challenged

Earlier in this chapter, we talk about PostScript, the fabulously complicated printer language that enables you to print fabulously complex documents on PostScript printers. But what if you don’t have a PostScript printer?

These days, the short answer is “Get one.” Although PostScript printers used to cost much more than other kinds of printers, these days you can buy a perfectly decent PostScript laser printer for less than $500. Nonetheless, there are still lots of PostScript-free sites, where Ghostscript comes to the rescue.

Ghostscript is a free, GNU version (see Chapter 2) of PostScript, written by L. Peter Deutsch, a skillful programmer from way back who surely should have been doing something else when he wrote it. When Ghostscript runs, it reads its PostScript input from either a file or the keyboard (not very useful unless you’re trying to learn PostScript) and produces its output on one of a zillion possible output devices. If you want to see what the PostScript document looks like, you can tell it to send its output to an X Windows system window. If you want to print the document, you can send its output to your printer.

Printing PostScript with Ghostscript

If you’re lucky, your system manager installed Ghostscript so that it’s semi-automatically called when you print a PostScript file. You typically use the -v flag, something like this:

lpr -v

Failing that, in order to run Ghostscript, you type its name (gs) and the name of the PostScript file to display:


If you just type that line, Ghostscript opens a new X window and displays ┬áthe first page of in that window — probably not what you want. Press Ctrl+C once or twice to stop Ghostscript from displaying the page in a window. To get Ghostscript to do something useful, you have to use switches — lots and lots of switches:

gs -sDEVICE=deskjet -dNOPAUSE -sOutputFile=floogle.lj

What’s going on here is that we set the output device (DEVICE) to a popular ink-jet printer. We tell it not to pause between pages, we tell it what output file to create and which PostScript file to print, and then we give it another file from the Ghostscript library ( The file contains a one-line command, which tells Ghostscript that it’s finished. You can tailor this command as needed; run gs -h to see the available printers.

We expect that you find this subject a wee bit complicated. In practice, unless your system manager has set up Ghostscript to run automatically, your best bet is to find a local expert who can tell you the exact command to use. Lacking an expert, you can still look at PostScript on-screen by using a slick little program named Ghostview.

 Python   SQL   Java   php   Perl 
 game development   web development   internet   *nix   graphics   hardware 
 telecommunications   C++ 
 Flash   Active Directory   Windows