Here is the summary of the following Question.
As usual the answer came amazingly quickly: less than 5 mn after I press
SEND, I received the right answer by Dr Marco Luchini
<m.luchini_at_ic.ac.uk> whose I thanks a lot.
But the answer was diretcly at the level of the printer, not at the
filtert level, and since I already had this problem for another printer,
a long time ago, I was interested to have an answer for the filter usage
question. And, evidently, I got it, and this can serve to others.
Here is the question:
>
> I installed on our network a new HP LaserjetColor 4500 DN, wich is a
> print server.
>
> The installation went relatively smooth, and it is visible from our PC
> and Macs, as well from Unixes.
>
> It is a PostScrip machien, and if we sent it a non postscript text file,
> it print it, but the carriage return is not done, only the line feed.
> Thus I wrote a small filter to add the CR and it is OK, But... it is OK
> if I apply the filter manually (or via a script), but if I put this
> filter as the if or of entry in the printcap, the filter is not applied.
>
> I thought (I understood...) that the role of these entry of the printcap
> was to modify the file to be printed by passing the file through this
> filter before to send it to the printer. Apparently, I was wrong!!
>
> Could somebody tell me how to automatically apply a filter to a file
> before sending it tyo the printer.
>
> My present solution was to write a new command (laserhp8)
>
> #!/bin/sh
> /usr/local/system/hp_filter < $* |lpr -Php8
>
> But if somebody types directly the lpr -Php8 command, the filter is
> bypassed!
>
Here are the answers:
Arnold Sutter <Arnold.Sutter_at_udt.ch>
Marco Luchini <m.luchini_at_ic.ac.uk>
There is an entry on one of the menus on the
printer itself that does "add CR to LF".
[This is what I did and it works, the printer necesitate only one queue
for both PS and ascii files. I did not want to have two different
queues, since other digital lps17 we have can work correctly with one
queue, and peoples are used to this way.]
Marco
--------------
Anthony Patchett <pat_at_eurocontrol.de>
The HP Printers usually have 2 print queues - one is called "text" and
one
is called "raw" and it seems that "raw" is the default.
You should send text files to the "text" queue and graphics files (HPGL,
PostScript) to the "raw" queue.
This means two entries for the printer in your /etc/printcap:
first entry:
...
:rm=<printer-name>:\
:rp=raw:\
...
second entry:
...
:rm=<printer-name>:\
:rp=text:\
...
This should do the trick!
---------------
Davis <Davis_at_Tessco.Com>
You need to configure the printcap entry using
either the TCP connection type or, if using v4.0d
or above, the pcfof filter. Either method allows
the use of host-side filters.
----
"Tri H. Tran" <thtran_at_hydra.acs.uci.edu>
The way we got around this is to have the filter script
filter the file as well as submitting the printjob out
as well, bypassing lpd/lpr.
Here's a sample of our printcap entry for a similiar printer
(HP-5Si):
maefac2|HP-5Si 4th Floor-EG:\
:lf=/var/adm/lpd-errs:\
:lp=/dev/null:\
:mx#0:\
:if=/mae/lib/bin/maefac2-filter:\
:sd=/var/spool/lpd/maefac2:
Note the lp=/dev/null entry and NO rm/rp entry? "if" will only
work with local lp printer.
No for the filter script "maefac2-filter":
#!/bin/sh
set -x
exec > /var/spool/lpd/maefac2/errors 2>&1
/dcslib/allsys/bin/to-postscript | \
/dcs/packages/gnu/lib/filters/ifhp -Tdev=hostipname%9100 -Tre
tries=100 -Tsleep=10
The to-postscipt is only a smart text-to-postscript filter that we use
here. It's a Python script that a staff member here wrote to detect
whether a file is postscript or not. If not, then convert it; else
leave it alone and pass the file through.
ifhp is a binary to send the resulting file out to the
network printer. You may already have this with the HP
utilities that you got with the printer. Also not the
%9100 entry. This is the special HP print port but
port 515 will also work as well. Hope this help
and good luck.
--------------------
And finally a interestying explanation of how works a lpdfilter.
Mike D Cross <crossmd_at_mh.uk.sbphrd.com>
The IF/OF filters take their input from stdin not the connand line.
My solution to this problem was:
lp:\
:lf=/var/spool/lp/log:\
:lp=/dev/null:\
:sd=/var/spool/lp:\
:if=/var/spool/lp/filter-lp:
where filter-lp is a script of:
#!/bin/sh -fx
QUEUE="execution-`basename $0 | cut -d- -f2`"
POSTSCIPT='/var/spool/bin/a2ps'
LPR=/usr/bin/lpr
RM=/usr/bin/rm
/usr/bin/cat - > /tmp/cs.$$
line1=`head -1 /tmp/cs.$$`
case "$line1" in
%\!*)
# postscript file
cat /tmp/cs.$$ | $LPR -P$QUEUE
;;
*)
# not a postscipt file
cat /tmp/cs.$$ | $POSTSCIPT -w -nn | $LPR -P$QUEUE
esac
$RM /tmp/cs.$$
# echo `date` >> /var/spool/lp/log
exit 0
Thank you very much to all
JFV
--
Dr Jean-Francois Vibert (vibert_at_b3e.jussieu.fr)
Faculte de Medecine Saint-Antoine
27 rue Chaligny 75571 PARIS Cedex 12
Tel: (33)-1-44.73.84.31 Fax: (33)-1-44.73.84.54
http://www.b3e.jussieu.fr
Received on Tue Feb 02 1999 - 17:55:32 NZDT