Printing PostScript Files
QUESTION: How do I print a PostScript file from within IDL?
ANSWER: You must close the PostScript file before you try to print it. If you forget this, you will spend a lot of time looking at a busy printer with nothing to show for it.
Many people on UNIX machines try to create and print PostScript output by typing commands similar to these:
SET_PLOT, 'PS' DEVICE, FILENAME='myplot.ps' PLOT, data $ lpr myplot.ps
Unfortunately, these commands will cause a file named "myplot.ps" to be created and the graphic plot will be loaded into it, but the plot will never print. (Although the printer will actually process the file.) The reason for this is that a PostScript page doesn't get ejected from the printer until a PostScript "showpage" command is executed. And this command is not placed in the PostScript file by IDL until the PostScript file is closed by using the CLOSE_FILE keyword to the DEVICE command or by exiting IDL. The correct sequence of commands to print a PostScript plot from within IDL is more like this:
SET_PLOT, 'PS' DEVICE, FILENAME='myplot.ps' PLOT, data DEVICE, /CLOSE_FILE $ lpr myplot.ps
Printing from Windows Computers
It is sometimes more difficult to print PostScript files from Windows computers. Many PC users download the shareware program GhostScript to both view and print IDL PostScript files. GhostScript is available for most computers at little or no cost and is the way most people view their PostScript files on their displays.
Copyright © 1996-2006 David W. Fanning
Last Updated 16 January 2006