#!/usr/bin/sh
#(c) Copyright 1993 ~ 1995 Hewlett-Packard Company. All Rights Reserved.
#
#@(#) $Header: /users/hpnp/odyssey/repository/sh/net_genericpcl3printer.psh,v 1.59 1999/11/25 15:52:11 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
# Parsing_Options - to parse the options you create, and set the variables
# Output_PCL_Options and/or Output_PS_Options
# and/or Output_PS3_Options
# - to output the PCL/PS commands according the variable
# settings
#--------------------------------------------------------------------------
#[ For WJA use
#version E.10.05
#supports HP 2500C
#supports Generic PCL3 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" # CHANGE BANNER TRAY
PSLEVEL="1" # CHANGE POSTSCRIPT LEVEL
PERSONALTY="AUTO" # CHANGE LANGUAGE
BAUDRATE="9600"
PRINTMODEL="UNKNOWN" # CHANGE PRINTER MODEL
TEOJ="" # CHANGE TRUE END OF JOB
BANNER="" # CHANGE BANNER PAGE PRINTING
SPACECHAR="_-"
MPAGE=$HPNP/bin/mpage #Added by Ramki on 14th Oct 98 for PSNUP
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
# The following code sets the TMP directory.
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 ] # if SunOS
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
# ]
# Setting of OS dependent commands.
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 all the options that are supported.
# The function is called when "-ooptions" is given.
all_options()
{
# [ Modified by VIJAY
echo "@PJL ENTER LANGUAGE=PCL"
# End of change by VIJAY ]
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_genericpcl3printer\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 supporting PCL3 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 on 18/11/98 to remove color & gray options
# 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)
legal,letter,A4,A5,A6 Select the corresponding paper size.
exec, ledger/11x17,
C5/C5env,com10env, B5-ISO
DLenv, monarc
B4-JIS, B5-JIS,
card4x6,card5x8,A6Postcard
hagaki,JIS-env2, JIS-env3,
C6/C6env,custom
mtype Select different media types.(Plain/Preprinted/
Glossy, Transparency)
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
For PostScript Only
ascii Print text without interpreting it.
ps1 Use PostScript Level 1 commands for print formatting.
ps2 Use PostScript Level 2 commands for print formatting.
ps3 Use PostScript Level 3 commands for print formatting.
For PCL Only
textcolor Sets the text color. can be, white, cyan,
magenta, blue, yellow, green, red, black.
duplex, hduplex Double sided printing, long edge/short edge binding
quality Enhance the resolution. can be, light,
medium or dark.
dpi# Set the resolution to # dpi (75/100/150/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
portrait, landscape Print in portrait or landscape mode
rotate Print in reverse portrait or landscape
rev Reverse the output page
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)
HP Network Printer Only (see also man pages for xjjm and jetdirect)
job/jobnp, nojob Bring or not bring the Job Monitor for a spooled
job. The X-Window display to use is specified by
job+display.
"
# 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"
# [ Modified by VIJAY
echo "\033E\033%-12345X\c"
# End of change by VIJAY ]
}
##[ Function for setting banner tray from Q-configuration 23 sept 1999
Handle_Ban_Tray()
{
case "$BANTRAY" in
1)
bannerpagesrc="5";;
2)
bannerpagesrc="4";;
3) # feed from 3rd tray
bannerpagesrc="1";;
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]
# list the some options on the banner page.
partial_options()
{
echo "\033&a5006v30L\c"
echo "********** Option Summary *********** "
echo "(See "man net_genericpcl3" 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#, ps1, ps2, ps3, text, b, weight#, pesc, rev "
echo "2up,4up,2+,portrait,landscape,nroff, pr, l#,i,ln66 "
echo "tl#, tm#, lm#, rm#, yb, nb mtype, c, 10, 12 "
echo "fp#, legal, letter, A4,exec, ledger, C5,com10, A6 "
echo "A5,custom,B4-JIS,B5-JIS, C6, style#,upright,duplex "
echo "JIS-env2, JIS-env3,JIS-env4, A6Postcard,simplex "
echo "hagaki,quality,B5-ISO, DL, monarc,lpi# "
}
# PCL banner
# Prints the user name, Options and other job information,
# while printing the banner page.
do_pcl_banner()
{
# [ Modified by VIJAY
# Print the standard header
echo "@PJL ENTER LANGUAGE=PCL"
# End of change by VIJAY ]
# Print the standard header
echo "\033&k2G\033&l0O\c" # always in portrait mode
# where does the paper come from
if [ "$bannerpagesrc" != "def" ]
then
echo "\033&l${bannerpagesrc}H\c"
else
case "$mediasrc" in
1 | 4 | 5 )
echo "\033&l${mediasrc}H\c";;
esac
fi
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
echo "\033E\033%-12345X\c"
}
#
# Sets up the margin, fonts, No. of lines for PostScript file.
#------------------
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=""
outputmode_specify=""
psnup="" #Added by Ramki on 14th Oct 98 for PSNUP
invalidopt=""
listopt=""
# internal use
nroff=""
reverse=""
banner=$BANNER
ln66=""
eolwrap="no"
dividing=""
duplex="def" # CHANGE DEFAULE 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
fgcolor=""
ascii=""
font="Courier" # CHANGE DEFAULT FONT FOR POSTSCRIPT
resolution="def" # CHANGE DEFAULT RESOLUTION
mediasrc="def" # CHANGE DEFAULT MEDIA SOURCE
mediadest="def" # CHANGE DEFAULT MEDIA DESTINATION ONLY FOR PCL FILE
outb="def" # CHANGE DEFAULT MEDIA DESTINATION
mtype="def" # CHANGE DEFAULT MEDIA TYPE
pescfile="no" # CHANGE DEFAULT PESC MODE (pesc option)
orientation="def" # CHANGE DEFAULT ORIENTATION
paper="def" # CHANGE DEFAULT PAPER SIZE
mtypestring="\033&n"
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
endpg=0 # CHANGE DEFAULT END PAGE (are option)
mediatype="" # CHANGE DEFAULT MEDIA TYPE
rotate="" # CHANGE DEFAULT ROTATE MODE
loffset="def"
} # end of init_variables()
#-----------------------------------
# Parse the command line options that is preceeded with -o option
#-----------------------------------
Parsing_Options()
{
for i in $options
do
case "$i" in
ps1)
PSLEVEL="1";;
ps2)
PSLEVEL="2";;
ps3)
PSLEVEL="3";;
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";;
quality*)
printqty="`echo "$i" | sed 's/^quality//'`";;
textcolor*)
fgcolor="`echo "$i" | sed 's/^textcolor//'`";;
# [ Modified by Vijay on 18/11/98 to remove color & gray
# color) rendermode="color";;
# gray) rendermode="gray";;
# End of change by Vijay ]
text)
lang_specify="yes"
outputmode_specify="yes"
lang="PCL"
lang_user="PCL"
outputmode="cooked";;
# file type
pesc)
pescfile="yes";;
dpi[0-9]* )
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 for 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" ;;
# ]
mtype*)
mtype=`echo "$i" | sed 's/^mtype//' | sed "s/${SPACECHAR}/ /g"`;;
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";;
md | mduplex) # duplexing manually
if [ "$OS" = "HP-UX" ]
then
manuald="mdouble"
fi;;
# paper source
# [ Modified by Vijay on 6/10/98 to remove manualenv option
# manualenv | manenv )
# mediasrc="3";;
# End of change by Vijay ]
tray1)
# [ Modified by Vijay on 27/7/99 for tray options
# mediasrc="4";;
mediasrc="5";;
# End of change by Vijay ]
manual | man ) # manual sheet feed
mediasrc="2";;
tray2 | upper | ub | ubin) # feed from upper tray
# [ Modified by Vijay on 27/7/99 for tray options
# mediasrc="1";;
mediasrc="4";;
# End of change by Vijay ]
tray3 | lower | lb | lbin ) # feed from lower tray
# [ Modified by Vijay on 27/7/99 for tray options
# mediasrc="8";;
mediasrc="1";;
# End of change by Vijay ]
btray1)
# [ Modified by Vijay on 27/7/99 for tray options
# bannerpagesrc="4";;
bannerpagesrc="5";;
# End of change by Vijay ]
btray2 | bupper | ubb)
# [ Modified by Vijay on 27/7/99 for tray options
# bannerpagesrc="1";;
bannerpagesrc="4";;
# End of change by Vijay ]
btray3 | blower | lbb) # feed from 3rd tray
# [ Modified by Vijay on 27/7/99 for tray options
# bannerpagesrc="8";;
bannerpagesrc="1";;
# End of change by Vijay ]
# paper size
legal) # 8.5 x 14
paper="legal";;
letter) # 8.5 x 11
paper="letter";;
# [ Modified by Vijay on 27/7/99 to support A3 paper size
A3)
paper="ISOA3";;
# End of change by Vijay ]
A4) # 210 mm x 297 mm
paper="ISOA4";;
A5) # 148 mm x 210 mm
paper="ISOA5"
banner="";; # don't print banner page for this
A6)
paper="ISOA6"
banner="";;
executive | exec) # 7 1/4 x 10.5
paper="exec";;
ledger )
width2up=174
paper="ledger";;
11x17 )
width2up=174
paper="11x17";;
B5-ISO)
paper="ISOB5";;
B4-JIS)
paper="JISB4";;
B5-JIS)
paper="JISB5";;
com10 | com10env) # feed from envelope tray,
paper="com10"
banner="";;
C5 | C5env) # envelope (international C5)
paper="C5"
banner="";;
DL | DLenv) # feed from envelope tray,
paper="DL"
banner="";;
monarc) # feed from envelope tray,
paper="monarc"
banner="";;
# [ Modified by Vijay to support 3x5 paper size
card3x5)
paper="card3x5"
banner="";;
# End of change by Vijay ]
card4x6)
paper="card4x6"
banner="";;
card5x8)
paper="card5x8"
banner="";;
C6 | C6env )
paper="C6"
banner=""
mediasrc="6";;
JIS-env2 )
paper="JIS-env2"
banner=""
mediasrc="6";;
JIS-env3 )
paper="JIS-env3"
banner=""
mediasrc="6";;
JIS-env4 )
paper="JIS-env4"
banner=""
mediasrc="6";;
B5 | B5env)
paper="B5"
banner=""
mediasrc="6";;
custom)
paper="custom";;
A6Postcard)
banner=""
paper="A6Postcard";;
hagaki)
banner=""
paper="hagaki";;
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";;
job* | nojob*) ;; # to prevent them from being displayed
*)
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
# For 2up, 4up and 2+ options
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" ] # Sets the text length to 66
then
vsi="7.4"
textlen="66"
pitch="10.7"
orientation="p"
lpi="def" # reset, if specified.
fi
# Margin and Spacing settings.
if [ "$orientation" = "p" ]
then
if [ "$lmargin" = "def" ]
then
lmargin="2"
fi
# [ Modified by VIJAY
# else
# if [ "$tmargin" = "def" ]
# then
# tmargin="2"
# fi
# if [ "$vsi" = "def" ]
# then
# vsi="7.85"
# fi
# End of change by VIJAY ]
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
# The following lines sets up the start pages based on the options
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
# The following lines sets up the endpage based on Options.
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)
# [ Modified by VIJAY
lang_user="PCL"
# End of change by VIJAY ]
lang="PCL" # text
case "$omode_user" in
divide) outputmode="divide";;
cooked) outputmode="cooked";;
mdouble) outputmode="mdouble";;
esac;;
1)
# [ Modified by VIJAY
lang_user="PS"
# End of change by VIJAY ]
lang="PS";;
2)
# [ Modified by VIJAY
lang_user="PCL"
# End of change by VIJAY ]
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
# [ Modified by VIJAY
lang_user="PCL"
# End of change by VIJAY ]
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 Level1 options
# -----------------------------------------------------------------
Output_PS_Options()
{
echo "statusdict begin"
case "$mediasrc" in
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 ;
2) echo "/manualfeed true def";; # feed from manual
# [ Modified by Vijay on 6/10/98 to remove manualenv option
# 3) echo "/manualfeed envelope" ;; # feed envelope 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";; # A4 Paper
ISOA5) echo "a5tray";; # A5
ISOA6) echo "a6tray";; # A6
JISB5) echo "jb5tray";; # B5-JIS
JISB4) echo "jb4tray";; # B4-JIS
exec) echo "executivetray";; # exec
letter) echo "lettertray";; # letter
legal) echo "legaltray";; # legal
ledger) echo "ledgertray";; # ledger
11x17) echo "11x17tray";; # 11x17
C5) echo "c5envelopetray";; # C5/C5env
DL) echo "dlenvelopetray";; # DL/DLenv
com10) echo "com10envelopetray";; #com10 envelope
monarc) echo "monarcenvelopetray";; # monarc
custom) echo "customtray";; # custom paper size
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 <>"
# Sets the tray selected
case "$mediasrc" in
# [ Modified by Vijay to update the Tray option on 27/7/99
# 1) echo "/DeferredMediaSelection true /MediaPosition 0";;# lower tray
# 4) echo "/DeferredMediaSelection true /MediaPosition 3";;# upper Tray
# 5) echo "/DeferredMediaSelection true /MediaPosition 2";; # UC Tray
1) echo "/DeferredMediaSelection true /MediaPosition 4";;
4) echo "/DeferredMediaSelection true /MediaPosition 0";;
5) echo "/DeferredMediaSelection true /MediaPosition 3";;
# End of change by Vijay ]
6) echo "/DeferredMediaSelection true /MediaPosition 1";;# envelop tray ;
2) echo "/DeferredMediaSelection true /ManualFeed true";; # feed from manual
# [ Modified by Vijay on 6/10/98 to remove manualenv option
# 3) echo "/DeferredMediaSelection true /ManualFeed envelope" ;;
# End of change by Vijay ]
esac
# Sets the output bin
case "$mediadest" in
1) echo "/OutputAttributes <>";;# up output bin (face down)
2) echo "/OutputAttributes <>";;# back output bin (face up)
esac
# Sets the paper size
case "$paper" in
ISOA4) echo "/DeferredMediaSelection true /PageSize [595 842]";; #a4
ISOA5) echo "/DeferredMediaSelection true /PageSize [420 595]";; #a5
ISOA6) echo "/DeferredMediaSelection true /PageSize [297 420]";; #a6
ISOB5) echo "/DeferredMediaSelection true /PageSize [499 708]";; #b5
JISB4) echo "/DeferredMediaSelection true /PageSize [729 1032]";; #b4jis
JISB5) echo "/DeferredMediaSelection true /PageSize [516 729]";; #jb5
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
com10) echo "/DeferredMediaSelection true /PageSize [297 684]";; # comm10 envelope
monarc) echo "/DeferredMediaSelection true /PageSize [279 540]";;#monarc
# [ Modified by Vijay on 27/7/99 to add new paper sizes
card4x6) echo "/DeferredMediaSelection true /PageSize [288 432]";;
card5x8) echo "/DeferredMediaSelection true /PageSize [360 576]";;
A6Postcard) echo "/DeferredMediaSelection true /PageSize [297 420]";;
NEC-A3) echo "/DeferredMediaSelection true /PageSize [937 1368]";;
ISOA3) echo "/DeferredMediaSelection true /PageSize [842 1191]";;
# End of change by Vijay ]
esac
# Sets Media type specified.
case "$mtype" in
def) ;;
# [ Modified by Vijay to support media types on 27/7/99
Plain) echo "/DeferredMediaSelection true /MediaType (Bond)";;
Transparency) echo "/DeferredMediaSelection true /MediaType (Tran)";;
Glossy) echo "/DeferredMediaSelection true /MediaType (Glos)";;
# [ Added by Vijay on 28/7/99 to support other media types
[Rr]apid[Dd]ry[Tt]ransp) echo "/DeferredMediaSelection true /MediaType (Rapt)";;
[Pp]remium[Ii]nk[Jj]et) echo "/DeferredMediaSelection true /MediaType (Spec)";;
[Ii]nk[Jj]et[Hh]eavy[Ww]eight) echo "/DeferredMediaSelection true /MediaType (Spec)";;
[Ii]ron[Oo]n[Tt][Ss]hirt) echo "/DeferredMediaSelection true /MediaType (Spec)";;
# End of change by Vijay ]
*) echo "/DeferredMediaSelection true /MediaType ($mtype)" ;;
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 PostScript level 3 options
# -----------------------------------------------------------------
Output_PS3_Options()
{
case "$mtype" in
def) ;;
Plain) echo "<>setpagedevice";;
Transparency) echo "<> setpagedevice";;
Glossy) echo "<> setpagedevice";;
# [ Added by Vijay on 28/7/99 to support other media types
[Rr]apid[Dd]ry[Tt]ransp) echo "<>setpagedevice";;
[Pp]remium[Ii]nk[Jj]et) echo "<>setpagedevice";;
[Ii]nk[Jj]et[Hh]eavy[Ww]eight) echo "<> setpagedevice";;
[Ii]ron[Oo]n[Tt][Ss]hirt) echo "<> setpagedevice";;
# End of change by Vijay ]
esac
case "$mediasrc" in
1)
# Tray 3
echo "<< /InputAttributes <> >> setpagedevice";;
4)
# Tray 2
echo "<< /InputAttributes <> >> setpagedevice";;
5)
# Tray 1
echo "<< /InputAttributes <> >> setpagedevice";;
2)
# manual feed
echo "<>setpagedevice";;
esac
# Select the paper size specified.
case "$paper" in
ISOA4) echo "<< /PageSize [595 842] /ImagingBBox null >> setpagedevice";;
legal) echo "<< /PageSize [612 1008] /ImagingBBox null >> setpagedevice";;
card4x6) echo "<< /PageSize [288 432] /ImagingBBox null >> setpagedevice";;
card5x8) echo "<< /PageSize [360 576] /ImagingBBox null >> setpagedevice";;
ISOA3) echo "<< /PageSize [842 1191] /ImagingBBox null >> setpagedevice";;
ISOA5) echo "<< /PageSize [420 595] /ImagingBBox null >> setpagedevice";;
ISOA6) echo "<< /PageSize [297 420] /ImagingBBox null >> setpagedevice";;
exec) echo "<< /PageSize [522 756] /ImagingBBox null >> setpagedevice";;
ledger|11x17) echo "<< /PageSize [792 1224] /ImagingBBox null >> setpagedevice" ;;
A6Postcard) echo "<< /PageSize [297 420] /ImagingBBox null >> setpagedevice";;
JISB4) echo "<< /PageSize [729 1032] /ImagingBBox null >> setpagedevice";;
JISB5) echo "<< /PageSize [516 729] /ImagingBBox null >> setpagedevice";;
letter) echo "<< /PageSize [612 792] /ImagingBBox null >> setpagedevice";;
NEC-A3) echo "<< /PageSize [937 1368] /ImagingBBox null >> setpagedevice";;
ISOB5) echo "<< /PageSize [499 708] /ImagingBBox null >> setpagedevice";;
com10) echo "<< /PageSize [297 684] /ImagingBBox null >> setpagedevice";;
C5) echo "<< /PageSize [461 648] /ImagingBBox null >> setpagedevice";;
DL) echo "<< /PageSize [312 624] /ImagingBBox null >> setpagedevice";;
monarc) echo "<< /PageSize [297 540] /ImagingBBox null >> setpagedevice";;
esac
# [ Added by Vijay on 28/7/99 to support quality
case "$printqty" in
light) echo "<< /PostRenderingEnhance true
/PostRenderingEnhanceDetails
<<
/PrintQuality 1
/Type 11
>> >> setpagedevice";;
medium) echo "<< /PostRenderingEnhance true
/PostRenderingEnhanceDetails
<<
/PrintQuality 2
/Type 11
>> >> setpagedevice";;
dark) echo "<< /PostRenderingEnhance true
/PostRenderingEnhanceDetails
<<
/PrintQuality 3
/Type 11
>> >> setpagedevice";;
esac
# End of addition by Vijay ]
# Selects the tray specified
# [ Commented by Vijay on 27/7/99 to support PS3.
# case "$mediasrc" in
# 1)
# echo "(printerinfo trayselect MAIN_CASS) =string
# FieryXJdict /ExtCmdGetExec get exec {pop} if" ;; # lower Tray
# 4)
#
# echo "(printerinfo trayselect OPTIONAL_CASS) =string
# FieryXJdict /ExtCmdGetExec get exec {pop} if" ;; # tray3
#
# 5)
#
# echo "(printerinfo trayselect HCI_TRAY1) =string
# FieryXJdict /ExtCmdGetExec get exec {pop} if" ;; # tray4
#
# 2)
# echo "userdict /FieryXJdict known {
# (printerinfo trayselect MANUAL_FEED) =string
# FieryXJdict /ExtCmdGetExec get exec {pop} if } if
# 1 dict dup /ManualFeed true put setpagedevice";; # feed from manual
#
# 8)
#
# echo "(printerinfo trayselect MP_TRAY) =string
# FieryXJdict /ExtCmdGetExec get exec {pop} if" ;; # upper tray
#
# 3)
# echo "userdict /FieryXJdict known {
# (printerinfo trayselect MANUAL_FEED) =string
# FieryXJdict /ExtCmdGetExec get exec {pop} if } if
# 1 dict dup /ManualFeed true put setpagedevice";; # feed from manual
# esac
#
#
#
## Select the paper size specified.
#
# case "$paper" in
# ISOA3) echo "<< /PageSize [842 1191] /MediaType (null)
# /InputAttributes << 0 << /PageSize [842 1191] /MediaType (null) >> >> >> setpagedevice";; #a3
# ISOA4) echo "<< /PageSize [595 842] /MediaType (null)
# /InputAttributes << 0 << /PageSize [595 842] /MediaType (null) >> >> >> setpagedevice";; #a4 paper
# ISOA5) echo "<< /PageSize [420 595] /MediaType (null)
# /InputAttributes << 0 << /PageSize [420 595] /MediaType (null) >> >> >> setpagedevice";; #a5 paper
#
# ISOB5) echo "<< /PageSize [499 708] /MediaType (null)
# /InputAttributes << 0 << /PageSize [499 708] /MediaType (null) >> >> >> setpagedevice";; #b5 paper
#
# JISB4) echo "<< /PageSize [729 1032] /MediaType (null)
# /InputAttributes << 0 << /PageSize [729 1032] /MediaType (null) >> >> >> setpagedevice";; #jb4tray
# JISB5) echo "<< /PageSize [516 729] /MediaType (null)
# /InputAttributes << 0 << /PageSize [516 729] /MediaType (null) >> >> >> setpagedevice";; #jb5tray currentdi
#
# exec) echo "<< /PageSize [522 756] /MediaType (null)
# /InputAttributes << 0 << /PageSize [522 756] /MediaType (null) >> >> >> setpagedevice";; #executive
# letter) echo "<< /PageSize [612 792] /MediaType (null)
# /InputAttributes << 0 << /PageSize [612 792] /MediaType (null) >> >> >> setpagedevice";; #letter
# legal) echo "<< /PageSize [612 1008] /MediaType (null)
# /InputAttributes << 0 << /PageSize [612 1008] /MediaType (null) >> >> >> setpagedevice";; #legal
#
# ledger) echo "<< /PageSize [1224 792] /MediaType (null)
# /InputAttributes << 0 << /PageSize [1224 792] /MediaType (null) >> >> >> setpagedevice";; #ledger
# 11x17) echo "<< /PageSize [792 1224] /MediaType (null)
# /InputAttributes << 0 << /PageSize [792 1224] /MediaType (null) >> >> >> setpagedevice";; #11x17
#
# com10) echo "<< /PageSize [297 684] /MediaType (null)
# /InputAttributes << 0 << /PageSize [297 684] /MediaType (null) >> >> >> setpagedevice";; # comm10 envelope
# C5) echo "<< /PageSize [459 649] /MediaType (null)
# /InputAttributes << 0 << /PageSize [459 649] /MediaType (null) >> >> >> setpagedevice";; # c5 envelope
# DL) echo "<< /PageSize [312 624] /MediaType (null)
# /InputAttributes << 0 << /PageSize [312 624] /MediaType (null) >> >> >> setpagedevice";; # dl envelope
#
# monarc) echo "<< /PageSize [279 540] /MediaType (null)
# /InputAttributes << 0 << /PageSize [279 540] /MediaType (null) >> >> >> setpagedevice";; #monarc
# custom)
# echo "
# 278 539 0 0 1
# 4 dict begin
# /Orientation exch def
# 2 array astore /Margins exch def
# 2 array astore /PageSize exch def
# /ImagingBBox null def
# currentdict
# Orientation 1 eq Orientation 3 eq or {/MediaType (ShortEdgeFeed) def} {/MediaType null def } ifelse currentdict /Orientation undef currentdict end setpagedevice
# userdict /FieryXJdict known {
# (printerinfo IsCustom YES)=string
# FieryXJdict /ExtCmdGetExec get exec {pop} if } if";; # custom
# esac
#
# End of change by Vijay ]
case "$duplex" in
simplex) echo "<> setpagedevice << /Tumble false >> setpagedevice";;
vduplex) echo "<> setpagedevice << /Tumble false >> setpagedevice" ;;
hduplex) echo "<> setpagedevice << /Tumble true >> setpagedevice" ;;
esac
# [ Modified by Vijay on 18/11/98 to remove color & gray option
# case "$rendermode" in
# color)
# echo "<< /ProcessColorModel /DeviceCMYK >> setpagedevice" ;;
# gray)
# echo "<< /ProcessColorModel /DeviceGray >> setpagedevice" ;;
# esac
# End of change by Vijay ]
# [ Commented by Vijay on 27/7/99 to support PS3
# case "$mtype" in
# def) ;;
# *)
#
# if [ "$OS" = "HP-UX" ]
# then
# capsmtype=`echo $mtype | $AWK '{print toupper($1)}'`
# else
# capsmtype=`echo $mtype | /usr/bin/nawk '{print toupper($1)}'`
# fi
# echo "(printerinfo mediatype $capsmtype) =string
# FieryXJdict /ExtCmdGetExec get exec {pop} if" ;;
# esac
#
} # end of Output_PS3_Options()
# -----------------------------------------------------------------
# Output PCL options
# -----------------------------------------------------------------
Output_PCL_Options()
{
# Select the PCL command for the media source.
case "$mediasrc" in
def);;
*) echo "\033&l${mediasrc}H\c";;
esac
# Media types
case "$mtype" in
def);;
# Plain) echo "\033&l0M\c";;
# Preprinted) echo "\033&l2M\c";;
# Glossy) echo "\033&l3M\c";;
# Transparency) echo "\033&l4M\c";;
*) count=`echo "$mtype" | wc |awk '{print $3}'`
echo "\033&n${count}Wd${mtype}\c";;
esac
# Select the paper size.
case "$paper" in
legal) echo "\033&l3A\c";;
letter) echo "\033&l2A\c";;
# [ Added A3 on 27/7/99 by Vijay
ISOA3) echo "\033&l27A\c";; # A3
# End of change by Vijay ]
ISOA4) echo "\033&l26A\c";;
ISOA5) echo "\033&l25A\c";;
ISOA6) echo "\033&l24A\c";;
JISB4) echo "\033&l46A\c";;
JISB5) echo "\033&l45A\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";;
# [ Modified by Vijay to support card3x5 on 17th Nov. 1998
card3x5) echo "\033&l78A\c";;
# End of change by Vijay ]
card4x6) echo "\033&l74a\c";;
card5x8) echo "\033&l75a\c";;
C6) echo "\033&l92a\c";;
JIS-env2) echo "\033&l1??a\c";;
JIS-env3) echo "\033&l110a\c";;
JIS-env4) echo "\033&l111a\c";;
custom) echo "\033&l101A\c";;
hagaki) echo "\033&l71a\c";;
A6Postcard) echo "\033&l73a\c";;
NEC-A3) echo "\033&l16A\c";;
esac
if [ -n "$fgcolor" ]
then
case "$fgcolor" in
white) fgcolornum=0;;
cyan ) fgcolornum=1;;
magenta) fgcolornum=2;;
blue ) fgcolornum=3;;
yellow) fgcolornum=4;;
green) fgcolornum=5;;
red) fgcolornum=6;;
black) fgcolornum=7;;
esac
echo "\033*r-3U\c"
echo "\033*v${fgcolornum}S"
fi
case "$duplex" in
simplex) echo "\033&l0S\c";;
vduplex) echo "\033&l1S\c";;
hduplex) echo "\033&l2S\c";;
esac
# Sets the orientation as either portrait or landscape
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
# Sets the print quality to light medium or dark
case "$printqty" in
light ) echo "\033*o-1M";;
medium) echo "\033*o0M";;
dark) echo "\033*o1M";;
esac
# Sets the eolwrap
case "$eolwrap" in
yes) echo "\033&s0C\c" ;;
esac
case "$vsi" in # Vertical Spacing indent
def);;
*) echo "\033&l${vsi}C\c";;
esac
case "$lpi" in # Lines per inches
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 # Top margin
def);;
*) echo "\033&l${tmargin}E\c";;
esac
case "$textlen" in
def);;
*) echo "\033&l${textlen}F\c"
length="-l$textlen";;
esac
# Sets the character set to #
case "$charset" in
def);;
*) echo "\033(${charset}\c";;
esac
case "$spacing" in # Line spacing
def);;
*) echo "\033(s${spacing}P\c";;
esac
case "$pitch" in # Font pitch
def);;
c) echo "\033&k2S\c";;
*) echo "\033(s${pitch}H\c";;
esac
case "$hsi" in # horizontal spacing indent
def);;
*) echo "\033&k${hsi}H\c";;
esac
case "$height" in # Text height
def);;
*) echo "\033(s${height}V\c";;
esac
case "$style" in # Style as either italic or bold
def);;
italic) echo "\033(s1S\c"
italic="-i";;
*) echo "\033(s${style}S\c";;
esac
case "$weight" in # character weight
def);;
*) echo "\033(s${weight}B\c";;
esac
case "$typeface" in # Courier, etc
def);;
*) echo "\033(s${typeface}T\c";;
esac
case "$lmargin" in # left margin
def);;
*) echo "\033&a${lmargin}L\c";;
esac
case "$rmargin" in # right margin
def);;
*) echo "\033&a${rmargin}M\c";;
esac
case "$mediadest" in # Media destination
def);;
*) echo "\033&l${mediadest}G\c";; #
esac
case "$loffset" in
def);;
*) echo "\033&l${loffset}U\c";;
esac
case "$resolution" in # dpi
def) ;;
3 ) echo "\033*t300R\c" ;;
6 ) echo "\033*t600R\c" ;;
75 | 100 | 150 | 300 | 600 )
echo "\033*t$resolutionR\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 is removed using the 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
# This function takes care of the border lines based on the paper
# sizes for 2up and 2+ options, on different orientations and
# the font type based on the media size.
#----------------------------------------------------------------
setprinter()
{
if [ "$paper" = "letter" -o "$paper" = "def" -o "$paper" = "ISOA4" -o "$paper" = "exec" -o "$paper" = "legal" ]
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
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
#
# 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
# [ 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
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
fi
# pop previously saved cursor position
echo "\033&f1S\c"
# end macro definition
echo "\033&f1x2y\c"
# enable macro
#
echo "\033&f4X\c"
}
# Adjust the lenght if 2up option is called
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
} '
}
# This function is executed when 2up option is specified.
# This function makes use of the text length and the column width given,
# and prepares the output accordingly.
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
# [ 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 ]
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
}'
echo "\033E"
}
# Adjust the length if 2+ option is called
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
}'
}
# This function is executed when 2+ option is specified.
# This function makes use of the text length and the column width given,
# and prepares the output accordingly.
prepfile2()
{
# [ 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 ]
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
}'
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
# if orientation is portrait or if the orientation is landscape and the
# paper sizes are the ones that are not supported by setprinter_landscape
# End of change by Vijay ]
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"
# [ Modified by VIJAY
echo "@PJL USTATUS PAGE = OFF" # turn off, to prevent page # fluctuat
# due to banner or option listing
# End of change by VIJAY ]
# banner page ;
if [ -n "$banner" ]
then
# [ Modified by VIJAY
echo "@PJL JOB"
echo "@PJL SET COPIES = 1" # this is to prevent front panel from
# causing troubles
# End of change by VIJAY ]
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
# [ Modified by VIJAY
echo "@PJL JOB"
echo "@PJL SET COPIES = 1"
# End of change by VIJAY ]
closejob="true"
all_options
fi
fi
# [ Modified by VIJAY
# turn on upage here, not before banner
# to avoid fluctuation
if [ "$TEOJ" = "on" ]
then
echo "@PJL USTATUS PAGE=ON"
fi
echo "@PJL JOB NAME = \"User: $user; Job: $jobid\" $STARTPAGE $ENDPAGE"
# this is to prevent front panel from causing troubles
echo "@PJL SET COPIES = 1"
# End of change by VIJAY ]
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
# [ This is giving some other problem. So, it is disabled by Kumaresan
# on 16th July
## [ Modified by Amit Raval to fix the defect# 57424 on Apr. 21th 1999
# else
# fname=$file
## ]
# ]
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
# [ Modified by VIJAY
echo "@PJL ENTER LANGUAGE=PCL"
# End of change by VIJAY ]
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)
# [ Modified by VIJAY
echo "@PJL ENTER LANGUAGE=POSTSCRIPT"
# End of change by VIJAY ]
if [ "$PSLEVEL" = "3" ]
then
Output_PS3_Options
elif [ "$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)
# [ Modified by VIJAY
echo "@PJL ENTER LANGUAGE=PCL"
# End of change by VIJAY ]
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