Date: Wed, 11 Aug 1999 20:50:01 MYT-8 From: philip@aleytys.pc.my To: Dan Olson , oraapps-l@cpa.qc.ca Subject: Re: Reports - Postscript Message-ID: <199908111521.XAA27125@relay3.jaring.my> ------------------------------------------------------------------------ Here is the fndpsprint wrapper script. I stole it from the 9.4 shell script used to control printing. ------------------------------------------------------------------------ #! /bin/sh #=====================================================================+ # FILENAME # fndpsprint # DESCRIPTION # Print financials out files to postscript printers # -ttitle means use this title for the header # -Ttype sets the printer type variable $type # reference this variable or printer name when using different print # methods # -ncopies number of copies to print # -sstyle style/orientation to use (protrait,landscape,landwide,A4) # -dprinter is the system name of the printer/print queue to use # # # NOTES # HISTORY # --------------------------------------------------------------------------- # 19990807 Philip Chee Copied from 9.4 qlwprint shell script # and modified for 10.7 ps laser printers # using the postprint filter. # Need to tidy up and delete junk. # --------------------------------------------------------------------------- PRCOPIES=${PRCOPIES-1} PRSAVOUT=${PRSAVOUT-Y} copies=${copies-1} printer=${printer-edp_laser} title=${title-FND_PRINT_JOB} if test $# -eq 0 then if test -t 0 then echo Enter file names, \ to exit: read fnames if test -z "$fnames" then exit fi else landwide -t | /usr/ucb/lpr -s exit fi else fnames=$* fi # Initialize the title to user name. Title will appear on the title page # in the position normally reserved for the host name. Did not want to # initialize it to be the host name, since that would mean hardcoding. title=${USER-Unknown} # Process each argument. If argument is -Cname, set title to name for # all arguments following until next -C. for i in $fnames do # If argument is -t, then set title to requested name if test `echo $i | awk '{printf "%s", substr($1,1,2)}'` = -t then # Make sure name follows -t argument if test `echo $i | awk '{print length($1)}'` -lt 3 then echo Usage: -ttitle. No space allowed between -t and title. exit fi title=`echo $i | awk '{printf "%s", substr($1,3,9)}'` # If argument is -T, then set type to requested printer type elif test `echo $i | awk '{printf "%s", substr($1,1,2)}'` = -T then # Make sure printer type follows -T argument if test `echo $i | awk '{print length($1)}'` -lt 3 then echo Usage: -Ttype. No space allowed between -T and printer type. exit fi type=`echo $i | awk '{print substr($1,3)}'` # If argument is -n, then set copies to requested copies elif test `echo $i | awk '{printf "%s", substr($1,1,2)}'` = -n then # Make sure copies follows -n argument if test `echo $i | awk '{print length($1)}'` -lt 3 then echo Usage: -ncopies. No space allowed between -n and copies. exit fi copies=`echo $i | awk '{print substr($1,3)}'` # If argument is -d, then set printer to requested printer elif test `echo $i | awk '{printf "%s", substr($1,1,2)}'` = -d then # Make sure printer name follows -d argument if test `echo $i | awk '{print length($1)}'` -lt 3 then echo Usage: -dprinter. No space allowed between -d and printer name. exit fi printer=`echo $i | awk '{print substr($1,3)}'` # If argument is -s, then set printer style to requested printer style elif test `echo $i | awk '{printf "%s", substr($1,1,2)}'` = -s then # Make sure printer style follows -s argument if test `echo $i | awk '{print length($1)}'` -lt 3 then echo Usage: -sstyle. No space allowed between -s and printer style. exit fi style=`echo $i | awk '{print substr($1,3)}'` else outname=`basename $i | awk '{printf "%s", substr($1,1,14)}'` if test $title then class=`echo -C $title` fi ################################################################### case $style in 'PORTRAIT') /usr/lib/lp/postscript/postprint \ -r 1 -p portrait -s 10 -x 0.6 -y -0.40 -c $copies $i | \ /usr/bin/lp -n 1 -d $printer -o nobanner -s -t $title & ;; 'LANDSCAPE') /usr/lib/lp/postscript/postprint \ -r 1 -p landscape -s 6.5 -y -0.3 -c $copies $i | \ /usr/bin/lp -n 1 -d $printer -o nobanner -s -t $title & ;; 'LANDWIDE') /usr/lib/lp/postscript/postprint \ -r 1 -p landscape -s 6.5 -y -0.3 -c $copies $i | \ /usr/bin/lp -n 1 -d $printer -o nobanner -s -t $title & ;; 'A4') /usr/lib/lp/postscript/postprint -l 100 \ -r 1 -p portrait -s 7 -x 0.5 -y -0.40 -c $copies $i | \ /usr/bin/lp -n 1 -d $printer -o nobanner -s -t $title & ;; *) /usr/lib/lp/postscript/postprint \ -r 1 -p landscape -s 6.5 -y -0.3 -c $copies $i | \ /usr/bin/lp -n 1 -d $printer -o nobanner -s -t $title & ;; esac fi done exit