Re: Need help hacking print filter.
Dale Scheetz writes:
>I am printing postscript files to my HP DeskJet using printcap and a gs
>filter. Things work as expected, but I have several minor glitches that I
>can't figure out how to deal with.
>When I print a "plain ascii" file I simply cat the file to the printer.
>The printer defaults to "high quality" print mode, so to save ink I cat a
>set of 4 characters that push the printer into "draft" mode. My problem is
>that I can't figure out how to get the filter to prepend these characters
>to the front of the input stream, so all my postscript files use ink like
>crazy. Is there any way that I can get the characters prepended so that
>postscript files will print in draft mode as well?
I use magicfilter but that is just the wrapper to process various input
file types. For the actual ps filter I first use a program that I found
on sunsite called hptools(/pub/Linux/system/printing/hptools-1.2.3.tar.gz).
It has most of the esc sequences coded into the program and can either
send the codes to stdout or directly to the port. Anyway for printing ps
files you need to send your esc codes to a temp file then concatenate the gs
output for your printer type to that same temp file and then send all
that to stdout. Something like this(it may not be pretty but it works!):
# econo gs filter called as: econogs <source.ps>
#the hptools program
hpset -c econo >! /tmp/prt.$$ # send econo esc codes to tmp file
# send the input file through gs and concatenate to the tmp file
cat $1 | gs -q -dSAFER -dNOPAUSE -r300 -sDEVICE=cdj550 -sOutputFile=- - >> /tmp/prt.$$
# sent the resulting file to stdout
# clean up
>In addition I get an error message every time I print a postscript file.
>Error: /undefinedfilename in (stcolor.ps)
> Operand stack:
> Execution stack:
>appears at the top of the first page (alone thankfully). Is there some way
>to get this error message to the null device instead of the printer?
Well if the above is coming out on stderr then you could trap this and
send to null and the other to stdout. But that is not the best solution.
I am using alladin-gs and am not having any errors. I don't know what
version off hand(not at my machine). Good luck.
>As I said these are fairly minor problems, and I'm sure HP would be happy
>if I couldn't reduce my ink usage, but my prospective use is going to go
>up so I could realy use a solution.
The econo mode makes ps printing about twice as fast! Which makes it much
easier to print more and waste paper.......
Mechanical Engineering firstname.lastname@example.org
Purdue University http://www.ecn.purdue.edu/~servis
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
Trouble? e-mail to email@example.com .