[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: hptools and magicfilter



Mario Filipe writes:
>
>
>Hi
>
>A couple of days ago, I had a HP660C installed on my Linux box. Installed 
>magicfilter, enscripts, lprng,... . First question : I chose to use the
>550C filter. Is there any filter more recent than that ?
>
>After printing some test pages and seeing that everything was ok i saw
>that the printer was always printing in high quality. Since most of the
>work doesn't need that quality i started to think about a way to tell the
>printer to print in econofast mode. Looking through the debian list mails
>my colleague found someone (sorry don't remember your name) that mentioned
>hpset. We asked him about where to get it and got it. Apparently hpset
>works but I still couldn't get econofast to work. After relooking into
>hpset docs I saw that they mentioned something about filters and so i
>tried but to no avail. I'll show you my printcap file, and explain what i
>was trying to do. Basycally I wanted to have 2 different names for the
>same printer. One printing in high quality and the other for the lowest
>quality :
>
>My printcap :
>
>lp|dj|hpdj660c|HP Deskjet 660C:\
>        :lp=/dev/printer:sd=/var/spool/lpd/hpdj660c:\
>        :sh:pw#80:pl#72:px#1440:mx#0:\
>        :if=/usr/sbin/dj550c-filter:\
>        :af=/var/log/lp-acct:lf=/var/log/lp-errs:
>
>lpecono:\
>        :lp=/dev/printer:sd=/var/spool/lpd/hpdj660c:\
>        :sh:pw#80:pl#72:px#1440:mx#0:\
>        :if=/etc/myfilter:\
>        :af=/var/log/lp-acct:lf=/var/log/lp-errs:
>
>The myfilter file looks 
>
>#!/bin/sh
>hpset -o stdout econo
>/usr/sbin/dj550c-filter
>

That person was me.  

I think the problem is that the stdin to your myfilter, which can be
anything, and the stdout from hpset, which is hp escape codes, are not
of the same format and probably get misinterpreted by magicfilter and
are probably not even appended to each other.  You need to prepend the
hpset output to the processed stdout of ghostscript and send them to
stdout as one unit to the printer.  This is my solution:

/etc/printcap:
# econo mode
lpc|djc|hpdj660c|HP Deskjet 660Cse Color Econo:\
        :lp=/dev/lp1:sd=/var/spool/lpd/hpdj660c:\
        :sh:pw#80:pl#66:px#1440:mx#0:\
        :if=/usr/sbin/dj550c-filter:\
        :af=/var/log/lp-acct:lf=/var/log/lp-errs:
# letter quality
lpcl|djcl|hpdj660cl|HP Deskjet 660Cse Color:\
        :lp=/dev/lp1:sd=/var/spool/lpd/hpdj660cl:\
        :sh:pw#80:pl#66:px#1440:mx#0:\
        :if=/usr/sbin/dj550cl-filter:\
        :af=/var/log/lp-acct:lf=/var/log/lp-errs:


/usr/sbin/dj550c-filter:
#! /usr/sbin/magicfilter
#
# PostScript
0       %!              ffilter /usr/local/lib/magicfilter/econogsc $FILE
[rest of filter left out]


/usr/local/lib/magicfilter/econogsc:
#!/usr/bin/tcsh
# called as: econogsc <psfile>
# send hpset hp escape codes to a tmp file
/usr/local/bin/hpset -c econo >! /tmp/prt.$$
# append the ghostscript hp escape codes to that tmp file
/bin/cat $1 | /usr/bin/gs -q -dSAFER -dNOPAUSE -r300 -sDEVICE=cdj550 -sOutputFile=- - >> /tmp/prt.$$
# cat the tmp file to stdout
/bin/cat /tmp/prt.$$
# clean up
/bin/rm /tmp/prt.$$

/usr/sbin/dj550cl-filter:
#! /usr/sbin/magicfilter
#
# PostScript
0       %!              filter  /usr/bin/gs  -q -dSAFER -dNOPAUSE -r300 -sDEVICE=cdj550 -sOutputFile=- - 
[rest of filter left out]


Good luck,
Brian
--
Mechanical Engineering				    servis@purdue.edu
Purdue University		    http://www.ecn.purdue.edu/~servis


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: