It just occurs to me. If you are new to writing print filters, the best introduction I know of to that topic is one I just wrote. Visit this web site:
http://linux.nf/stepbystep.html And search for: hammer filters and you will find a very basic but very useful introduction to print filters for use with the lprng printing system. I have also attached below a more complicated print filter I just wrote to enable me to print from netscape to a text file for use in plain text email. 1 #!/bin/bash 2 cat < /dev/null > `set | sed -n "s/.*:lp=//p"` 3 set > shellvalues 4 a=`set | sed -n "s/^l//p" | xargs file | grep PostScript` 5 echo $a > junkname 6 [ -z "$a" ] || { 7 cat | ps2ascii 8 exit 0 9 } 10 a=`set | sed -n "s/^l//p" | xargs file | grep text ` 11 [ -z "$a" ] || { 12 cat 13 exit 0 14 } 15 echo invalid file type of 16 set | sed -n "s/^l//p" | xargs file 17 exit 0 18 Notes: Line 2 erases the contents of the text file defined in the printcap entry (see below). You cannot just cat < /dev/null to stdout because during printing the output file is opened in append mode, not write mode. I use sed a lot in my scripts to search through the local shell variables (returned with the set command) to find these parameters. Line 3: Just for debugging Line 4: Look for the type of file beginning with l (The letter "l", your print file, created by lpr, I believe) in the print spool directory. If file returns PostScript, the variable "a" will have a value, otherwise "a" will be null. Line 5: Just for debugging Line 6: If postscript, cat the file through ps2ascii to stdout and you are done. Lines 10 through 14: If text file, just cat the file. Lines 15-17: If neither PostScript or text file, print error message to stdout including the file type of the file you are trying to print. BTW, this is not ideal. ps2ascii runs some words together. This is the printcap entry for this printer: text:\ :sd=/var/spool/lpd/text:\ mx#0:\ :lp=/tmp/textprint:\ :if=/var/spool/lpd/text/filter: :sh: Joel ----------------------------------------------------------------------------- YOU MUST BE A LIST MEMBER IN ORDER TO POST TO THE LPRNG MAILING LIST The address you post from MUST be your subscription address If you need help, send email to [EMAIL PROTECTED] (or lprng-requests or lprng-digest-requests) with the word 'help' in the body. For the impatient, to subscribe to a list with name LIST, send mail to [EMAIL PROTECTED] with: | example: subscribe LIST <mailaddr> | subscribe lprng-digest [EMAIL PROTECTED] unsubscribe LIST <mailaddr> | unsubscribe lprng [EMAIL PROTECTED] If you have major problems, send email to [EMAIL PROTECTED] with the word LPRNGLIST in the SUBJECT line. -----------------------------------------------------------------------------
