# @(#)sts_ljet3 - model lp interface # @(#)Portions copyright 1990 ShadeTree Software, Inc. # @(#)STS/KBS 02-May-1995 #! STS HP LaserJet III -w- auto-width -w- fwd to java # -oraw no data processing # -o2c format into two columns # -ops format postscript input into pcl # -auto (default)Set font and orientation based on max line length PATH=/usr/local/bin:$PATH PORT=9100 GS=/usr/local/bin/gs GSOPTS="-q -sDEVICE=ljet3 -dNOPAUSE" # exit and cancelation special processing _cancel() { # cancel printing echo "\n\n***** JOB CANCELED *****\n\f\c" } _exit() { # clean up before leaving echo "\033E\c" } _init() { # printer initialization # \033E RESET # \033&k2G CR=CR, LF=CR+LF, FF=CR+FF # \033&s0C enable line wrap # \033&l7.27C 66 lpp # \033(12U PC-850 symbol set # \033(s0T LinePrinter typeface echo "\033E\033&k2G\033&s0C\033&l7.27C\033(12U\033(s0T\c" } _init_raw() { # printer initialization # \033E RESET echo "\033E\c" } _init_2c() { # printer initialization # \033E RESET # \033&k2G CR=CR, LF=CR+LF, FF=CR+FF # \033&s0C enable line wrap # \033&l2A letter # \033&l1O landscape # \033&66P 66 lpp # \033(10U PC-8 symbol set # \033(s0p fixed pitch # \033(s16.67h 16.67 cpi # \033(s8.5v 8.5 points # \033(s0s upright # \033(s0b medium # \033(s0T line printer # \033&l5.4C VMI=5.4 (5.4/48's)--72 lpp # Note: VMI (5.4/48's) corresponds to 72 lpp. This is hard coded # into the 'pr' arguments during actual printing. # If the VMI is changed the page length must be changed and visa-versa. echo "\033E\033&k2G\033&s0C\033&l2A\033&l1O\033(10U\033(s0p16.67h8.5v0s0b0T\033&l5C\c" } # trap exits and cancelations and perform special processing trap '_exit' 0 trap '_cancel;exit 0' 1 2 3 15 nhead=0 # set to 1 or more to enable banners printer=`basename $0` request=$1 name=$2 title=$3 copies=$4 options=$5 shift; shift; shift; shift; shift mode=auto init=_init for o in $options do case $o in raw|g*) mode=raw init=_init_raw ;; 2c) mode=2c init=_init_2c ;; ps) mode=ps init=_init_raw ;; esac done { # set printer width # send the file(s) to the standard out $copies times while [ "$copies" -gt 0 ] do # Initialize the printer $init for file do case $mode in raw) cat "$file" ;; 2c) lff <"$file" 2>&1 | pr -l72 -e | pr -t -l72 -w170 -2 echo "\f\c" ;; ps) $GS $GSOPTS -sOUTPUTFILE=- "$file" &1 echo "\f\c" ;; esac done copies=`expr $copies - 1` done # Entire routine is bracked {} to allow all output to be passed through # a filter (under xenix, /usr/lib/lponlcr, to convert lf's to cr/lf's). # To do this, replace the single '}' below with '} | ' # Use netcat to go direct to the printer. I'm currently respooling to an # lpr/lpd complient printer after all the processing # } | netcat -h $printer -p $PORT } | lp -s -djava exit 0 fi