How to print postscript files?

Hi, I am looking for a quick answer. How to print postscript files by using gs command? Let's say the HP printer's hostname is pname and the document name is pfile. The OS is RHEL 4 with cups enabled. I've read gs man but didn't get it well.

Thank you in advance!

Printing PostScript files
Printing PostScript files on a printer that has a PostScript interpreter is simple; just use lpr, and the printer will take care of all of the details for you. For those of us that don't have printers with PostScript capabilities, we have to resort to other means. Luckily, there are programs available that can make sense of PostScript, and translate it into a language that most printers will understand. Probably the most well known of these programs is Ghostscript.
Ghostscript's responsibility is to convert all of the descriptions in a PostScript file to commands that the printer will understand. To print a PostScript file using Ghostscript, you might do something like

$ gs -dSAFER -dNOPAUSE -sDEVICE=deskjet -sOutputFile=\|lpr thesis.ps

[/INDENT]
Notice in the above example that we are actually piping the output of Ghostscript to the lpr command by using the -sOutputFile option. Ghostview is an interface to Ghostscript for the X Window System. It allows you to preview a PostScript file before you print it. Ghostview and Ghostscript can both be swiped from ftp://prep.ai.mit.edu/pub/gnu/.

1 Like