Need help hacking print filter.

1997-11-18 Thread Dale Scheetz
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?

In addition I get an error message every time I print a postscript file.
The message:

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?

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.

Any ideas will be greatfully accepted.

Thanks,

Dwarf
-- 
_-_-_-_-_-_-  _-_-_-_-_-_-_-

aka   Dale Scheetz   Phone:   1 (904) 656-9769
  Flexible Software  11000 McCrackin Road
  e-mail:  [EMAIL PROTECTED] Tallahassee, FL  32308

_-_-_-_-_-_- If you don't see what you want, just ask _-_-_-_-_-_-_-


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word unsubscribe to
[EMAIL PROTECTED] . 
Trouble?  e-mail to [EMAIL PROTECTED] .


Re: Need help hacking print filter.

1997-11-18 Thread Brian K Servis
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!):

#!/usr/bin/tcsh
# 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
cat /tmp/prt.$$
# clean up
rm /tmp/prt.$$

In addition I get an error message every time I print a postscript file.
The message:

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...

Brian Servis
-- 
Mechanical Engineering  [EMAIL PROTECTED]
Purdue University   http://www.ecn.purdue.edu/~servis


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word unsubscribe to
[EMAIL PROTECTED] . 
Trouble?  e-mail to [EMAIL PROTECTED] .