*- Kent West wrote about "Redirect printer output to email?"
[cool use of technology, snipped]
| 
| I figure Linux is powerful enough to do what I asked above. I've just about
| gotten samba figured out enough to allow the Win95 box to print to it; what
| I need to know is how to route that printed info to a mail message. We can
| then email the message to our campus security beepers (this mechanism is
| already in place).

It depends on the format of the print information that the Win95
machine is sending to the printer.  If it thinks it is sending
the data to a specific printer type it will send the info in the printer
language, say PCL or something.  This would be useless to a text based
email program.  If on the other hand Win95 thinks it is attached to a
generic/text based printer then it should work fine(Assuming the
info to print is just plain text). The input fileter(if=) in the
printcap definition on the server of the printer will just have to grab
a copy of the stdin before it passes it to the printer on stdout and
then call the paging program with that data.

Something like the following, don't take my word on it. I am not a
great shell programmer.

#!/bin/sh
# the script called by 'if' in the printcap for the samba printer
# 
# assume input to filter is plain text

# copy stdin to tmp file
cat - > /tmp/pager.$$

# feed to pager email
mailx -s "Page Message" [EMAIL PROTECTED] < /tmp/pager.$$

# pass stdin through ascii to ps converter and then 
# let ghostscript create a printer file to pass on to the 
# printer.
a2ps [options] /tmp/pager.$$ | ghostscript -s -sDEVICE=printername ....\
-sOUTPUTFILE=- -

rm /tmp/pager.$$
# end


-- 
Brian 
---------------------------------------------------------------------
"Never criticize anybody until you have walked a mile in their shoes,  
 because by that time you will be a mile away and have their shoes." 
                                                           - unknown  

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

Reply via email to