#!/usr/bin/sh
#(c) Copyright 1993 ~ 1995 Hewlett-Packard Company. All Rights Reserved.
#
#@(#) $Header: /users/hpnp/odyssey/repository/sh/net_genericprinter.psh,v 1.55 1999/11/25 15:52:13 hpnp Exp $
#--------------------------------------------------------------------------
# USER CAUTION: Starting this version, there are other programs depending on
# the statements planted here for various purposes. Your changes in this
# file may render those information inaccurate.
#
# To customerize this script, edit the following functions:
# Init_variables - to initialize new variables
# Paring_Options - to parse the options you create, and set the variables
# Output_PCL_Optins and/or Output_PS_Options
# - to output the PCL/PS commands according the variable
# settings
#--------------------------------------------------------------------------
#[ For WJA use
#version E.10.05
#supports Generic printer
# by Devu 1 oct 1999]
# hpnpl sets the following: OS, PERSONALTY, PRINTMODEL, TEOJ, and BANNER
HPNP=/opt/hpnp
BIN=/usr/bin
HPNPS=$HPNP/bin/hpnps
# [ Modified by Suresha on 26th Sep 99 to support JPIU
HPNP=/opt/hpnpl
HPNPS=$HPNP/bin/hpnps
# end of change by suresha
DUPPRINT="def"
BANTRAY="def" #BANNER TRAY
PSLEVEL="1" # CHANGE POSTSCRIPT LEVEL
PERSONALTY="AUTO" # CHANGE LANGUAGE
BAUDRATE="9600"
PRINTMODEL="genericprinter" # CHANGE PRINTER MODEL
TEOJ="" # CHANGE TRUE END OF JOB
BANNER="yes" # CHANGE BANNER PAGE PRINTING
MPAGE=$HPNP/bin/mpage #Added by Ramki on 14th Oct 98 for PSNUP
SPACECHAR="_-"
OS="UNKNOWN"
if [ "$OS" = "UNKNOWN" ]
then
OS=`uname`
fi
TMP=/tmp
ID=/usr/bin/id
CUT=/usr/bin/cut
AWK=/usr/bin/awk
MKDIR=/usr/bin/mkdir
USERNAME=`$ID | $CUT -f1 -d" " | $CUT -f2 -d"(" | $CUT -f1 -d")"` # get user name
if [ $USERNAME = "root" -o $USERNAME = "lp" ]
then
TMP=$HPNP/tmp
else
/usr/bin/sun > /dev/null 2>&1
if [ $? -eq 0 ]
then
# [ Modified by Amit Raval to fix the defect#57434 on 20th Apr. 1999
# HOME=`$AWK 'BEGIN { FS=":" }
# {if ( $1 == UNAME) print $6 ; }' UNAME=$USERNAME /etc/passwd` # get home dir. from /etc/passwd
JAHOME=`$AWK 'BEGIN { FS=":" }
{if ( $1 == UNAME) { print $6 ; exit } }' UNAME=$USERNAME /etc/passwd` # get home dir. from /etc/passwd
# ]
else
# [ Modified by Amit Raval to fix the defect#57434 on 20th Apr. 1999
# HOME=`$AWK -v UNAME=$USERNAME 'BEGIN { FS=":" }
# {if ( $1 == UNAME) print $6 ; }' /etc/passwd` # get home dir. from /etc/passwd
JAHOME=`$AWK -v UNAME=$USERNAME 'BEGIN { FS=":" }
{if ( $1 == UNAME) { print $6 ; exit } }' /etc/passwd` # get home dir. from /etc/passwd
# ]
fi
if [ -z "$JAHOME" ] # Handle the NIS issue
then
JAHOME=$HOME # Assign the env veriable HOME if JAHOME is null.
fi
# [Modified by Kumaresan for JPIU on 26th Sept '99.
if [ ! -d $JAHOME/.jpiu ]
then
$MKDIR $JAHOME/.jpiu > /dev/null 2>&1
if [ $? -eq 0 ]
then
TMP=$JAHOME/.jpiu
fi
else
TMP=$JAHOME/.jpiu
fi
fi
# ]
case "$OS" in
HP-UX)
patternlist="-e shar -e object -e executable -e archive -e library -e compressed"
GREP="$BIN/grep $patternlist"
esc=""
PR="pr -F"
log="/var/adm/lp/log"
;;
solaris | SOLARIS | SunOS)
OS="SOLARIS"
PR="pr -f"
if [ -w "/var/spool/lp/logs/lpsched" ]
then
log="/var/spool/lp/logs/lpsched"
else
log=/dev/null
fi
;;
esac
# -------- Part I Functions -----------------
# print the option listing with -ooptions while submitting a job
all_options()
{
echo "\033&k2G\033&l0O\c" # always in portrait mode
echo "\033&k2G\033(s3B\t\t\033&d0D\c"
echo "Options for Model Script net_genericprinter\n"
echo "\033&d@SYNOPSIS:\033(s0B\c"
echo "\tlp -o -o ... ...\n"
echo "\033(s3BDESCRIPTION:\033(s0B"
echo "
This script may be used with any LaserJet, DeskJet, Inkjet and
PaintJet printers. All the options below may not be applied to
all models. Use them discreetly.
"
echo "\033(s3BOPTIONS:\033(s0B\033&k2S\033&l6C\c" # compressed font, 8 line/in
# >>>>>>>>>>>>>>>>>>>> OPTION <<<<<<<<<<<<<<<<<<<<<<<<
# [ Modified by Vijay on 6/10/98 to remove manualenv option
# manual/man/tray1, Select the given tray.
# tray2/upper/ub/ubin,
# tray3/lower/lb/lbin,
# manualenv
# [ Modified by Vijay to remove color and gray on 17/11/98
# color, gray Set the render mode to color or gray.
# End of change by Vijay
echo "
options list all options
auto Auto-switch language (PS/PCL) based on file type
postscript/post, pcl Print in Postscript/PCL mode
hpgl2,hpgl2_p Print in HP-GL/2 landscape mode or portrait mode
relay Pass data to printer without adding any commands
r/raw print in PCL raw mode.
yb/banner, nb/nobanner Print, or do not print banner page (Default: $BANNER)
portrait,landscape Print in portrait/landscape mode
simplex Single sided printing
duplex, hduplex Double sided printing, long edge/short edge binding
mtype Select different media types.(Plain/Preprinted/
Glossy, Transparency)
legal,letter,A4,exec Select legal, letter, A4, executive, ledger/11x17,
ledger/11x17, C5/C5env C5env, com10env, B5-ISO, DLenv or monarc sized
com10/com10env, B5-ISO, paper/card
DL/DLenv, monarc
manual/man/tray1, Select the given tray.
tray2/upper/ub/ubin,
tray3/lower/lb/lbin,
btray1, btray2/bupper/ Feed banner page from the specified tray.
ubb, btray3/blower/lbb
quality Enhance the resolution. can be, light,
medium or dark.
dpi# Set the resolution to # dpi (300/600)
text 1-up Text printing (adding one CR for each LF)
pesc Set to recognize escape sequence
ln66 Print 66 lines of text on portrait
2up/4up Print 2/4 pages on one side of paper
2+ Print 2up in portrait with header and line numbers
rev Reverse the output page
l#, tl# Set logical page length/text length to # lines
tm#, lm#, rm# Set top margin to #lines, left/right margin in column#
c, 10, 12, fp# Set font pitch to compressed, or 10/12/# char/inch
hsi#, vsi# Set horizontal/vertical spacing increment
ps, fs Select proportional, or fixed spacing font
lpi# Print at # lines per inch
cs#, type# Set character set/typeface to
height# Set height to #
style#, i, upright Set font style to #, italic, or upright
weight#, b/bold Set font stroke weight to #, or bold
n/nroff, pr Print output of nroff/pr (run nroff first)
ascii Print text without interpreting it.
ps1 Use PostScript Level 1 commands for print formatting.
ps2 Use PostScript Level 2 commands for print formatting.
HP Network Printer Only (see also man pages for xjjm and jetdirect)
job/jobnp,nojob Bring, or not bring up the job monitor for this job.
A display name can be specified by -ojob+
"
# End of change by Vijay ]
# >>>>>>>>>>>>>>>>>>> END OF OPTION <<<<<<<<<<<<<<<<<<<<<<
echo "\n\033&k0S\033(s3BNOTE:\033(s0B\033&l8C\n"
echo "
1. 2up/4up will use the defaults for all options except duplex,
orientation, in/out bin selection, and banner page printing.
2. Unexpected results may occur when using option \"l#\" or \"tl#\"
alone.
3. Most options described above are intended for text (ASCII) files.
4. Option \"-oraw\" is required for printing PCL raster files.
"
echo "\033E\c"
}
# list some options on the banner page.
partial_options()
{
echo "\033&a5006v30L\c"
echo "********** Option Summary *********** "
echo "(See "man net_generic" for details or "
echo "use -ooptions to get a description)\n "
echo "\033&k2S\c" # use compressed font
echo "auto, pcl, postscript, raw, relay, hpgl2, hpgl2_p "
echo "dpi#, text, b weight#, pesc, rev "
echo "2up, 4up, 2+ portrait, landscape "
echo "nroff, pr, l#, tl# tm#, lm#, rm#, yb, nb "
echo "simplex, duplex hduplex c, 10, 12, fp# "
echo "legal, letter, A4 exec, ledger, C5, com10 "
echo "B5-ISO, DL, monarc, lpi#, style#, i, upright, ln66 "
# ]
}
##[ Function for setting banner tray from Q-configuration 23 sept 1999
Handle_Ban_Tray()
{
case "$BANTRAY" in
1)
bannerpagesrc="4";;
2)
bannerpagesrc="1";;
3) # feed from 3rd tray
bannerpagesrc="5";;
4)
bannerpagesrc="8";;
esac
}
## end of banner tray function Devu ]
##[ Added by Devu to handle duplex print sept 23 1999
Handle_dupprint()
{
if [ "$DUPPRINT" = "yes" ]
then
duplex="vduplex"
elif [ "$DUPPRINT" = "no" ]
then
duplex="simplex"
fi
}
##end of duplex Devu]
# PCL banner
do_pcl_banner()
{
# Print the standard header
echo "\033&k2G\033&l0O\c" # always in portrait mode
# [ Modified by Vijay on 15th Oct 1998 to include btray options
# where does the paper come from
if [ "$bannerpagesrc" != "def" ]
then
echo "\033&l${bannerpagesrc}H\c"
else
case "$mediasrc" in
1 | 4 | 5 | 8 )
echo "\033&l${mediasrc}H\c";;
esac
fi
# End of change by Vijay ]
if [ "$OS" = "HP-UX" ]
then
echo "\033)8U\033)s1p60v1s0b16901T\n $user\033)s14v0S"
user1=`pwget -n $user | line | cut -d: -f5`
if [ -n "$user1" ]
then
echo "\n\t\t\t\t\tUser: $user1\n"
else
echo "\n\t\t\t\t\tUser: (No User Info in /etc/passwd)\n"
fi
else # assume it's Solaris or others?
userXip=`echo $user | awk -F! '{print$2}' `
echo "\033)8U\033)s1p60v1s0b16901T\n $userXip\033)s14v0S"
user1=`echo $user | line | cut -d! -f2`
syst=`echo $user | line | cut -d! -f1`
echo "\n"
fi
echo "\t\t\t\t\tRequest: $jobid from $syst\n"
if [ "$jrpg" -eq 0 ]
then
echo "\t\t\t\t\tOptions: $options"
fi
if [ -n "$invalidopt" ]
then
echo "\t\t\t\t\tInvalid Options: $invalidopt\n"
else
echo ""
fi
if [ -n "$title" ]
then
echo "\t\t\t\t\tTitle: $title\n"
else
echo ""
fi
date1=`date`
echo " $date1"
# jrpg=3 # test that recover message fits on all paper sizes
if [ "$jrpg" -ne 0 ]
then
echo "\033&a2520V\c"
echo "\033)8U\033)s1p30v1S\c"
echo " This job is recovered from page $jrpg !!\n\n\n\n"
echo " (Note:\t There may be a few \n\n\n\t\t pages duplicated)"
fi
echo "\c"
partial_options
# [ Modified by Vijay on 15th Oct 98 to remove support of debugm option
# if [ -z "$debug" ]
# then
# if [ -r $HPNP/hpnp/etc/hplogo.pcl ]
# then
# echo "\033&a140v"$boxwidth"H\c"
# cat $HPNP/hpnp/etc/hplogo.pcl
# fi
# fi
# End of change by Vijay ]
echo "\033E\033%-12345X\c"
}
#
#------------------
pslp()
{
# pslp --- PostScript emulation of LaserJet default mode - 82 chars, 66 lines
#
#
#[ Added by Ramki for PSNUP on 6 Nov 98
if [ -n "$psnup" ]
then
psnupfile=$1 #Added by Ramki for supporting PSNUP
else
psnupfile=$file
fi
#]
# Put out the header
#[ Modified by Devu below to add if condition for psnup to fix
# n-up ascii print of a PS file: Nov 25 1999
if [ -z "$psnup" ]
then
# end Devu
cat <<-EnD
%!PS-Adobe-2.0
%%Title: pslp
%
/$font findfont 11.5 scalefont setfont
/inch {72 mul} def
/deltay 10.5 66.5 div inch def % allow .25 inch margins all sides
/leftmargin .4 inch def
/topmargin 10.75 inch deltay sub def
/gotop {
leftmargin topmargin moveto
/linecount 0 def
} def
/checkpage {
linecount 66 ge
{
showpage
gotop
}
if % end of page?
/linecount linecount 1 add def % incr linecount
} def
/crlf {
currentpoint exch pop deltay sub leftmargin exch moveto
} def
gotop
%%EndProlog pslp
EnD
else # Devu
echo " \c"
fi
# Put out the text
# expand tabs:
#[ Modified by Ramki for PSNUP support on 6/11/98
#expand $file |
expand $psnupfile |
#]
expand $file |
# delete control chars unknown to PS:
tr -s '[\001-\011][\016-\037]' '@' |
# escape chars special to PS
# and format each line as
# checkpage (This is the text.) show crlf
if [ -z "$psnup" ]
then
sed -e 's/\\/\\\\/g' -e 's/[()]/\\&/g' \
-e 's/^/checkpage (/' -e 's/$/) show crlf/'
else
sed -e 's/\\/\\\\/g' -e 's/[()]/\\&/g'
fi
if [ -z "$psnup" ]
then
cat <<-'EnD'
%%Trailer pslp
showpage
EnD
fi
# end of if conditions for psnup by Devu ]
} # end of function pslp
#----------------------------
# initialize the variables
#----------------------------
Init_variables()
{
lang_user=$PERSONALTY # control if Resolve_lang() should be called
lang=$PERSONALTY # determine which languague should be used
lang_specify=""
outmode_specify=""
psnup="" #Added by Ramki on 14th Oct 98 for PSNUP
outputmode_specify=""
invalidopt=""
listopt=""
# internal use
# [ Modified by Vijay to remove the support of debugm on 15th Oct 1998
# debug=""
# End of change by Vijay ]
nroff=""
reverse=""
banner=$BANNER
ThreeHoles="" # CHANGE DEFAULT 3HOLE OPTION
ln66=""
eolwrap="no"
dividing="" # CHANGE DEFAULE PAGE DIVIDE MODE , '-hh' for 2+, '-h'
# for 2up and '-q' for 4up
manuald=""
outputmode="cooked"
omode_user="cooked"
bannerpagesrc="def" # CHANGE DEFAULT BANNER PAGE SOURCE
ascii=""
font="Courier" # CHANGE DEFAULT FONT FOR POSTSCRIPT
resolution="def" # CHANGE DEFAULT RESOLUTION
duplex="def" # CHANGE DEFAULT DUPLEX MODE
mediasrc="def" # CHANGE DEFAULT MEDIA SOURCE
mediadest="def" # CHANGE DEFAULT MEDIA DESTINATION ONLY FOR PCL FILE
outb="def" # CHANGE DEFAULT MEDIA DESTINATION
outbstring="OPTIONALOUTBIN"
pescfile="no" # CHANGE DEFAULT PESC MODE (pesc option)
orientation="def" # CHANGE DEFAULT ORIENTATION
paper="def" # CHANGE DEFAULT PAPER SIZE
length="def"
length2up="-l66"
pitch="def" #pitch="10.7"
hsi="def"
lpagelen="def"
textlen="def"
lmargin="def"
rmargin="def"
tmargin="def"
italic=""
spacing="def"
lpi="def"
vsi="def"
charset="def"
height="def"
style="def"
typeface="def"
weight="def"
width2up=178
# for silent run use
startpg=1 # CHANGE DEFAULT START PAGE (srb option)
jrpg=0 # CHANGE JOBRECOVERY START PAGE
extraEOJ="false"
endpg=0 # CHANGE DEFAULT END PAGE (are option)
mediatype="" # CHANGE DEFAULT MEDIA TYPE
rotate="" # CHANGE DEFAULT ROTATE MODE
loffset="def"
} # end of init_variables()
#-----------------------------------
#-----------------------------------
Parsing_Options()
{
for i in $options
do
case "$i" in
# [ Modified by Vijay on Oct 15th 1998 to remove the debugm option
# debugm[/a-zA-Z0-9.-_]*)
# debug="yes";;
# debugm)
# debug="yes";;
# End of change by Vijay ]
ps1)
PSLEVEL="1";;
ps2)
PSLEVEL="2";;
auto)
lang="AUTO"
lang_user="AUTO";;
relay)
for file in $files; do
cat "$file"
done
exit 0;;
postscript | post )
lang="PS"
lang_user="PS";;
pcl )
lang_specify="yes"
lang="PCL"
lang_user="PCL";;
hpgl2)
lang_specify="yes"
outputmode_specify="yes"
lang="PCL"
lang_user="HPGL2"
outputmode="raw";;
hpgl2_p)
lang_specify="yes"
outputmode_specify="yes"
lang="PCL"
lang_user="HPGL2_P"
outputmode="raw";;
r | raw)
outputmode_specify="yes"
outputmode="raw";;
text)
lang_specify="yes"
outputmode_specify="yes"
lang="PCL"
lang_user="PCL"
outputmode="cooked";;
# file type
pesc)
pescfile="yes";;
# Job Control
dpi[03-6]* )
resolution="`echo "$i" | sed 's/^dpi//'`";;
nb | nobanner) # No banner page
banner="";;
yb | banner) # output banner page
banner="yes";;
# 2-up/4-up.
2+)
dividing="-hh";;
half | 2 | 2up)
psnup="2" #Added by Ramki on 14th Oct 98 for PSNUP
dividing="-h";;
quarter | 4 | 4up)
psnup="4" #Added by Ramki on 14th Oct 98 for PSNUP
# [ Modified by Vijay on 25/7/99 to support 4up in Solaris
# if [ "$OS" = "HP-UX" ]
# then
# dividing="-q"
# fi;;
dividing="-q";;
# End of change by Vijay ]
# [ Modified by Amit Raval to fix the defect# 57427 on Apr 16. 1999
8 | 8up)
# [ Modified by Vijay on 25/7/99 to support 8up for PostScript
psnup="8"
# End of change by Vijay ]
dividing="8up" ;;
# ]
portrait) # print in portrait mode
orientation="p";;
landscape) # print in landscape mode
orientation="l";;
rotate)
rotate="yes";;
# duplex
simplex)
duplex="simplex";;
vd | duplex | double | d) # vertical binding
duplex="vduplex";;
hd | hduplex) # double side, horizontal binding
duplex="hduplex";;
# paper source
# [ Modified by Vijay on Oct 15th 1998 to solve the tray problem
# tray1 | manual | man ) # manual sheet feed
# mediasrc="2";;
# tray2 | upper | ub | ubin) # feed from upper tray
# mediasrc="1";;
# tray3 | lower | lb | lbin ) # feed from lower tray
# mediasrc="4";;
# tray4 ) # HCI
# mediasrc="5";;
tray1)
mediasrc="4";;
manual | man ) # manual sheet feed
mediasrc="2";;
tray2 | upper | ub | ubin) # feed from upper tray
mediasrc="1";;
tray3 | lower | lb | lbin ) # feed from lower tray
mediasrc="5";;
tray4)
mediasrc="8";;
# End of change by Vijay ]
# [ Modified by Vijay on Oct 15th 1998 to include btray options
btray1)
bannerpagesrc="4";;
btray2 | bupper | ubb)
bannerpagesrc="1";;
btray3 | blower | lbb) # feed from 3rd tray
bannerpagesrc="5";;
btray4)
bannerpagesrc="8";;
# End of change by Vijay ]
# paper size
legal) # 8.5 x 14
paper="legal";;
letter) # 8.5 x 11
paper="letter";;
A4) # 210 mm x 297 mm
paper="ISOA4";;
executive | exec) # 7 1/4 x 10.5
paper="exec";;
ledger )
width2up=174
paper="ledger";;
11x17 )
width2up=174
paper="11x17";;
B5-ISO)
paper="ISOB5";;
com10 | com10env) # feed from envelope tray,
paper="com10" ;;
# mediasrc="6";;
C5 | C5env) # envelope (international C5)
paper="C5" ;;
# mediasrc="6";;
DL | DLenv) # feed from envelope tray,
paper="DL" ;;
# mediasrc="6";;
monarc) # feed from envelope tray,
paper="monarc" ;;
# mediasrc="6";;
options)
listopt="yes";;
rev)
if [ "$OS" = "HP-UX" ]
then
reverse="yes"
fi;;
n | nroff)
nroff="-n"
length="-l66";;
pr)
nroff="-p"
length="";;
# PCL Font Control
10) # set to 10.00 cpi
pitch="10";;
12) # set to 12.00 cpi
pitch="12";;
c) # compressed print
pitch="c";;
# set font pitch to value following fp
fp[0-9]* | fp.[0-9]*)
pitch="`echo "$i" | sed 's/^fp//'`" ;;
# set horizontal spacing increment to #/120 in.
hsi[0-9]*)
hsi="`echo "$i" | sed 's/^hsi//'`";;
ps) # proportional spacing
spacing="1";;
fs) # fixed spacing
spacing="0";;
# set lines per inch
lpi[0-9]*)
lpi="`echo "$i" | sed 's/^lpi//'`";;
# set vertical spacing increment to #/48 inch
vsi[0-9]*)
vsi="`echo "$i" | sed 's/^vsi//'`";;
# set character set to value following cs
cs[0-9]*)
charset="`echo "$i" | sed 's/^cs//'`";;
# set height value
height[0-9]*)
height="`echo "$i" | sed 's/^height//'`";;
# set font style
style[0-1])
style="`echo "$i" | sed 's/^style//'`";;
i | italic)
style=italic;;
upright)
style="0";;
# set typeface
type[0-9]*)
typeface="`echo "$i" | sed 's/^type//'`";;
# set font weight
weight[0-9]* | weight-[0-9]*)
weight="`echo "$i" | sed 's/^weight//'`";;
# set font weight
b | bold)
weight=1;;
#set absolute length of page
ln66)
ln66="yes";;
eolwrap)
eolwrap="yes";;
#l[0-9]*)
# lpagelen="`echo "$i" | sed 's/^l//'`";;
#set text length of page
tl[0-9]*)
textlen="`echo "$i" | sed 's/^tl//'`";;
# set left margin in columns
lm[0-9]*)
lmargin="`echo "$i" | sed 's/^lm//'`";;
tm[0-9]*)
tmargin="`echo "$i" | sed 's/^tm//'`";;
# set right margin in columns
rm[0-9]*)
rmargin="`echo "$i" | sed 's/^rm//'`";;
# PS specific
a | ascii) # print postscript text
ascii="yes";;
# [ Modified by Vijay on Oct 15th 1998 to remove hpnpflog
# hpnpflog | job* | nojob*) ;; # to prevent them from being displayed
job* | nojob*) ;; # to prevent them from being displayed
# End of change by Vijay ]
*)
invalidopt="$invalidopt $i";;
esac
done
# Part 2: Reolve conflict between options
# settle outputmode precedence: pesc, raw, 2/4-up, and mdouble
if [ "$lang_user" = "PCL" -a "$pescfile" = "yes" ]
then
if [ "$outputmode" = "raw" ]
then
outputmode="cooked"
fi
fi
if [ "$outputmode" = "raw" ]
then
dividing="" # invalidate 2/4-up
manuald="" # invalidate manual duplex
fi
if [ -n "$manuald" ]
then
outputmode="mdouble"
omode_user="mdouble"
fi
if [ -n "$dividing" ] # override manaul double
then
case "$paper" in
11x17 | ledger)
if [ "$dividing" = "-q" ]
then
dividing="" # not supported
else
outputmode="divide"
omode_user="divide"
if [ "$lpagelen" != "def" ]
then
length2up="-l$lpagelen"
fi
fi;;
*)
outputmode="divide"
omode_user="divide"
if [ "$lpagelen" != "def" ]
then
length2up="-l$lpagelen"
fi;;
esac
fi
if [ "$ln66" = "yes" ]
then
vsi="7.4"
textlen="66"
pitch="10.7"
orientation="p"
lpi="def" # reset, if specified.
fi
if [ "$ThreeHoles" = "yes" ]
then # override pitch, lmargin, tmargin, vsi
pitch="10.7"
loffset="180"
if [ "$orientation" = "def" ]
then
orientation="p"
fi
if [ "$orientation" = "p" ]
then
if [ "$lmargin" = "def" ]
then
lmargin="2"
fi
else
if [ "$tmargin" = "def" ]
then
tmargin="2"
fi
if [ "$vsi" = "def" ]
then
vsi="7.85"
fi
fi
fi
if [ "$mediasrc" = "6" ]
then
banner=""
orientation="l"
fi
# Silent run page adjustment
# override startpg if jrpg not 0
if [ "$jrpg" -ne 0 ]
then
startpg=$jrpg
listopt="no"
banner="yes"
fi
if [ "$duplex" != "simplex" -a "$duplex" != "def" ]
then
if [ $startpg -gt 1 ]
then
num=$startpg
num=`expr $num % 2`
if [ $num -eq 0 ]
then
startpg=`expr $startpg - 1`
fi
fi
fi
if [ "$startpg" -gt 0 ]
then
if [ "$dividing" = "-h" -o "$dividing" = "-hh" ]
then
startpg2updiv=`expr $startpg / 2`
startpg2upmod=`expr $startpg % 2`
if [ "$startpg2upmod" -eq 0 ]
then
startpg=$startpg2updiv
else
startpg=`expr $startpg2updiv + 1`
fi
elif [ "$dividing" = "-q" ]
then
startpg4updiv=`expr $startpg / 4`
startpg4upmod=`expr $startpg % 4`
if [ "$startpg4upmod" -eq 0 ]
then
startpg=$startpg4updiv
else
startpg=`expr $startpg4updiv + 1`
fi
# [ Modified by Amit Raval to fix the defect # 57427 on Apr. 22nd 1999
elif [ "$dividing" = "8up" ]
then
startpg8updiv=`expr $startpg / 8`
startpg8upmod=`expr $startpg % 8`
if [ "$startpg8upmod" -eq 0 ]
then
startpg=$startpg8updiv
else
startpg=`expr $startpg8updiv + 1`
fi
# ]
fi
STARTPAGE="START = $startpg"
else
STARTPAGE=""
fi
if [ "$endpg" -gt 0 ]
then
if [ "$dividing" = "-h" -o "$dividing" = "-hh" ]
then
endpg2updiv=`expr $endpg / 2`
endpg2upmod=`expr $endpg % 2`
if [ "$endpg2upmod" -eq 0 ]
then
endpg=$endpg2updiv
else
endpg=`expr $endpg2updiv + 1`
fi
elif [ "$dividing" = "-q" ]
then
endpg4updiv=`expr $endpg / 4`
endpg4upmod=`expr $endpg % 4`
if [ "$endpg4upmod" -eq 0 ]
then
endpg=$endpg4updiv
else
endpg=`expr $endpg4updiv + 1`
fi
# [ Modified by Amit Raval to fix the defect # 57427 on Apr. 22nd 1999
elif [ "$dividing" = "8up" ]
then
endpg8updiv=`expr $endpg / 8`
endpg8upmod=`expr $endpg % 8`
if [ "$endpg8upmod" -eq 0 ]
then
endpg=$endpg8updiv
else
endpg=`expr $endpg8updiv + 1`
fi
# ]
fi
ENDPAGE="END = $endpg"
else
ENDPAGE=""
fi
} # end of function Parsing_Options()
# -----------------------------------------------------------------
# Determine Which Language (PCL/PS) should be used to print the file
# -----------------------------------------------------------------
Resolve_Lang()
{
if [ -x $HPNPS ]
then # file does exist
$HPNPS -q <$file > /dev/null
pers=$?
case "$pers" in
0)
lang="PCL" # text
case "$omode_user" in
divide) outputmode="divide";;
cooked) outputmode="cooked";;
mdouble) outputmode="mdouble";;
esac;;
1) lang="PS";;
2)
lang="PCL" # with Esc
if [ "$pescfile" = "yes" ]
then # if pesc is speicified, print either cooked or divide
if [ "$outputmode" != "divide" ]
then
outputmode="cooked"
fi
else
outputmode="cooked"
fi;;
3)
if [ "$pescfile" = "yes" ]
then # if pesc is speicified, print either cooked or divide
lang="PCL"
if [ "$outputmode" != "divide" ]
then
outputmode="cooked"
fi
else
lang="RELAY"
fi;;
esac
else # hpnps not exist
lang_user="PCL" # no need to stay AUTO for next file
lang="PCL"
fi
} # end of Resolve_Lang()
# -----------------------------------------------------------------
# Output PS options
# -----------------------------------------------------------------
Output_PS_Options()
{
echo "statusdict begin"
case "$mediasrc" in
# [ Modified by Vijay on 15th Oct 1998 to solve the tray problem
# 1) echo "0 setpapertray";; # upper tray (4si) or MP tray;;
# 4) echo "3 setpapertray";; # lower tray (4si);;
# 5) echo "1 setpapertray";;
# 6) echo "com10envelopetray";; # envelop tray ;
# 8) echo "4 setpapertray";;
# 2) echo "/manualfeed true def";; # feed from manual
1) echo "0 setpapertray";; # upper tray or MP tray;;
4) echo "3 setpapertray";; # lower tray ;;
5) echo "2 setpapertray";;
6) echo "1 setpapertray" ;; # envelop tray ;
8) echo "4 setpapertray";;
2) echo "/manualfeed true def";; # feed from manual
# End of change by Vijay ]
esac
case "$mediadest" in
1) echo "0 setoutputtray";; # up output bin (face down)
2) echo "1 setoutputtray";; # back output bin (face up)
esac
case "$paper" in
ISOA4) echo "a4tray";;
JISB5) echo "jb5tray";;
exec) echo "executivetray";;
letter) echo "lettertray";;
legal) echo "legaltray";;
ledger) echo "ledgertray";;
11x17) echo "11x17tray";;
C5) echo "c5envelopetray";;
DL) echo "dlenvelopetray";;
monarc) echo "monarcenvelopetray";;
esac
case "$duplex" in
simplex) echo "false setduplexmode";;
vduplex) echo "true setduplexmode"
echo "false settumble";;
hduplex) echo "true setduplexmode"
echo "true settumble";;
esac
echo "end"
if [ "$mediasrc" = "6" ]
then
echo "90 rotate"
fi
} # end of Output_PS_Options()
# -----------------------------------------------------------------
# Output PostScript level 2 options
# -----------------------------------------------------------------
Output_PS2_Options()
{
echo "<<"
echo "/DeferredMediaSelection true"
echo "/Policies <>"
case "$mediasrc" in
# [ Modified by Vijay on Oct 15th 1998 to solve the tray problem
# 1) echo "/DeferredMediaSelection true /MediaPosition 0";;# upper tray
# 4) echo "/DeferredMediaSelection true /MediaPosition 3";;# Lower Tray
# 5) echo "/DeferredMediaSelection true /MediaPosition 1";;# Multipurpose Tray
# 6) echo "/DeferredMediaSelection true /MediaPosition 1";;# envelop tray ;
# 8) echo "/DeferredMediaSelection true /MediaPosition 4";;# Lower Tray
# 2) echo "/DeferredMediaSelection true /ManualFeed true";; # feed from manual
1) echo "/DeferredMediaSelection true /MediaPosition 0";;# lower tray
4) echo "/DeferredMediaSelection true /MediaPosition 3";;# upper Tray
5) echo "/DeferredMediaSelection true /MediaPosition 2";; # UC Tray
6) echo "/DeferredMediaSelection true /MediaPosition 1";;# envelop tray ;
2) echo "/DeferredMediaSelection true /ManualFeed true";; # feed from manual
8) echo "/DeferredMediaSelection true /MediaPosition 4";;
# End of change by Vijay ]
esac
case "$mediadest" in
1) echo "/OutputAttributes <>";;# up output bin (face down)
2) echo "/OutputAttributes <>";;# back output bin (face up)
esac
case "$paper" in
ISOA4) echo "/DeferredMediaSelection true /PageSize [595 842]";; #a4
ISOB5) echo "/DeferredMediaSelection true /PageSize [499 708]";; #b5
exec) echo "/DeferredMediaSelection true /PageSize [522 756]";; #exec
letter) echo "/DeferredMediaSelection true /PageSize [612 792]";; #letter
legal) echo "/DeferredMediaSelection true /PageSize [612 1008]";;#legal
ledger) echo "/DeferredMediaSelection true /PageSize [1224 792]";;#ledger
11x17) echo "/DeferredMediaSelection true /PageSize [792 1224]";;#11x17
C5) echo "/DeferredMediaSelection true /PageSize [459 649]";; # c5
DL) echo "/DeferredMediaSelection true /PageSize [312 624]";; # dl
monarc) echo "/DeferredMediaSelection true /PageSize [279 540]";;#monarc
esac
case "$duplex" in
simplex) echo "/Duplex false";;
vduplex) echo "/Duplex true"
echo "/Tumble false";;
hduplex) echo "/Duplex true"
echo "/Tumble true";;
esac
echo ">>setpagedevice"
} # end of Output_PS2_Options()
# -----------------------------------------------------------------
# Output PCL options
# -----------------------------------------------------------------
Output_PCL_Options()
{
case "$mediasrc" in
def);;
*) echo "\033&l${mediasrc}H\c";;
esac
case "$paper" in
legal) echo "\033&l3A\c";;
letter) echo "\033&l2A\c";;
ISOA4) echo "\033&l26A\c";;
exec) echo "\033&l1A\c";;
ledger | 11x17)
echo "\033&l6A\c";;
ISOB5) echo "\033&l100A\c";;
com10) echo "\033&l81A\c";;
C5) echo "\033&l91A\c";;
DL) echo "\033&l90A\c";;
monarc) echo "\033&l80A\c";;
esac
case "$duplex" in
simplex) echo "\033&l0S\c";;
vduplex) echo "\033&l1S\c";;
hduplex) echo "\033&l2S\c";;
esac
case "$orientation" in
p)
if [ "$rotate" = "yes" ]
then
echo "\033&l2O\c"
else
echo "\033&l0O\c"
fi;;
l)
if [ "$rotate" = "yes" ]
then
echo "\033&l3O\c"
else
echo "\033&l1O\c"
fi
length="-l45";;
esac
case "$eolwrap" in
yes) echo "\033&s0C\c" ;;
esac
case "$vsi" in
def);;
*) echo "\033&l${vsi}C\c";;
esac
case "$lpi" in
def);;
*) echo "\033&l${lpi}D\c";;
esac
case "$lpagelen" in
def)
if [ "$length" = "def" ]
then
length="-l60"
fi;;
*) echo "\033&l${lpagelen}P\c"
length="-l$lpagelen";;
esac
case "$tmargin" in
def);;
*) echo "\033&l${tmargin}E\c";;
esac
case "$textlen" in
def);;
*) echo "\033&l${textlen}F\c"
length="-l$textlen";;
esac
case "$charset" in
def);;
*) echo "\033(${charset}\c";;
esac
case "$spacing" in
def);;
*) echo "\033(s${spacing}P\c";;
esac
case "$pitch" in
def);;
c) echo "\033&k2S\c";;
*) echo "\033(s${pitch}H\c";;
esac
case "$hsi" in
def);;
*) echo "\033&k${hsi}H\c";;
esac
case "$height" in
def);;
*) echo "\033(s${height}V\c";;
esac
case "$style" in
def);;
italic) echo "\033(s1S\c"
italic="-i";;
*) echo "\033(s${style}S\c";;
esac
case "$weight" in
def);;
*) echo "\033(s${weight}B\c";;
esac
case "$typeface" in
def);;
*) echo "\033(s${typeface}T\c";;
esac
case "$lmargin" in
def);;
*) echo "\033&a${lmargin}L\c";;
esac
case "$rmargin" in
def);;
*) echo "\033&a${rmargin}M\c";;
esac
case "$mediadest" in
def);;
*) echo "\033&l${mediadest}G\c";; #
esac
case "$loffset" in
def);;
*) echo "\033&l${loffset}U\c";;
esac
case "$resolution" in
def) ;;
3 | 300) echo "\033*t300R\c" ;;
6 | 600) echo "\033*t600R\c" ;;
esac
} # end of Output_PCL_Options()
#----------------------------
# Trap Handler
#----------------------------
CancelJob()
{
rm -f $TMP/generic$$
echo "$jobid is cancelled" >> $log
if [ -t 1 ]
then
stty raw $baudrate -parenb cs8 ixon -istrip clocal <&1 2>/dev/null
fi
exit 0
}
#---------------------------------------------------------
# Setup N up printing (avoid sending unnecessary commands)
#---------------------------------------------------------
Setup_Nup()
{
# reset following if they are set
reverse=""; pitch="def"
hsi="def"; vsi="def"
spacing="def"; lpi="def"
charset="def"; style="def"
typeface="def";
weight="def"; italic=""
lpagelen="def"; length="def"; textlen="def"
lmargin="def"; rmargin="def"
nroff=""
case "$orientation" in
p | def)
orientation="p"
case "$dividing" in
-h);;
-q) fontdl /usr/lib/lp/fonts/lp4p;;
esac;;
l)
case "$dividing" in
-h) fontdl /usr/lib/lp/fonts/lp2l;;
-q) fontdl -l /usr/lib/lp/fonts/lp4l;;
esac;;
esac
}
#----------------------------------------------------------------
# Although net_genericprinter is written with JetDirect in mind,
# it can also be used with serial/parallel connections.
# Following is the only steps needed for non-JetDirect setup.
# In case this script is used for serial/parallel connection,
# Set up tty parameters
#----------------------------------------------------------------
Setup_iface()
{
# for serial connection
baudrate=$BAUDRATE
# Set up interface (parallel/serial, no effect on JetDirect)
if [ -t 1 ]
then
stty raw $baudrate -parenb cs8 ixon -istrip clocal <&1 2>/dev/null
else
if [ "$OS" = "HP-UX" ]
then
slp -r 2>/dev/null
fi
fi
}
# [ Added by Vijay on 14/02/99 to support 2up with landscape option
#----------------------------------------------------------------
# This function is executed when 2up/2+ option is given with
# -olandscape option. expfilen is not used.
# This function takes care of the border lines based on the paper
# sizes for 2up and 2+ options, on reverse portrait and reverse
# landscape and the font type based on the media size.
#----------------------------------------------------------------
setprinter_landscape()
{
# rotate, Symbolset, Spacing, Pitch, Height, Style, Stroke weight and
# Typeface.
# l#O -> orientation, (#U-> Symbol set, s#P-> Spacing,
# s#h -> Height, s#b -> Stroke weight, b#T-> Typeface
# &l#C -> Vertical Motion Index
if [ "$rotate" = "yes" ]
then
echo "\033&l2O\033(8U\033(s021.43h7.4v0s0b5T\033&l3.79C\c"
else
echo "\033&l0O\033(8U\033(s021.43h7.4v0s0b5T\033&l3.79C\c"
fi
# HMI, disable perforation, top margin 4, text length 66, left margin 1
echo "\033&k6.60H\033&l0L\033&l4E\033&a3L\033&l133F\c"
#
# define overlay macro
#
# draw boundary
# macro id = 2, start macro definition
echo "\033&f2y0X\c"
# push cursor position, vertical motion index, full logical page
echo "\033&f0S\033&l1c0E\c"
# Performing paper level operations like setting up
# no. of lines, drawing lines etc.
# l#E -> Top margin, a#l leftmargin
# p#Y -> Vertical Cursor positioning
# c#B -> Vertical Rectangle size, c#P-> Fill area
# c#A -> Horizontal Rectangle size
if [ "$paper" = "ISOA4" -o "$paper" = "def" -o "$paper" = "letter" ]
then
# Start for A4, letter
# letter : 8.5 x 11.0 inches
# A4 : 8.27 x 11.7 inches (Almost close to letter)
echo "\033&l0E\033&a0L\c" # Margin settings
echo "\033*p0x60Y\033*c2336A\033*c1B\033*c0P\c" #Cursor postioning
# and rectangle size
echo "\033*p0x3248Y\033*c2336A\033*c1B\033*c0P\c"
echo "\033*p0x60Y\033*c1A\033*c3188B\033*c0P\c"
echo "\033*p2336x60Y\033*c1A\033*c3188B\033*c0P\c"
echo "\033*p0x1654Y\033*c2336A\033*c1B\033*c0P\c"
echo "\033&l4E\033&a3L\033&l133F\c" # Page settings
# shading
# for 2+ option
if [ "$dividing" = "-hh" ]
then # Solaris 2up may reach here. Use -hh to differentiate
echo "\033*p0x36Y\033*c2336a125b10g2P\c" # Shade top
echo "\033*p0x1629Y\033*c2336a125b10g2P\c" # Shade middle
echo "\033*p1x37Y\033*c125a3188b2P\c" # Shade left
fi
elif [ "$paper" = "ISOA3" ]
then
echo "\033&l0E\033&a0L\c" # Margin settings
echo "\033*p0x60Y\033*c3080A\033*c1B\033*c0P\c" # Cursor positioning
# and rectangle size
echo "\033*p0x4736Y\033*c3080A\033*c1B\033*c0P\c"
echo "\033*p0x60Y\033*c1A\033*c4676B\033*c0P\c"
echo "\033*p3080x60Y\033*c1A\033*c4676B\033*c0P\c"
echo "\033*p0x2368Y\033*3080A\033*c1B\033*c0P\c"
echo "\033*p0x60Y\033*c3080a1b0P\033*p0x2368Y\033*c0P\c"
echo "\033&l4E\033&a3L\033&l268F\c" #Page settings
if [ "$dividing" = "-hh" ]
then
echo "\033*p0x36Y\033*c3080a125b10g2P\c" # Shade top
echo "\033*p0x2343Y\033*c3080a125b10g2P\c" # Shade middle
echo "\033*p1x37Y\033*c120a4676b2P\c" # Shade left
fi
elif [ "$paper" = "legal" ]
then
# Start for legal paper size
echo "\033&l0E\033&a0L\c" # Margin settings
echo "\033*p0x60Y\033*c2324A\033*c1B\033*c0P\c" # Cursor positioning
# and rectangle size
echo "\033*p0x4060Y\033*c2324A\033*c1B\033*c0P\c"
echo "\033*p0x60Y\033*c1A\033*c4000B\033*c0P\c"
echo "\033*p2324x60Y\033*c1A\033*c4000B\033*c0P\c"
echo "\033*p0x2034Y\033*c2324A\033*c1B\033*c0P\c"
echo "\033&l4E\033&a3L\033&l166F\c" # page settings
if [ "$dividing" = "-hh" ]
then
echo "\033*p0x36Y\033*c2324a125b10g2P\c" # Shade top
echo "\033*p0x2009Y\033*c2324a125b10g2P\c" # Shade middle
echo "\033*p1x37Y\033*c120a4000b2P\c" # Shade left
fi
elif [ "$paper" = "exec" ]
then
echo "\033&l0E\033&a0L\c" # Margin settings
echo "\033*p0x60Y\033*c2014A\033*c1B\033*c0P\c" # Cursor positioning
# and rectangle size
echo "\033*p0x3060Y\033*c2014A\033*c1B\033*c0P\c"
echo "\033*p0x60Y\033*c1A\033*c3000B\033*c0P\c"
echo "\033*p2014x60Y\033*c1A\033*c3000B\033*c0P\c"
echo "\033*p0x1534Y\033*c2014A\033*c1B\033*c0P\c"
echo "\033&l4E\033&a3L\033&l121F\c" # No. of lines, Page settings
if [ "$dividing" = "-hh" ]
then
echo "\033*p0x36Y\033*c2014a125b10g2P\c" # Shade top
echo "\033*p0x1509Y\033*c2014a125b10g2P\c" # Shade middle
echo "\033*p1x37Y\033*c120a3000b2P\c" # Shade left
fi
fi
# pop previously saved cursor position
echo "\033&f1S\c"
# end macro definition
echo "\033&f1x2y\c"
# enable macro
#
echo "\033&f4X\c"
# lineperpage is the total no. of lines per page.
# lineperhalf is the no. of lines for each half of the page.
#[ Modified by Devu to fix problems with 2up landscape
# 29th Jul 1999
if [ "$dividing" = "-hh" ] # 2+
then
if [ "$paper" = "ISOA3" ]
then
lineperpage=194
lineperhalf=97
width2up=180
elif [ "$paper" = "legal" ]
then
lineperpage=166
lineperhalf=83
width2up=138
elif [ "$paper" = "exec" ]
then
lineperpage=124
lineperhalf=62
width2up=118
else
lineperpage=134
lineperhalf=67
width2up=138
fi
else
if [ "$paper" = "ISOA3" ]
then
lineperpage=194
#[Change by Kumaresan for 2up page break fix Jul 29 1999
# lineperhalf=97
lineperhalf=96
width2up=180
# ]
elif [ "$paper" = "legal" ]
then
lineperpage=166
#[ Change by Kumaresan
# lineperhalf=83
lineperhalf=82
width2up=138
# ]
elif [ "$paper" = "exec" ]
then
lineperpage=124
# [Changed By Kumaresan for 2up landscape fix Jul 29th 1999
# lineperhalf=62
lineperhalf=61
width2up=118
# end of change Kumaresan]
else
lineperpage=134
lineperhalf=67
width2up=138
fi
fi
# end of modification by Devu Jul 29 1999 ]
if [ "$OS" = "SOLARIS" ]
then
NAWK=/usr/bin/nawk
else
NAWK=/usr/bin/awk
fi
if [ "$dividing" = "-hh" ] # For 2+
then
[ X$fname = X ] && head="STDIN" || head="$fname"
if [ "$OS" = "HP-UX" ]
then
head=${title:-$head} # To display the page header
size=`expr length "$head"`
numdots=`expr 28 - $size / 2`
pad=`expr substr "$white" 1 $numdots`
head="$pad$head $pad"
elif [ "$OS" = "SOLARIS" ] # To display the page header for Solaris
then
size=`echo "$head" | wc -c`
numdots=`expr 28 - $size / 2`
pad=`echo "$white" | cut -c1-$numdots`
head="$pad$head $pad"
fi
expand $file | # expands tabs and whitespace characters.
pr -n" " -h "$head" -l$lineperhalf |
# pr provides the formatted output with headers
# and footers.
$NAWK -v lineperhalf=$lineperhalf ' {
print } ' |
# awk inserts a line at every half
# [ Changed by Devu to avoid lines crossing Jul 30 1999
# pr -l$lineperpage -t -f
pr -l$lineperpage -t -f | cut -c 1-$width2up
# end Change by Devu ]
# Finally pr splits it into pages using -f
# ( Form feed ).
else
# [ Added by Devu an if and else to handle 2up page Break problems
# 29 Jul 1999
if [ "$paper" = "letter" -o "$paper" = "def" -o "$paper" = "ISOA4" ]
then
expand $file | # expands tabs and whitespace characters
pr -t | # Provides the output without header and footer.
$NAWK -v lineperhalf=$lineperhalf ' {
if ( NR%lineperhalf == 0 ) {
printf "\n"
NR++ }
print } ' |
# nawk will insert line at every half page.
# [ Changed by Devu to avoid lines crossing Jul 30 1999
# pr -l$lineperpage -t -f
pr -l$lineperpage -t -f | cut -c 1-$width2up
# end Change by Devu ]
# Finally it splits into different pages using -f
else
expand $file | Page_Break_Filter_4up8up |
pr -t | # Provides the output without header and footer.
$NAWK -v lineperhalf=$lineperhalf ' {
# [ Changed by Devu for 2up page Break handling 29 Jul 1999
# if ( NR%lineperhalf == 0 ) {
if ( NR% (lineperhalf+1) == 0 ) {
# end of Change Devu ]
printf "\n"
NR++ }
print } ' |
# nawk will insert line at every half page.
# [ Changed by Devu to avoid lines crossing Jul 30 1999
# pr -l$lineperpage -t -f
pr -l$lineperpage -t -f | cut -c 1-$width2up
# end Change by Devu ]
# Finally it splits into different pages using -f
fi
# End of if else Devu ]
fi
echo "\033E\c" # End of PCL command
}
# End of addition by Vijay ]
# [Added by Kumaresan on 29th July 99
# Function to handle page break for 2/4/8up
Page_Break_Filter_4up8up()
{
$NAWK -F"" -v lineperhalf=$lineperhalf '{
if ( '/\\f/' && NR % lineperhalf != 0)
{
linesread=NR % lineperhalf
linestoprint=lineperhalf - linesread
sub("","",$1)
if ($1 == "")
{
printf "\n"
}
else
{
print $1
}
while (linestoprint)
{
printf "\n"
NR++
linestoprint--
}
if ($2 != NULL)
{
NR++
print $2
}
maxfield=NF
nextfield=3
while (maxfield >2)
{
sub("","",$nextfield)
linestoprint2=lineperhalf-1
while (linestoprint2)
{
printf "\n"
NR++
linestoprint2--
}
if ($nextfield =="")
{
if ($(nextfield+1) == NULL)
{
if (nextfield ==3)
NR--
}
else
{
printf "\n"
NR++
}
}
else if ($nextfield == "\n")
{
printf "\n"
}
else
{
print $nextfield
}
maxfield--
nextfield++
if (maxfield ==2)
NR++
}
}
else
print
}'
}
# ]
#[ adjustlength3():
# Added by Devu for 4up printing. Jul 16 1999
adjustlength3()
{
awk ' NR>0 { print } # if NR > 1, but it will lose the first line
END { if( NR % 264 > 0 )
{
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n"
}
print
}'
}
#end of adjustlength3() by Devu ]
#[adjustlength4()
#Added by Devu to fix problems with 8up printing. Jul 16 1999
adjustlength4()
{
awk ' NR>0 { print } # if NR > 1, but it will lose the first line
END { if( NR % 264 > 0 )
{
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n"
}
print
}'
}
#end adjustlength4() Devu jul 16 1999 ]
# [ Modified by Amit Raval to fix the defect# 57427 on Apr 16. 1999
Setup_4up_landscape()
{
# landscape, symbolset 8U, font matrix
if [ "$rotate" = "yes" ]
then
echo "\033&l3O\033(8U\033(s0p4.0v0s0b25093t24.00H\033&l2.75C\c"
else
echo "\033&l1O\033(8U\033(s0p4.0v0s0b25093t24.00H\033&l2.75C\c"
fi
# HMI, disable perforation, top margin 4, text length 66, left margin 1
echo "\033&k6.30H\033&l0l8e66F\033&a2L\c"
#
# define overlay macro
#
# draw boundary
# macro id = 2, start macro definition
echo "\033&f2y0X\c"
# push cursor position, vertical motion index, full logical page
echo "\033&f0S\033&l1c0E\c"
if [ "$paper" = "letter" -o "$paper" = "def" -o "$paper" = "ISOA4" ]
then
# for letter size and A4
echo "\033*p0x100Y\033*c3178a1b0P\033*p0x2428Y\033*c0P\c"
echo "\033*p0x100Y\033*c1a2336b0P\033*p1587x100Y\033*c0P\c"
echo "\033*p3178x100Y\033*c0P\c"
echo "\033*p0x1270Y\033*c3178a1b0P\c"
elif [ "$paper" = "legal" ]
then
# for legal size, top and bottom horizontal lines
echo "\033*p0x100Y\033*c4000a1b0P\033*p0x2428Y\033*c0P\c"
# 3 vertical lines
echo "\033*p0x100Y\033*c1a2329b0P\033*p1997x100Y\033*c0P\c"
echo "\033*p4000x100Y\033*c0P\c"
echo "\033*p0x1270Y\033*c4000a1b0P\c"
elif [ "$paper" = "exec" ]
then
# paper size : exec
echo "\033*p0x100Y\033*c3000a1b0P\033*p0x2118Y\033*c0P\c"
echo "\033*p0x100Y\033*c1a2050b0P\033*p1492x100Y\033*c0P\c"
echo "\033*p3000x100Y\033*c0P\c"
echo "\033*p0x1120Y\033*c3000a1b0P\c"
elif [ "$paper" = "ISOA3" ]
then
# A3 paper size ( Calculated as double the size of A4 in portrait form)
echo "\033*p0x100Y\033*c4676a1b0P\033*p0x3184Y\033*c0P\c"
echo "\033*p0x1654Y\033*c4676a1b0P\c"
echo "\033*p0x100Y\033*c1a3083b0P\033*p2329x100Y\033*c0P\c"
echo "\033*p4676x100Y\033*c0P\c"
fi
# pop previously saved cursor position
echo "\033&f1S\c"
# end macro definition
echo "\033&f1x2y\c"
# enable macro
#
echo "\033&f4X\c"
# lineperpage is the total no. of lines per page.
# lineperhalf is the no. of lines for each half of the page.
if [ "$paper" = "ISOA3" ]
then
lineperpage=176 # 88*2
# [ Modified by Vijay on 27/7/99 to solve 4up landscape problem
# lineperhalf=89
lineperhalf=88
# End of change by Vijay ]
width4up=293 # 146*2 + 1
elif [ "$paper" = "legal" ]
then
lineperpage=132 # 66*2
# [ Modified by Vijay on 27/7/99 to solve 4up landscape problem
# lineperhalf=67
lineperhalf=66
# End of change by Vijay ]
width4up=251 # 125*2 + 1
elif [ "$paper" = "exec" ]
then
lineperpage=114 # 57*2
# [ Modified by Vijay on 27/7/99 to solve 4up landscape problem
# lineperhalf=58
lineperhalf=57
# End of change by Vijay ]
width4up=187 # 93*2 + 1
elif [ "$paper" = "letter" -o "$paper" = "def" -o "$paper" = "ISOA4" ]
then
lineperpage=132 # 66*2
# [ Modified by Vijay to rectify 4up landscape problem
# lineperhalf=67
lineperhalf=66
# End of change by Vijay ]
# [ Modified by Devu to fix the problem of 4up printing in HP-UX on May 17, 1999. Defect # 57839
#width4up=177 # 88*2 + 1
width4up=199
# End of change by Devu ]
fi
# [ Modified by Devu to fix the problem of 4up printing in HP-UX on May 17, 1999. Defect # 57839
# Uncommented NAWK for HP-UX
if [ "$OS" = "SOLARIS" ]
then
NAWK=/usr/bin/nawk
else
NAWK=/usr/bin/awk
fi
# end of uncomment Devu ]
#[ Commented by Devu to fix problems in 4up printing jul 16 1999
# expand $file | # expands tabs and whitespace characters
# pr -l$lineperpage -t -f -2 -w$width4up |
# end of commenting Devu jul 16 1999 ]
#[[added by devu for latest fix 4up
# [Modified by Kumaresan for 2/4/8up printing on 29th July 99
#expand $file | Page_Break_Filter | pr -e4 -t -l$lineperpage | adjustlength3 |
expand $file | Page_Break_Filter_4up8up | pr -e4 -t -l$lineperpage | adjustlength3 |
# ]
pr -l$lineperpage -t -f -2 -w$width4up |
# end addition Devu jul 16 1999]]
$NAWK -v lineperhalf=$lineperhalf ' {
# [Modified by Kumaresan for 2/4/8up printing on 29th July 99
# if ( NR%lineperhalf == 0 ) {
if ( NR%(lineperhalf+1) == 0 ) {
# ]
printf "\n" # Insert empty line at every half page
NR++ }
print } '
# Finally it splits into different pages using -f
echo "\033E\c"
}
Setup_4up_portrait()
{
# rotate, Symbolset, Spacing, Pitch, Height, Style, Stroke weight and
# Typeface.
if [ "$rotate" = "yes" ]
then
echo "\033&l2O\033(8U\033(s0p7.8v0s1b4102t30.00H\033&l3.77C\c"
else
echo "\033&l0O\033(8U\033(s0p7.8v0s1b4102t30.00H\033&l3.77C\c"
fi
# HMI, disable perforation, top margin 4, text length 66, left margin 1
echo "\033&k5.70H\033&l0L\033&l5E\033&a2L\033&l133F\c"
#
# define overlay macro
#
# draw boundary
# macro id = 2, start macro definition
echo "\033&f2y0X\c"
# push cursor position, vertical motion index, full logical page
echo "\033&f0S\033&l1c0E\c"
# Performing paper level operations like setting up
# no. of lines, drawing lines etc.
# l#E -> Top margin, a#l leftmargin
# p#Y -> Vertical Cursor positioning
# p#X -> Horizontal Cursor positioning
# c#B -> Vertical Rectangle size, c#P-> Fill area
# c#A -> Horizontal Rectangle size
if [ "$paper" = "ISOA4" -o "$paper" = "def" -o "$paper" = "letter" ]
then
# Start for A4, letter
# letter : 8.5 x 11.0 inches
# A4 : 8.27 x 11.7 inches (Almost close to letter)
echo "\033&l0E\033&a0L\c" # Margin settings
echo "\033*p0x60Y\033*c2336A\033*c1B\033*c0P\c" # Cursor positioning &
# rectangle size
echo "\033*p0x3250Y\033*c2336A\033*c1B\033*c0P\c"
echo "\033*p0x60Y\033*c1A\033*c3190B\033*c0P\c" # Draw left vertical
echo "\033*p2336x60Y\033*c1A\033*c3190B\033*c0P\c" # Draw right vertical
echo "\033*p0x1672Y\033*c2336A\033*c1B\033*c0P\c"
echo "\033*p1168x60Y\033*c1A\033*c3190B\033*c0P\c"
echo "\033&l4E\033&a3L\033&l133F\c" # No. of lines and page settings
elif [ "$paper" = "ISOA3" ]
then
echo "\033&l0E\033&a0L\c" # Margin settings
echo "\033*p0x60Y\033*c3080A\033*c1B\033*c0P\c" # Cursor positioning &
# rectangle size
echo "\033*p0x4736Y\033*c3080A\033*c1B\033*c0P\c"
echo "\033*p0x60Y\033*c1A\033*c4676B\033*c0P\c"
echo "\033*p3080x60Y\033*c1A\033*c4676B\033*c0P\c"
echo "\033*p1544x60Y\033*c1A\033*c4676B\033*c0P\c" # Middle vertical line
echo "\033*p0x60Y\033*c3080a1b0P\033*p0x2402Y\033*c0P\c"
echo "\033&l4E\033&a3L\033&l268F\c" # No. of lines and page settings
elif [ "$paper" = "legal" ]
then
# Start for legal paper size
echo "\033&l0E\033&a0L\c" # Margin settings
echo "\033*p0x60Y\033*c2324A\033*c1B\033*c0P\c" # Cursor positioning &
# rectangls size
# Top horizontal line
echo "\033*p0x4060Y\033*c2324A\033*c1B\033*c0P\c" # bottom horizontal
echo "\033*p0x60Y\033*c1A\033*c4000B\033*c0P\c" # left vertical line
echo "\033*p2324x60Y\033*c1A\033*c4000B\033*c0P\c" # Right vertical line
echo "\033*p0x2076Y\033*c2324A\033*c1B\033*c0P\c" # Middle Hirizontal
echo "\033*p1166x60Y\033*c1A\033*c4000B\033*c0P\c" # Middle vertical line
echo "\033&l4E\033&a3L\033&l166F\c" # No. of lines and page settings
elif [ "$paper" = "exec" ]
then
echo "\033&l0E\033&a0L\c" # Margin settings
echo "\033*p0x60Y\033*c2014A\033*c1B\033*c0P\c" # Cursor positioning &
# rectangle size
echo "\033*p0x3060Y\033*c2014A\033*c1B\033*c0P\c"
echo "\033*p0x60Y\033*c1A\033*c3000B\033*c0P\c"
echo "\033*p2014x60Y\033*c1A\033*c3000B\033*c0P\c"
echo "\033*p1009x60Y\033*c1A\033*c3000B\033*c0P\c" # Middle vertical line
echo "\033*p0x1577Y\033*c2014A\033*c1B\033*c0P\c"
echo "\033&l4E\033&a3L\033&l121F\c" # No. of lines and Page settings
fi
# pop previously saved cursor position
echo "\033&f1S\c"
# end macro definition
echo "\033&f1x2y\c"
# enable macro
#
echo "\033&f4X\c"
# lineperpage is the total no. of lines per page.
# lineperhalf is the no. of lines for each half of the page.
if [ "$paper" = "ISOA3" ]
then
lineperpage=194 # 97*2
lineperhalf=97
width4up=214 # 106*2 + 1
elif [ "$paper" = "legal" ]
then
lineperpage=166 # 83*2
lineperhalf=83
width4up=161 # 80*2 + 1
elif [ "$paper" = "exec" ]
then
lineperpage=124 # 62*2
lineperhalf=62
width4up=139 # 69*2 + 1
elif [ "$paper" = "letter" -o "$paper" = "def" -o "$paper" = "ISOA4" ]
then
lineperpage=132 # 66*2
lineperhalf=66
width4up=161 # 80*2 + 1
fi
# [ Modified by Devu to fix the problem of 4up printing in HP-UX on May 17, 1999. Defect # 57839
# Uncommented NAWK for HP-UX
if [ "$OS" = "SOLARIS" ]
then
NAWK=/usr/bin/nawk
else
NAWK=/usr/bin/awk
fi
# End of change by Devu ]
#[ Commented by Devu to fix problems in 4up printing jul 16 1999
# expand $file | # expands tabs and whitespace characters
# pr -l$lineperpage -t -f -2 -w$width4up |
# end of commenting Devu jul 16 1999 ]
#[ Added by devu to fix 4up printing jul 16 1999
# [Modified by Kumaresan for 2/4/8up printing on 29th July 99
# expand $file | Page_Break_Filter | pr -e4 -t -l$lineperpage | adjustlength3 |
expand $file | Page_Break_Filter_4up8up | pr -e4 -t -l$lineperpage | adjustlength3 |
# ]
pr -l$lineperpage -t -f -2 -w$width4up |
#end of addition by Devu Jul 16 1999
$NAWK -v lineperhalf=$lineperhalf ' {
print
if ( NR%lineperhalf == 0 ) {
printf "\n" # Insert empty line at every half page.
}
} '
# Finally it splits into different pages using -f
echo "\033E\c"
}
setprinter_8up_landscape()
{
# rotate, Symbolset, Spacing, Pitch, Height, Style, Stroke weight and
# Typeface.
if [ "$rotate" = "yes" ]
then
echo "\033&l2O\033(8U\033(s0p3.0v0s0b16602t30.00H\033&l1.90C\c"
else
echo "\033&l0O\033(8U\033(s0p3.0v0s0b16602t30.00H\033&l1.90C\c"
fi
# HMI, disable perforation, top margin 4, text length 66, left margin 1
echo "\033&k5.20H\033&l0L\033&l7E\033&a2L\033&l133F\c"
#
# define overlay macro
#
# draw boundary
# macro id = 2, start macro definition
echo "\033&f2y0X\c"
# push cursor position, vertical motion index, full logical page
echo "\033&f0S\033&l1c0E\c"
# Performing paper level operations like setting up
# no. of lines, drawing lines etc.
# l#E -> Top margin, a#l leftmargin
# p#Y -> Vertical Cursor positioning
# p#X -> Horizontal Cursor positioning
# c#B -> Vertical Rectangle size, c#P-> Fill area
# c#A -> Horizontal Rectangle size
if [ "$paper" = "ISOA4" -o "$paper" = "def" -o "$paper" = "letter" ]
then
# Start for A4, letter
# letter : 8.5 x 11.0 inches
# A4 : 8.27 x 11.7 inches (Almost close to letter)
echo "\033&l0E\033&a0L\c" # Margin settings
echo "\033*p0x60Y\033*c2336A\033*c1B\033*c0P\c" # Cursor positioning &
# rectangle size
echo "\033*p0x3250Y\033*c2336A\033*c1B\033*c0P\c"
echo "\033*p0x60Y\033*c1A\033*c3190B\033*c0P\c" # Draw left vertical
echo "\033*p2336x60Y\033*c1A\033*c3190B\033*c0P\c" # Draw right vertical
echo "\033*p0x1661Y\033*c2336A\033*c1B\033*c0P\c"
echo "\033*p0x866Y\033*c2336A\033*c1B\033*c0P\c"
echo "\033*p0x2458Y\033*c2336A\033*c1B\033*c0P\c"
echo "\033*p1168x60Y\033*c1A\033*c3190B\033*c0P\c"
echo "\033&l4E\033&a3L\033&l133F\c" # No. of lines and page settings
elif [ "$paper" = "ISOA3" ]
then
echo "\033&l0E\033&a0L\c" # Margin settings
echo "\033*p0x60Y\033*c3080A\033*c1B\033*c0P\c" # Cursor positioning &
# rectangle size
echo "\033*p0x4736Y\033*c3080A\033*c1B\033*c0P\c"
echo "\033*p0x60Y\033*c1A\033*c4676B\033*c0P\c"
echo "\033*p3080x60Y\033*c1A\033*c4676B\033*c0P\c"
echo "\033*p1544x60Y\033*c1A\033*c4676B\033*c0P\c" # Middle vertical line
echo "\033*p0x60Y\033*c3080a1b0P\033*p0x2397Y\033*c0P\c"
echo "\033*p0x1234Y\033*c3080A\033*c1B\033*c0P\c" # Above-Middle Hirizontal
echo "\033*p0x3562Y\033*c3080A\033*c1B\033*c0P\c" # Below-Middle Hirizontal
echo "\033&l4E\033&a3L\033&l268F\c" # No. of lines and page settings
elif [ "$paper" = "legal" ]
then
# Start for legal paper size
echo "\033&l0E\033&a0L\c" # Margin settings
echo "\033*p0x60Y\033*c2324A\033*c1B\033*c0P\c" # Cursor positioning &
# rectangls size
# Top horizontal line
echo "\033*p0x4060Y\033*c2324A\033*c1B\033*c0P\c" # bottom horizontal
echo "\033*p0x60Y\033*c1A\033*c4000B\033*c0P\c" # left vertical line
echo "\033*p2324x60Y\033*c1A\033*c4000B\033*c0P\c" # Right vertical line
echo "\033*p0x2064Y\033*c2324A\033*c1B\033*c0P\c" # Middle Hirizontal
echo "\033*p0x1068Y\033*c2324A\033*c1B\033*c0P\c" # Above-Middle Hirizontal
echo "\033*p0x3064Y\033*c2324A\033*c1B\033*c0P\c" # Below-Middle Hirizontal
echo "\033*p1166x60Y\033*c1A\033*c4000B\033*c0P\c" # Middle vertical line
echo "\033&l4E\033&a3L\033&l166F\c" # No. of lines and page settings
elif [ "$paper" = "exec" ]
then
echo "\033&l0E\033&a0L\c" # Margin settings
echo "\033*p0x60Y\033*c2014A\033*c1B\033*c0P\c" # Cursor positioning &
# rectangle size
echo "\033*p0x3060Y\033*c2014A\033*c1B\033*c0P\c"
echo "\033*p0x60Y\033*c1A\033*c3000B\033*c0P\c"
echo "\033*p2014x60Y\033*c1A\033*c3000B\033*c0P\c"
echo "\033*p1009x60Y\033*c1A\033*c3000B\033*c0P\c" # Middle vertical line
echo "\033*p0x1565Y\033*c2014A\033*c1B\033*c0P\c"
echo "\033&l4E\033&a3L\033&l121F\c" # No. of lines and Page settings
echo "\033*p0x792Y\033*c2014A\033*c1B\033*c0P\c" # Above-Middle Hirizontal
echo "\033*p0x2289Y\033*c2014A\033*c1B\033*c0P\c" # Below-Middle Hirizontal
fi
# pop previously saved cursor position
echo "\033&f1S\c"
# end macro definition
echo "\033&f1x2y\c"
# enable macro
#
echo "\033&f4X\c"
# lineperpage is the total no. of lines per page.
# lineperhalf is the no. of lines for each half of the page.
if [ "$paper" = "ISOA3" ]
then
lineperpage=388 # 97*4
lineperhalf=97
width8up=235 # 117*2 + 1
elif [ "$paper" = "legal" ]
then
lineperpage=332 # 83*4
lineperhalf=83
width8up=177 # 88*2 + 1
elif [ "$paper" = "exec" ]
then
lineperpage=248 # 62*4
lineperhalf=62
width8up=153 # 76*2 + 1
elif [ "$paper" = "ISOA4" -o "$paper" = "def" -o "$paper" = "letter" ]
then
lineperpage=264 # 66*4
lineperhalf=66
width8up=177 # 88*2 + 1
fi
if [ "$OS" = "SOLARIS" ]
then
NAWK=/usr/bin/nawk
else
NAWK=/usr/bin/awk
fi
# [ Commented by Devu to fix problems in 8up printing jul 16 1999
# expand $file | # expands tabs and whitespace characters
# pr -l$lineperpage -t -f -2 -w$width8up |
# end of comment ]
#[Added by devu to fix problems in 8up printing jul 16 1999
# [Modified by Kumaresan for 2/4/8up printing on 29th July 99
#expand $file | Page_Break_Filter | pr -e4 -t -l$lineperpage | adjustlength4 |
expand $file | Page_Break_Filter_4up8up | pr -e4 -t -l$lineperpage | adjustlength4 |
# ]
pr -l$lineperpage -t -f -2 -w$width8up |
#end of addition by Devu jul 16 1999]
$NAWK -v lineperhalf=$lineperhalf ' {
print
if ( NR%lineperhalf == 0 ) {
printf "\n" # Insert empty line at every half page.
}
} '
# Finally it splits into different pages using -f
echo "\033E\c"
}
setprinter_8up_portrait()
{
# landscape, symbolset 8U, font matrix
if [ "$rotate" = "yes" ]
then
echo "\033&l3O\033(8U\033(s0p4.0v0s0b25093t35.00H\033&l2.75C\c"
else
echo "\033&l1O\033(8U\033(s0p4.0v0s0b25093t35.00H\033&l2.75C\c"
fi
# HMI, disable perforation, top margin 4, text length 66, left margin 1
echo "\033&k3.90H\033&l0l8e66F\033&a2L\c"
#
# define overlay macro
#
# draw boundary
# macro id = 2, start macro definition
echo "\033&f2y0X\c"
# push cursor position, vertical motion index, full logical page
echo "\033&f0S\033&l1c0E\c"
if [ "$paper" = "letter" -o "$paper" = "def" -o "$paper" = "ISOA4" ]
then
# for letter size
echo "\033*p0x100Y\033*c3178a1b0P\033*p0x2428Y\033*c0P\c"
echo "\033*p0x100Y\033*c1a2336b0P\033*p1587x100Y\033*c0P\c"
echo "\033*p3178x100Y\033*c0P\c"
echo "\033*p2380x100Y\033*c0P\c"
echo "\033*p800x100Y\033*c0P\c"
echo "\033*p0x1270Y\033*c3178a1b0P\c"
elif [ "$paper" = "legal" ]
then
# for legal size, top and bottom horizontal lines
echo "\033*p0x100Y\033*c4000a1b0P\033*p0x2428Y\033*c0P\c"
# 3 vertical lines
echo "\033*p0x100Y\033*c1a2329b0P\033*p1997x100Y\033*c0P\c"
echo "\033*p4000x100Y\033*c0P\c"
echo "\033*p1004x100Y\033*c0P\c"
echo "\033*p2994x100Y\033*c0P\c"
echo "\033*p0x1270Y\033*c4000a1b0P\c"
elif [ "$paper" = "exec" ]
then
# paper size : exec
echo "\033*p0x100Y\033*c3000a1b0P\033*p0x2118Y\033*c0P\c"
echo "\033*p0x100Y\033*c1a2050b0P\033*p1492x100Y\033*c0P\c"
echo "\033*p3000x100Y\033*c0P\c"
echo "\033*p750x100Y\033*c0P\c"
echo "\033*p2230x100Y\033*c0P\c"
echo "\033*p0x1120Y\033*c3000a1b0P\c"
elif [ "$paper" = "ISOA3" ]
then
# A3 paper size ( Calculated as double the size of A4 in portrait form)
echo "\033*p0x100Y\033*c4676a1b0P\033*p0x3184Y\033*c0P\c"
echo "\033*p0x1654Y\033*c4676a1b0P\c"
echo "\033*p0x100Y\033*c1a3083b0P\033*p2329x100Y\033*c0P\c"
echo "\033*p4676x100Y\033*c0P\c"
echo "\033*p1170x100Y\033*c0P\c"
echo "\033*p3491x100Y\033*c0P\c"
fi
# pop previously saved cursor position
echo "\033&f1S\c"
# end macro definition
echo "\033&f1x2y\c"
# enable macro
#
echo "\033&f4X\c"
# lineperpage is the total no. of lines per page.
# lineperhalf is the no. of lines for each half of the page.
if [ "$paper" = "ISOA3" ]
then
lineperpage=176 # 88*2
# [ Modified by Vijay to solve 8up portrait problem on 27/7/99
# lineperhalf=89
lineperhalf=88
# End of change by Vijay ]
width8up=475 # 118*4 + 3
elif [ "$paper" = "legal" ]
then
lineperpage=132 # 66*2
# [ Modified by Vijay to solve 8up portrait problem on 27/7/99
# lineperhalf=67
lineperhalf=66
# End of change by Vijay ]
width8up=407 # 101*4 + 3
elif [ "$paper" = "exec" ]
then
lineperpage=114 # 57*2
# [ Modified by Vijay to solve 8up portrait problem on 27/7/99
# lineperhalf=58
lineperhalf=57
# End of change by Vijay ]
width8up=303 # 75*4 + 3
elif [ "$paper" = "ISOA4" -o "$paper" = "def" -o "$paper" = "letter" ]
then
lineperpage=132 # 66*2
# [ Modified by Vijay to solve 8up portrait problem on 27/7/99
# lineperhalf=67
lineperhalf=66
# End of change by Vijay ]
width8up=323 # 80*4 + 3
fi
if [ "$OS" = "SOLARIS" ]
then
NAWK=/usr/bin/nawk
else
NAWK=/usr/bin/awk
fi
#[Commented by Devu to fix problems in 8up printing jul 16 1999
# expand $file | # expands tabs and whitespace characters
# pr -l$lineperpage -t -f -4 -w$width8up |
#end of Comment Devu jul 16 1999 ]
#[Added by Devu to fix problems in 8up printing jul 16 1999
# [Modified by Kumaresan for 2/4/8up printing on 29th July 99
#expand $file | Page_Break_Filter | pr -e4 -t -l$lineperpage | adjustlength4 |
# Line feed removed through sed
expand $file | sed 's/
//g' | Page_Break_Filter_4up8up | pr -e4 -t -l$lineperpage | adjustlength4 |
# ]
pr -l$lineperpage -t -f -4 -w$width8up |
#end Addition Devu jul 16 1999 ]
$NAWK -v lineperhalf=$lineperhalf ' {
# [Modified by Kumaresan for 2/4/8up printing on 29th July 99
# if ( NR%lineperhalf == 0 ) {
if ( NR%(lineperhalf+1) == 0 ) {
# ]
printf "\n" # Insert empty line at every half page.
NR++ }
print } '
# Finally it splits into different pages using -f
echo "\033E\c"
}
# ]
#----------------------------------------------------------------
# 2up functions. expfilen is not used
#----------------------------------------------------------------
setprinter()
{
#[ Earlier setprinter functionality of this script
# is overwritten by setprinter() of net_ljx000 to support
#various paper sizes other than A4 Devu 20th Jul 1999 ]
# [Modified by Amit R for fixing problem of not printing 2up for A4
# on 22nd Dec97
# if [ "$paper" = "letter" -o "$paper" = "def" ]
# [ Modified by Vijay for not printing 2up option for other paper sizes
# Defect No : 51657 Date : 4/9/98
#
# The following are the old source codes --- Vijay
#
# if [ "$paper" = "letter" -o "$paper" = "def" -o "$paper" = "ISOA4" ]
#
# Modified Source code --- Vijay
#
if [ "$paper" = "letter" -o "$paper" = "def" -o "$paper" = "ISOA4" -o "$paper" = "exec" -o "$paper" = "legal" ]
# ]
# End of change by Vijay ]
then
# landscape, symbolset 8U, font matrix
if [ "$rotate" = "yes" ]
then
echo "\033&l3O\033(8U\033(s0p8.5v0s0b0t16.66H\033)s16.66H\033&l5.59C\c"
else
echo "\033&l1O\033(8U\033(s0p8.5v0s0b0t16.66H\033)s16.66H\033&l5.59C\c"
fi
# HMI, disable perforation, top margin 4, text length 66, left margin 1
# [ Modified by Amit Raval to fix the defect 57425 on Apr. 22nd 1999
# echo "\033&k7.10H\033&l0l4e66F\033&a1L\c"
echo "\033&k7.10H\033&l0l3e66F\033&a1L\c" # Change top margin to 3
# ]
else
# 11x17 size: landscape, symbolset 8U, 10.7 pitch, 7.4 vsi
if [ "$rotate" = "yes" ]
then
echo "\033&l3O\033(8U\033(s10.7H\033&l7.4C\c"
else
echo "\033&l1O\033(8U\033(s10.7H\033&l7.4C\c"
fi
# disable perforation, top margin 3, text length 66, left margin 3
# [ Modified by Amit Raval to fix the defect# 57426 on Apr. 21th 1999
# echo "\033&l0l3e66F\033&a3L\c"
if [ "$paper" = "ISOA3" ]
then
echo "\033&l0l3e66F\033&a0L\c"
else
echo "\033&l0l3e66F\033&a3L\c"
fi
# ]
fi
# [ Modified by Vijay for not printing 2up option for other paper sizes
# Defect No : 51657 Date : 4/9/98
# The following lines defines the length and width for different paper sizes for 2up option.
case "$paper" in
"exec")
length2up="-l55"
halfwidth2up=65
width2up=170;;
"legal" )
length2up="-l63"
halfwidth2up=132
width2up=226;;
"ISOA3")
length2up="-l66"
halfwidth2up=78
# [ Modified by Amit Raval to fix the defect 57426 on Apr. 21th 1999
# width2up=162;;
width2up=167;;
# ]
*) halfwidth2up=88;;
esac
# End of change by Vijay ]
#
# define overlay macro
#
# draw boundary
# macro id = 2, start macro definition
echo "\033&f2y0X\c"
# push cursor position, vertical motion index, full logical page
echo "\033&f0S\033&l1c0E\c"
# [Modified by Amit R for fixing problem of not printing 2up for A4
# on 22nd Dec97
# if [ "$paper" = "letter" -o "$paper" = "def" ]
if [ "$paper" = "letter" -o "$paper" = "def" -o "$paper" = "ISOA4" ]
# ]
then
# for letter size
# [ The following line is modified on 19/1/98 to fix the problem of
# non printing of bottom line with 2up option
# echo "\033*p0x100Y\033*c3178a1b0P\033*p0x2436Y\033*c0P\c"
# [ Modified by Amit Raval to fix the defect 57425 on Apr. 22nd 1999
# echo "\033*p0x100Y\033*c3178a1b0P\033*p0x2428Y\033*c0P\c"
echo "\033*p0x50Y\033*c3178a1b0P\033*p0x2416Y\033*c0P\c" # Adjust Top-Line
# ]
# ]
# [ Modified by Amit Raval to fix the defect 57425 on Apr. 22nd 1999
# echo "\033*p0x100Y\033*c1a2336b0P\033*p1587x100Y\033*c0P\c"
# echo "\033*p3178x100Y\033*c0P\c"
echo "\033*p0x50Y\033*c1a2366b0P\033*p3178x50Y\033*c0P\c" # Adjust vertical lines
echo "\033*p1587x50Y\033*c0P\c" # Adjust bottom line
# ]
# shading
if [ "$dividing" = "-hh" ]
then # Solaris 2up may reach here. Use -hh to differentiate
# [ Modified by Amit Raval to fix the defect 57425 on Apr. 22nd 1999
# echo "\033*p0x100Y\033*c3178a125b10g2P\c"
# echo "\033*p1x101Y\033*c120a2334b2P\033*p1589x101Y\033*c2P\c"
echo "\033*p0x50Y\033*c3178a125b10g2P\c" # Adjust Shedow
echo "\033*p1x51Y\033*c120a2364b2P\033*p1589x51Y\033*c2P\c"
# ]
fi
# [ Modified by Vijay for not printing 2up option for other paper sizes
# Defect No : 51657 Date : 4/9/98
#
# The following are the old source codes --- Vijay
#
# else
# # for 11x17 size, top and bottom horizontal lines
# echo "\033*p47x100Y\033*c4932a1b0P\033*p47x3206Y\033*c0P\c"
# # 3 vertical lines
# echo "\033*p47x100Y\033*c1a3106b0P\033*p2492x100Y\033*c0P\c"
# echo "\033*p4979x100Y\033*c0P\c"
# # shading
# if [ "$dividing" = "-hh" ]
# then
# echo "\033*p47x100Y\033*c4932a125b10g2P\c"
# echo "\033*p48x101Y\033*c180a3106b2P\033*p2494x101Y\033*c240a3106b2P\c"
# fi
# fi
#
# Modified code --- Vijay
#
elif [ "$paper" = "11x17" -o "$paper" = "ledger" ]
then
# for 11x17 size, top and bottom horizontal lines
echo "\033*p47x100Y\033*c4932a1b0P\033*p47x3206Y\033*c0P\c"
# 3 vertical lines
echo "\033*p47x100Y\033*c1a3106b0P\033*p2492x100Y\033*c0P\c"
echo "\033*p4979x100Y\033*c0P\c"
# shading
if [ "$dividing" = "-hh" ]
then
echo "\033*p47x100Y\033*c4932a125b10g2P\c"
echo "\033*p48x101Y\033*c180a3106b2P\033*p2494x101Y\033*c240a3106b2P\c"
fi
elif [ "$paper" = "legal" ]
then
# for 11x17 size, top and bottom horizontal lines
echo "\033*p0x100Y\033*c4000a1b0P\033*p0x2428Y\033*c0P\c"
# 3 vertical lines
echo "\033*p0x100Y\033*c1a2336b0P\033*p2000x100Y\033*c0P\c"
echo "\033*p4000x100Y\033*c0P\c"
# shading
if [ "$dividing" = "-hh" ]
then
echo "\033*p0x100Y\033*c4000a125b10g2P\c"
echo "\033*p1x101Y\033*c120a2336b2P\033*p2002x101Y\033*c2P\c"
fi
elif [ "$paper" = "exec" ]
then
# paper size : exec
# [ Modified by Amit Raval to fix the defect# 57426 on Apr. 21th 1999
# echo "\033*p0x100Y\033*c3000a1b0P\033*p0x2118Y\033*c0P\c"
# echo "\033*p0x100Y\033*c1a2336b0P\033*p1500x100Y\033*c0P\c"
# echo "\033*p3000x100Y\033*c0P\c"
echo "\033*p0x100Y\033*c3017a1b0P\033*p0x2124Y\033*c0P\c"
echo "\033*p0x100Y\033*c1a2336b0P\033*p1509x100Y\033*c0P\c"
echo "\033*p3017x100Y\033*c0P\c"
# ]
# shading
if [ "$dividing" = "-hh" ]
then
# [ Modified by Amit Raval to fix the defect# 57426 on Apr. 21th 1999
# echo "\033*p0x100Y\033*c3000a125b10g2P\c"
# echo "\033*p1x101Y\033*c120a2336b2P\033*p1502x101Y\033*c2P\c"
echo "\033*p0x100Y\033*c3017a125b10g2P\c"
echo "\033*p1x101Y\033*c110a2336b2P\033*p1510x101Y\033*c2P\c"
# ]
fi
else
# A3 paper size ( Calculated as double the size of A4 in portrait form)
# [ Modified by Amit Raval to fix the defect# 57426 on Apr. 21th 1999
# echo "\033*p0x100Y\033*c4676a1b0P\033*p0x3184Y\033*c0P\c"
# echo "\033*p0x100Y\033*c1a3078b0P\033*p2336x100Y\033*c0P\c"
echo "\033*p0x100Y\033*c4676a1b0P\033*p0x3176Y\033*c0P\c"
echo "\033*p0x100Y\033*c1a3078b0P\033*p2351x100Y\033*c0P\c"
# ]
echo "\033*p4676x100Y\033*c0P\c"
if [ "$dividing" = "-hh" ]
then
echo "\033*p0x100Y\033*c4676a125b10g2P\c"
# [ Modified by Amit Raval to fix the defect# 57426 on Apr. 21th 1999
# echo "\033*p1x101Y\033*c120a3078b2P\033*p2338x101Y\033*c2P\c"
echo "\033*p1x101Y\033*c140a3078b2P\033*p2352x101Y\033*c2P\c"
# ]
fi
# End of change by Vijay ]
fi
# pop previously saved cursor position
echo "\033&f1S\c"
# end macro definition
echo "\033&f1x2y\c"
# enable macro
#
echo "\033&f4X\c"
}
adjustlength1()
{
awk ' NR>0 { print }
END { if( NR % 140 > 0 )
{
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n"
}
print
} '
}
prepfile1()
{
[ X$fname = X ] && head="STDIN" || head="$fname"
if [ "$OS" = "HP-UX" ]
then
head=${title:-$head}
size=`expr length "$head"`
numdots=`expr 28 - $size / 2`
pad=`expr substr "$white" 1 $numdots`
head="$pad$head $pad"
fi
if [ "$OS" = "SOLARIS" ]
then
size=`echo "$head" | wc -c`
numdots=`expr 28 - $size / 2`
pad=`echo "$white" | cut -c1-$numdots`
head="$pad$head $pad"
fi
# [ commented by Devu to support other paper sizes 20th Jul 1999
# expand $file |
# pr -e4 -n" " -h "$head" -w88 -l70 |
# adjustlength1 | # need this to do padding
# $PR -l70 -t -2 -w178 |
# sed -e ' 2,$ { /^[A-Z]/ { N
# N
# n
# }
# /^$/d
# }'
# End of commenting Devu 19th Jul 1999 ]
# [ Modified by Vijay on 30/7/99 to fix the 2+ & 2up problem for not printing
# properly.
if [ "$OS" = "HP-UX" ]
then
NAWK=/usr/bin/awk
else
NAWK=/usr/bin/nawk
fi
case "$paper" in
"exec") lineperhalf=45;;
"legal") lineperhalf=53;;
"ISOA3") lineperhalf=56;;
*) lineperhalf=56;;
esac
# End of change by Vijay ]
# [ Added by Devu to invoke better 2+ for all paper sizes
expand $file |
# [ Modified by Vijay on 30/7/99 to fix the 2+ & 2up problem for not printing
# properly.
Page_Break_Filter_4up8up |
# End of change by Vijay ]
pr -e4 -n" " -h "$head" -w$halfwidth2up $length2up |
adjustlength1 | # need this to do padding
$PR $length2up -t -2 -w$width2up |
sed -e ' 2,$ { /^[A-Z]/ { N
N
n
}
/^$/d
}'
# End of addition by Devu 20th Jul 1999 ]
echo "\033E"
}
# no thrill,
adjustlength2()
{
awk ' NR>0 { print } # if NR > 1, but it will lose the first line
END { if( NR % 132 > 0 )
{
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
printf "\n\n\n\n\n\n"
}
print
}'
}
prepfile2()
{
# [ Commented by devu to include all paper sizes 19th JUL 1999
#expand $file |
# pr -e4 -t -w88 -l66 |
# adjustlength2 | # need this to do padding
# $PR -l66 -t -2 -w178 |
# sed -e ' 2,$ { /^[A-Z]/ { N
# N
# n
# }
# /^$/d
# }'
# End of Comment Devu ]
# [ Modified by Vijay on 30/7/99 to fix the 2+ & 2up problem for not printing
# properly.
if [ "$OS" = "HP-UX" ]
then
NAWK=/usr/bin/awk
else
NAWK=/usr/bin/nawk
fi
case "$paper" in
"exec") lineperhalf=55;;
"legal") lineperhalf=63;;
"ISOA3") lineperhalf=66;;
*) lineperhalf=66;;
esac
# End of change by Vijay ]
# Added by Devu to Include all paper sizes 19 th Jul 1999
expand $file |
# [ Modified by Vijay on 30/7/99 to fix the 2+ & 2up problem for not printing
# properly.
Page_Break_Filter_4up8up |
# End of change by Vijay ]
pr -e4 -t -w$halfwidth2up $length2up |
adjustlength2 | # need this to do padding
$PR $length2up -t -2 -w$width2up |
sed -e ' 2,$ { /^[A-Z]/ { N
N
n
}
/^$/d
}'
# End of addition by Devu ]
echo "\033E"
}
printfile()
{
# [ Modified by Vijay on 16/2/99 to fix the defect #55274. (2up with landscape
# is not working properly).
if [ "$orientation" = "l" ] # if orientation is landscape
then
if [ "$paper" = "ISOA4" -o "$paper" = "ISOA3" -o "$paper" = "letter" -o "$paper" = "legal" -o "$paper" = "exec" -o "$paper" = "def" ]
then # if paper is A4, letter, A3, legal, exec or def
setprinter_landscape
return
fi
fi
# End of change by Vijay ]
# if orientation is portrait or if the orientation is landscape and the
# paper sizes are the ones that are not supported by setprinter_landscape
setprinter ;
if [ "$dividing" = "-hh" ]
then # 2up with shading
prepfile1 $file
else # 2up w/o shading
prepfile2 $file
fi
}
# ------ Part II Main Body -------
# [ Modified by Amit Raval to fix the defect# 57429 on Apr. 20th 1999
#PATH="$PATH:/usr/bin:/usr/lbin"
PATH="/usr/bin:$PATH:/usr/lbin"
# ]
export PATH
rm -f $TMP/generic*
# set up redirection of stderr
exec 2>>$log
# Save the arguments to the model
jobid=$1
user=$2
title=$3 # CHANGE TITLE
copies=$4 # CHANGE COPIES
options=$5 # CHANGE OPTIONS
opt6=$6
# Assume that the rest of the arguments are files
shift 5
files="$*"
if [ "$OS" != "SOLARIS" ]
then
echo "Start: $jobid `date`" >> $log
fi
# find out orignal submitted system, and real file names
if [ "$OS" = "HP-UX" ]
then
dfname=`basename $opt6`
cfname=`dirname $opt6`/c`expr match $dfname '\d\(.*\)'`
syst=`sed -n "/^H/s/H//p" $cfname`
fnamelist=`grep "^N" $cfname | sed 's/^N//'`
fi
# Handle non-JetDirect interface and cancel traps.
Setup_iface
trap CancelJob 15
# Initialization internal variables
Init_variables
# [[ Added by Devu to handle Banner Tray and Duplex print options 23 sept 1999
Handle_Ban_Tray
Handle_dupprint
# end of Devu ]]
# Determine which options have been invoked
Parsing_Options
# ********** Start sending bytes out ****************
echo "\033%-12345X\c"
# banner page ;
if [ -n "$banner" ]
then
closejob="true"
if [ -z "$reverse" ]
then
do_pcl_banner
banner="" # keep this for back banner
fi
if [ "$listopt" = "yes" ]
then
all_options
fi
else
if [ "$listopt" = "yes" ]
then
closejob="true"
all_options
fi
fi
copy=1
fno=1
while [ $copy -le $copies ]
do
for file in $files
do
WRONGTYPE="false"
if [ "$lang_user" = "AUTO" ]
then
Resolve_Lang
fi
# moved to here from 2up area, so that it can be shared by
# both.
if [ "$OS" = "HP-UX" ]
then
fname=`echo $fnamelist | cut -f$fno -d" "`
if [ -f /usr/bin/file ]
then
if /usr/bin/file $file | cut -f2 -d: | $GREP > /dev/null
then # let it print
WRONGTYPE="true"
fi
fi
fi
# [Added by Devu to stop PDF files here we dont support them now.
# Sept 26 1999
PDFFILE=`head -1 $file | cut -c1-4`
if [ "$PDFFILE" = "%PDF" ]
then
WRONGTYPE="true"
fi
# end of PDF stop by Devu ]
if [ "$WRONGTYPE" = "true" ]
then # skip the rest, go to next file
echo "\033&k2G\c"
echo " ERROR!: "
echo " -----------------------------"
echo " $fname is not a printable file!"
echo " It may be one of the following file types: "
#[ Devu added for PDF problem
echo " shar, object, executable, archive, library, compressed"
echo " or pdf file. "
# end Devu]
echo "\033E\033%-12345X@PJL" # Reset Printer; end of PCL file
else
case "$lang" in
RELAY)
banner=""
cat "$file";; # straight to the printer
PS)
if [ "$PSLEVEL" = "2" ]
then
Output_PS2_Options
else
Output_PS_Options
fi
#[ Added by Ramki on 29/10/98 for supporting legal,letter in PSNUP
case $paper in
legal) nuppaper="Legal";;
letter) nuppaper="Letter";;
*) nuppaper="A4";;
esac
#]
#[ Commented by Ramki on 30 Oct 98 for supporting PSNUP
# if [ -z "$ascii" ] # a postscript file, dump it
# then
# cat "$file"
# else
# pslp # print ASCII file
# fi
#]
#[ Modified by Ramki to support PSNUP on 30 Oct 1998
if [ -z "$ascii" ] # a postscript file, dump it
then
# if psnup is set no need of cat'ing the file separately
if [ -n "$psnup" ]
then
$MPAGE -b${nuppaper} -${psnup} $file
else
cat "$file"
fi
else
#if file to be dumped without interpretting, print PSNUP commands too
if [ -n "$psnup" ]
then
#[ Modified by Devu to fix n-up for PS to ascii conversion
# NOV 25 1999
pslp | $MPAGE -b${nuppaper} -${psnup}
#$MPAGE -b${nuppaper} -${psnup} $file > $TMP/mpage.$$
#pslp $TMP/mpage.$$
#rm -f $TMP/mpage.$$
# end of changes Devu ]
else
pslp # print ASCII file
fi
fi
#]
echo "\004\033%-12345X\c";;
PCL|HPGL2)
if [ -z "$outputmode_specify" ]
then
Resolve_Lang # cooked or raw , in case only -opcl
if [ "$lang" = "RELAY" -o "$lang" = "PS" ]
then
outputmode="cooked"
fi
fi
if [ "$OS" = "HP-UX" -a $outputmode = "divide" ]
then
Setup_Nup
fi
Output_PCL_Options
case "$outputmode" in
raw)
case "$lang_user" in
# [[ Changed by Devu on Sept 25 1999 to fix problems
# with -ohpgl* options resetting all previous PCL commands
#HPGL2_P) echo "\033E\033&l3O\033%1B\c";;
#HPGL2) echo "\033E\033%1B\c";;
HPGL2_P) echo "\033&l3O\033%1B\c";;
HPGL2) echo "\033%1B\c";;
# end of change Devu]]
*) ;;
esac
cat "$file" 2>>$TMP/generic$$;;
cooked)
echo "\033&k2G\c"
if [ "$pescfile" = "yes" ]
then
#[ Modified by Ramki on 17/11/98 to fix the defect
# sed "s/$esc//g" "$file" | sed 's/\\033//g' | cat
cat $file | sed -e 's//\/g' | sed -e 's/\\033/\/g'
#]
else
if [ "$OS" = "HP-UX" ]
then
if [ -n "$reverse" ]
then
lprpp $italic $length $nroff < "$file" 2>&1 | reverse $length
else
if [ "$nroff" = "" ] # only use lprpp when nroff is set
then
cat "$file" 2>>$TMP/generic$$
else
lprpp $italic $length $nroff < "$file" 2>&1
fi
fi
else # Solaris and others
cat "$file" 2>>$log
fi
fi;;
mdouble) # only for HP-UX
echo "\033&k2G\c"
if [ -n "$reverse" ]
then
lprpp $italic $length $nroff -o < "$file" 2>&1 | reverse $length
else
lprpp $italic $length $nroff -o < "$file" 2>&1
fi
echo "\033&l2H\c"
lprpp $italic $length $nroff -e < "$file" 2>&1;;
divide)
echo "\033&k2G\c"
if [ "$OS" = "HP-UX" ]
then
# [ Modified by Amit Raval to fix the defect# 57427 on Apr 16. 1999
if [ "$dividing" = "8up" ]
then
if [ "$orientation" = "l" ]
then
setprinter_8up_landscape
else
setprinter_8up_portrait
fi
else
# ]
if [ "$dividing" != "-hh" ]
then
if [ "$pescfile" = "yes" ]
then
#[Modified by Ramki on 25/11/98 to fix pesc defect
# sed "s/$esc//g" "$file" | sed 's/\\033//g' > $TMP/tp
sed 's//\/g' "$file" | sed -e 's/\\033/\/g' > $TMP/tp
#]
mv $TMP/tp $file
fi
if [ "$paper" = "letter" -o "$paper" = "def" -o "$paper" = "ISOA4" ]
then
# [ Modified by Vijay for rotate option in A4 and letter on 5/10/98
# divpage -$orientation "$dividing" "$file" 2>&1
if [ "$rotate" = "yes" -a "$dividing" = "-h" ]
then
printfile # divpage doesn't handle rotate option
# [ Modified by Devu on May 19, 1999 to solve th 4up problem in HP-UX
elif [ "$dividing" = "-q" ]
then
if [ "$orientation" = "p" ]
then
Setup_4up_portrait
else
Setup_4up_landscape
fi
# End of change by Devu ]
else
# Changed by Devu to fix 2up landscape problems
# divpage -$orientation "$dividing" "$file" 2>&1
printfile
# end of change by Devu
fi
# End of change by Vijay ]
#[ Added by Devu to to fix problems in 4up printing for
# all other paper sizes. jul 16 1999
elif [ "$dividing" = "-q" ]
then
if [ "$orientation" = "p" ]
then
Setup_4up_portrait
else
Setup_4up_landscape
fi
#[end of Addition by Devu ]
else
printfile
fi
else
if [ "$pescfile" = "yes" ]
then
#[Modified by Ramki on 25/11/98 to fix pesc defect
# sed "s/$esc//g" "$file" | sed 's/\\033//g' > $TMP/tp
sed 's//\/g' "$file" | sed -e 's/\\033/\/g' > $TMP/tp
#]
mv $TMP/tp $file
fi
printfile
fi
# [ Modified by Amit Raval to fix the defect# 57427 on Apr 16. 1999
fi
# ]
else # Solaris or others
# [ Modified by Amit Raval to fix the defect# 57427 on Apr 16. 1999
if [ "$dividing" = "8up" ]
then
if [ "$orientation" = "l" ]
then
setprinter_8up_landscape
else
setprinter_8up_portrait
fi
elif [ "$dividing" = "-q" ]
then
if [ "$orientation" = "l" ]
then
Setup_4up_landscape
else
Setup_4up_portrait
fi
else
# ]
printfile $file
# [ Modified by Amit Raval to fix the defect# 57427 on Apr 16. 1999
fi
# ]
fi;;
esac # end of output data
echo "\033E\033%-12345X@PJL";; # Reset Printer; end of PCL file
# back to known state: UEL
esac # end of one file (PCL/PS)
fi # only correct file type will outptu
fno=`expr $fno + 1` # get ready for next copy
done # end of one copy of one file
copy=`expr $copy + 1` # get ready for next copy
fno=1
done
if [ -s "$TMP/generic$$" ]
then
cat $TMP/generic$$ >> $log
rm -f $TMP/generic$$
fi
if [ -n "$banner" ]
then
do_pcl_banner
fi
# end of job
echo "\033%-12345X\c"
# RS-232 interface insure all buffers are flushed to printer
if [ -t 1 ]
then
stty raw $baudrate -parenb cs8 ixon -istrip clocal <&1 2>/dev/null
fi
if [ "$OS" != "SOLARIS" ]
then
echo "End: $jobid `date`" >> $log
fi
exit 0