SUMMARY: using Ghostscript as print filter

From: Chester Liu <cht_at_rati.pse.umass.edu>
Date: Thu, 22 Jan 1998 10:21:47 -0500 (EST)

Hello, it's time to summarize the helpful responses I got. My
basic question was how do I use ghostscript as a print filter and
how do I configure /etc/printcap and write a filter script.
I'm running DU 4.0B, Ghostscript 5.10, and Epson Stylus Pro.

(I also discuss compiling Ghostscript 5.10 successfully on DU 4.0)

2 people helped me out; what follows are their solutions and my
final result.

------------------------------

 Tom Leitner tom_at_finwal01.tu-graz.ac.at had this suggestion:

Here's my solution for using ghostscript as a print filter. Works like
a charm:

#
# HP Laserjet 5L, Zimmer 41 mit Postscript Filter
#
lpgs|ps:\
        :af=/var/adm/lplog/lpgs.acct:\
        :lf=/var/adm/lplog/lpgs.err:\
        :lp=/dev/lp0:\
        :sh:\
        :of=/usr/local/bin/gsfilter:\
        :sd=/usr/spool/lpgs:


$ cat /usr/local/bin/gsfilter
#!/bin/sh
device=ljet4
res=600
#ff=/tmp/gs$$.fifo
CMD_ENV=bsd; export CMD_ENV
trap 'rm $ff; exit 1' 1 2 3 4
#
# reset laserjet with ESC-E
#
/usr/bin/echo -n \\033\\0105
#
# call gs
#
/usr/local/bin/gs -q -dNOPAUSE -sDEVICE=$device -r$res \
             -sPAPERSIZE=a4 -sOutputFile=- -
#cat $ff
#rm $ff
exit 0

Note that you can't use print filters for remote printers! For remote
printers, you'd need to define a printer with lp=/dev/null and
modify the gsfilter script to write the output to the desired physical
printer queue.



---------

Dejan Muhamedagic dejan_at_yunix.com had this solution:

This is the filter which works for out hp running pcl:
#!/bin/sh
/usr/local/bin/gs -q -dNOPAUSE -sPAPERSIZE=a4 -sDEVICE=ljet3 \
-sOutputFile=- -
# EOF

and this is the printcap entry:
#
lp2|2|pshp|hpps|ps2pcl:\
        :lf=/usr/adm/lp2err:\
        :sd=/usr/spool/lpd2:\
        :lp=/dev/lp0:\
        :mx#0:\
        :sh:\
        :if=/usr/lbin/ps2pcl:
#


-----------------------------------------------

this is my solution:

/etc/printcap:

color|stylus|colorthru:\
        :if=/usr/spool/printer/lpcolor:\
        :lf=/usr/adm/lperr:\
        :lp=/dev/lp0:\
        :mx#0:\
        :sh:\
        :sd=/usr/spool/lpd/color:


and in my
/usr/spool/printer/lpcolor:

#! /bin/sh
/usr/local/bin/gs -sDEVICE=stcolor -dSoftweave -sOutputFile=- \
-dNOPAUSE -dQUIET -dSHORTERRORS -quiet -sDithering="fscmyk" \
stcolor.ps -



The important thing is the -sOutputFile=- which tells it to pipe out
and the - at the end which tells it to take input from the pipe as well.


Incidentally, I had a lot of trouble compiling Ghostscript 5.10
with the unix-cc.mak makefile. It generated errors trying to compile
one of the PDF-related files. So, I just disabled anything pdf-related
stuff in the makefile and now it works like a charm! Be sure to
read Fontmap.OSF before you start.


The output on the Epson Stylus is beautiful and ghostscript on an Alpha
is orders of magnitude faster than Epson drivers on Windows or Macs!!!!

:)

Chester Liu

cht_at_rati.pse.umass.edu
Received on Thu Jan 22 1998 - 16:23:05 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:37 NZDT