Skip to content

Month: February 2014

printing postscript images to printer with gv (ghostview) as backup to evince

Bruce installed the gv package for viewing and printing postscript.  It works great for viewing.  For printing, it has problems.  Bruce developed this workaround (with a few mods by Joel):

‘gv’ uses the ‘lpr’ command, and if a printer as set as the default in CUPS it will use that printer automatically.  You can hear the printer warm up, but nothing comes out of the printer.

Fortunately ‘gv’ is packaged with a set of file conversion utilities,
including ‘ps2pdf’.  On the command line you can issue this command:

# ps2pdf xxx.ps – | lpr

and that will convert the ps file to pdf (version 1.4) before sending it to lpr.  (You can also convert in place – ie turn your postscript file into a pdf on disk with ps2pdf, and then send the pdf to the printer whenever you want.)

To print a ps on the fly, though:
gv’s print command dialog window has a typein labeled ‘print command’
and it’s automagically populated with the string ‘lpr’.  However you
can change that string to ‘ps2pdf %s – | lpr’.  You can also change
the default print string from ‘lpr’ to whatever you want in
GhostScript options, but that would break printing of non .ps Here’s.

To change the default print string in ‘gv’, select:

State->Setup Options

… Look for the Print Command field, and change the value from
‘lpr’ to ‘ps2pdf %s – | lpr’ (w/o the single quotes).

The change is saved to ~/.gv as the line:

GV.printCommand:        ps2pdf %s – | lpr

 

–bruce via joel