#!/usr/bin/sh #(c) Copyright 1993,1994 Hewlett-Packard Company. All Rights Reserved. #@(#) $Header: /users/hpnp/odyssey/repository/sh/net_lj4x.psh,v 1.89 1999/11/25 15:52:14 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 HP LaserJet 2100 Series #supports HP LaserJet 1100 #supports HP LaserJet 6L #supports HP LaserJet 6MP #supports HP LaserJet 6P #supports HP LaserJet 5 #supports HP LaserJet 5L #supports HP LaserJet 5M #supports HP LaserJet 5N #supports HP LaserJet 5MP #supports HP LaserJet 5P #supports HP LaserJet 5Si #supports HP Color LaserJet 5 #supports HP Color LaserJet 5M #supports HP LaserJet 4 #supports HP LaserJet 4L #supports HP LaserJet 4ML #supports HP LaserJet 4MP #supports HP LaserJet 4P #supports HP LaserJet 4V #supports HP LaserJet 4Si #supports HP LaserJet 4 Plus #supports HP LaserJet IIISi #supports HP PaintJet XL300 #supports HP Colour LaserJet #supports HP DeskJet 1200C #supports HP DeskJet 1600C #supports HP DeskJet 1600CM #supports HP CopyJet #supports HP DesignJet 650C #supports HP 2000C # by Devu 1 oct 1999] # hpnpl sets the following: OS, PERSONALTY, PRINTMODEL, TEOJ, and BANNER HPNPS=/opt/hpnp/bin/hpnps MPAGE=/opt/hpnp/bin/mpage #Added by Ramki on 30th Oct 98 for PSNUP # [ Modified by Suresha on 26th Sep 99 to support JPIU HPNPS=/opt/hpnpl/bin/hpnps MPAGE=/opt/hpnpl/bin/mpage #Added by Ramki on 30th Oct 98 for PSNUP # end of change by suresha DUPPRINT="def" BANTRAY="def" # CHANGE BANNER TRAY BPAPER="def" # CHANGE BANNER PAGE SIZE PSLEVEL="1" # CHANGE POSTSCRIPT LEVEL PERSONALTY="AUTO" # CHANGE LANGUAGE BAUDRATE="9600" PRINTMODEL="generic" # CHANGE PRINTER MODEL TEOJ="off" # CHANGE TRUE END OF JOB BANNER="yes" # CHANGE BANNER PAGE PRINTING OS="UNKNOWN" if [ "$OS" = "UNKNOWN" ] then OS=`uname` fi TMP=/tmp # [ Modify by the Amit R. to solve the problem of security on 20th Feb. 1998 HPNP=/opt/hpnp # [ Modified by Suresha on 26th Sep 99 to support JPIU HPNP=/opt/hpnpl # end of change by suresha 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" esc="" PR="pr -F" GREP="/usr/bin/grep $patternlist" 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 ----------------- all_options() { echo "@PJL ENTER LANGUAGE=PCL" echo "\033&k2G\c" echo " Description of available -o options for this script (net_lj4x) is in man page. See \"man net_lj4x\" for details. " echo "\033E\033%-12345X\c" } ##[ Function for setting banner tray from Q-configuration 23 sept 1999 Handle_Ban_Tray() { case "$BANTRAY" in 1) if [ "$PRINTMODEL" = "lj6p" ] then bannerpagesrc="4" else bannerpagesrc="1" fi ;; 2) if [ "$PRINTMODEL" = "lj6p" ] then bannerpagesrc="1" else bannerpagesrc="4" fi ;; 3) # feed from 3rd tray bannerpagesrc="5";; 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] # option summary; Alway printed on banner page # box coordinates are in 1/720ths of an inch # boxleftX= 4.6 inches from the right edge of page # boxrightX= 0.6 inches from the right edge of page # boxtopY= 2.92 inches from the bottom edge of page # boxbottomY= 2.92 inches from the bottom edge of page # The left margin is set with the "#L" command, I'm guessing # that there are around 10 columns per inch. partial_options() { if [ "$paper" = "exec" ] # 7 1/4 x 10.5 then boxleftX=1908 # ((725 - 460) * 72 ) / 10 boxrightX=4788 #((725 - 60 ) * 72 ) / 10 boxtopY=5457 #(( 1050 - 292 ) * 72 ) / 10 boxbottomY=6897 #(( 1050 - 92 )) * 72 ) / 10 echo "\033&a"`expr $boxtopY + 158 `"v27L\c" elif [ "$paper" = "ISOA3" ] # 297 mm x 420 mm (11.58" x 16.38") then boxleftX=5025 #(( 1158 - 460 ) * 72 ) / 10 boxrightX=7905 #(( 1158 - 60 ) * 72 ) / 10 boxtopY=9691 #(( 1638 - 292 ) * 72 )/ 10 boxbottomY=11131 #(( 1638 - 92 ) * 72 ) / 10 echo "\033&a"`expr $boxtopY + 158 `"v70L\c" elif [ "$paper" = "ISOA4" ] # 210 mm x 297 mm (8.19" x 11.58") then boxleftX=2584 #(( 819 - 460 ) * 72 ) / 10 boxrightX=5464 #(( 819 - 60 ) * 72 ) / 10 boxtopY=5817 #(( 1100 - 292 ) * 72 ) / 10 boxbottomY=7257 #(( 1100 - 92 ) * 72 ) / 10 echo "\033&a"`expr $boxtopY + 158 `"v37L\c" elif [ "$paper" = "legal" ] # 8.5 x 14 then boxleftX=2808 #(( 850 - 460 ) * 72 ) / 10 boxrightX=5688 #(( 850 - 60 ) * 72 ) / 10 boxtopY=7977 #(( 1400 - 292 ) * 72 ) / 10 boxbottomY=9417 #(( 1400 - 92 ) * 72 ) / 10 echo "\033&a"`expr $boxtopY + 158 `"v40L\c" elif [ "$paper" = "11x17" ] then boxleftX=4608 #(( 1100 - 460 ) * 72 ) / 10 boxrightX=7488 #(( 1100 - 60 ) * 72 ) / 10 boxtopY=10137 #(( 1700 - 292 ) * 72 ) / 10 boxbottomY=11577 #(( 1700 - 92 ) * 72 ) / 10 echo "\033&a"`expr $boxtopY + 158 `"v65L\c" elif [ "$paper" = "ledger" ] # 11x17 then boxleftX=4608 #(( 1100 - 460 )) * 72 )) / 10 )) boxrightX=7488 #(( 1100 - 60 )) * 72 )) / 10 )) boxtopY=10137 #(( 1700 - 292 )) * 72 )) / 10 )) boxbottomY=11577 #(( 1700 - 92 )) * 72 )) / 10 )) echo "\033&a"`expr $boxtopY + 158 `"v65L\c" # the lj5's won't print a banner page to ISOB5 ... use letter # elif [ "$paper" = "ISOB5" ] # 176 mm x 250 mm (6.86" x 9.75") # then # boxleftX=$(( $(( $(( 686 - 460 )) * 72 )) / 10 )) # boxrightX=$(( $(( $(( 686 - 60 )) * 72 )) / 10 )) # boxtopY=$(( $(( $(( 975 - 292 )) * 72 )) / 10 )) # boxbottomY=$(( $(( $(( 975 - 92 )) * 72 )) / 10 )) # echo "\033&a"$(( $boxtopY + 158 ))"v24L\c" else # letter echo "\033&a5976v40L\c" # [Modified by Vijay on 5th June '98 to fix the problem of 1600cm not printing # banner page vertical line properly (#44514). # boxleftX=2808 # boxrightX=5688 boxleftX=2584 boxrightX=5464 # ] boxtopY=5818 boxbottomY=7258 fi echo "********* Option Summary *********" echo "(see \"man net_lj4x\" for details)\n" echo "\033&k2S\c" # use compressed font echo "auto (default), postscript, pcl, hpgl2, hpgl2_p, raw, relay" echo "manual, tray1, tray2, tray3 " echo "legal, letter, A4, exec, ledger/11x17, com10" echo "yb, nb bin1, bin2" echo "dpi# simplex, duplex, hduplex " echo "2up, 2+, 4up (hpux only) portrait, landscape " echo "color, gray " echo "ascii,text econo# (#=on/off)" # draw box echo "\033&a"$boxtopY"v"$boxleftX"H\033*c4h1440v0P\033*c2880h4v0P\c" echo "\033&a"$boxbottomY"v"$boxleftX"H\033*c2880h4v0P\c" echo "\033&a"$boxtopY"v"$boxrightX"H\033*c4h1440v0P\c" } # PCL banner do_pcl_banner() { # Print the standard header echo "@PJL ENTER LANGUAGE=PCL" # 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 # [Added by Amit R to fix the problem of not printing proper banner page when # 'btray1' option is set fi # ] # the width of the shaded box is the width of the page - 0.7 inches # boxwidth is given in 1/720ths of an inch boxwidth=5616 boxtopY=120 boxbottomY=1800 # [ Modified by Devu to check for change in banner paper size. # If true temparorily use it. Nov 3 1999 if [ "$BPAPER" != "def" ] then TMPPAPER=$paper paper=$BPAPER fi # end Devu ] case "$paper" in ISOA3) echo "\033&l27A\c" # 297 mm x 420 mm (11.58" x 16.38") boxwidth=7833;; ISOA4) echo "\033&l26A\c" # 210 mm x 297 mm (8.19" x 11.58") # boxwidth=5392 boxwidth=5493 echo "\033&a240v\c" boxbottomY=1920 boxtopY=240;; exec) echo "\033&l1A\c" # 7 1/4 x 10.5 boxwidth=4737;; letter) echo "\033&l2A\c" boxwidth=5616;; legal) echo "\033&l3A\c" # 8.5 x 14 boxwidth=5616;; ledger | 11x17) echo "\033&l6A\c" boxwidth=7416;; esac # [Removed by Amit R to fix the problem of not printing proper banner page when # 'btray1' option is set # fi # ] # where does the paper go to if [ $mediadest != "def" ] then echo "\033&l${mediadest}G\c" fi echo "\033&k2G\033&l0O\c" # always in portrait mode 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 # [Modified by Amit R to add one line feed aftre the title on 18th Dec 97. # echo "\t\t\t\t\tTitle: $title" echo "\t\t\t\t\tTitle: $title\n" # ] else echo "" fi date1=`date` echo " $date1" 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" # draw box echo "\033&l0E\c" # left and top line #echo "\033&a120v0H\033*c4h1680v0P\033*c"$boxwidth"/720h4v0P\c" echo "\033&a"$boxtopY"v0H\033*c4h1680v0P\c" echo "\033&a"$boxtopY"v0H\033*c"$boxwidth"h4v0P\c" # bottom #echo "\033&a1800v0H\033*c"$boxwidth"h4v0P\c" echo "\033&a"$boxbottomY"v0H\033*c"$boxwidth"h4v0P\c" # right #echo "\033&a120v"$boxwidth"H\033*c4h1680v0P\c" echo "\033&a"$boxtopY"v"$boxwidth"H\033*c4h1680v0P\c" # shade the area # echo "\033&l0e8C\033&a0v0H\c" # echo "\033*c"$boxwidth"h1800v10g2P\c" echo "\033&l0e8C\033&a"$boxtopY"v0H\c" echo "\033*c"$boxwidth"h1680v10g2P\c" partial_options if [ -z "$debug" ] then # [ Modified by Suresha on 26th Sep 99 to support JPIU #if [ -r /opt/hpnp/etc/hplogo.pcl ] if [ -r $HPNP/etc/hplogo.pcl ] # end of change by suresha then echo "\033&a140v"$boxwidth"H\c" # [ Modified by Suresha on 26th Sep 99 to support JPIU #cat /opt/hpnp/etc/hplogo.pcl cat $HPNP/etc/hplogo.pcl # end of change by suresha fi fi echo "\033E\033%-12345X\c" # [ Modified by Devu to get back to paper size in case # of different size for banner. Nov 3 1999 if [ "$BPAPER" != "def" ] then paper=$TMPPAPER fi #end Devu ] } # #------------------ 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 invalidopt="" listopt="" # internal use debug="" 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 # [ Added by Ramki for supporting Deskjet 2000C fgcolor="" # CHANGE FORGROUND COLOR # End ] ascii="" font="Courier" # CHANGE DEFAULT FONT FOR POSTSCRIPT resolution="def" # CHANGE DEFAULT RESOLUTION econo="def" # CHANGE DEFAULT ECONO MODE duplex="def" # CHANGE DEFAULT DUPLEX MODE mediasrc="def" # CHANGE DEFAULT MEDIA SOURCE mediadest="def" # CHANGE DEFAULT MEDIA DESTINATION ONLY FOR PCL FILE # [ Added by Ramki for supporting Deskjet 2000C envtray="" # End ] 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" 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="def" # CHANGE DEFAULT MEDIA TYPE printqty="" # CHANGE DEFAULT QUALITY (quality option) rendermode="" # CHANGE DEFAULT RENDER (COLOR-GRAY) MODE loffset="def" } # end of init_variables() #----------------------------------- #----------------------------------- Parsing_Options() { for i in $options do case "$i" in debugm[/a-zA-Z0-9.-_]*) debug="yes";; debugm) debug="yes";; ps1) PSLEVEL="1";; ps2) PSLEVEL="2";; options) listopt="yes";; auto) lang="AUTO" lang_user="AUTO";; postscript | post ) lang="PS" lang_user="PS";; relay) for file in $files; do cat "$file" done exit 0;; 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";; # [ Added by Ramki for supporting Deskjet 2000C textcolor[0-7]) fgcolor="`echo "$i" | sed 's/^textcolor//'`";; # ] text) lang_specify="yes" outputmode_specify="yes" lang="PCL" lang_user="PCL" outputmode="cooked";; # file type pesc) pescfile="yes";; # Job Control srb[0-9]*) startpg="`echo "$i" | sed 's/^srb//'`";; srbb[0-9]*) jrpg="`echo "$i" | sed 's/^srbb//'`";; sre[0-9]*) endpg="`echo "$i" | sed 's/^sre//'`";; # [ Commented by Ramki for supporting dj2000 # dpi[03-6]* ) # End ] # [ Added by Ramki for supporting dj2000 dpi[0-6]* ) # End ] resolution="`echo "$i" | sed 's/^dpi//'`";; econo[onf]*) econo="`echo "$i" | sed 's/^econo//'`";; quality*) printqty="`echo "$i" | sed 's/^quality//'`";; color) rendermode="color";; gray) rendermode="gray";; nb | nobanner) # No banner page banner="";; yb | banner) # output banner page # [ Modified by Ramki to support dj2000c which does not support banner page #banner="yes";; if [ "$PRINTMODEL" = "dj2000c" ] then banner="" else banner="yes" fi ;; # ] # 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 # [Removed to support 4up printing for PS in solaris also on 19th June '98. # 4up will not work for Soalis. It will behave as 2up. # if [ "$OS" = "HP-UX" ] # then # dividing="-q" # fi dividing="-q" # ] ;; # [ 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" ;; # ] 3hole) ThreeHoles="yes";; portrait) # print in portrait mode orientation="p";; landscape) # print in landscape mode orientation="l";; # duplex simplex) duplex="simplex";; vd | duplex | double | d) # vertical binding case "$PRINTMODEL" in lj4 | lj4v) ;; *) duplex="vduplex";; esac ;; hd | hduplex) # double side, horizontal binding case "$PRINTMODEL" in lj4 | lj4v) ;; *) duplex="hduplex";; esac ;; md | mduplex) # duplexing manually if [ "$OS" = "HP-UX" ] then manuald="mdouble" fi ;; # paper source manual | man ) # manual sheet feed #[ Modified by Ramki to fix the bug of improper tray selection in # Laserjet 6MP #mediasrc="2";; if [ "$PRINTMODEL" = "lj6p" ] then mediasrc="4" else mediasrc="2" fi ;; # ] tray1 | upper | ub | ubin) # feed from upper tray(4si),MP tray #[ Modified by Ramki to fix the bug of improper tray selection in # Laserjet 6MP #mediasrc="1";; if [ "$PRINTMODEL" = "lj6p" ] then mediasrc="4" else mediasrc="1" fi ;; # ] tray2 | lower | lb | lbin ) # feed from lower tray(4si), PC tray #[ Modified by Ramki to fix the bug of improper tray selection in # Laserjet 6MP #mediasrc="4";; if [ "$PRINTMODEL" = "lj6p" ] then mediasrc="1" else mediasrc="4" fi ;; # ] tray3 ) # LC tray (4) mediasrc="5";; # [ Commented by Ramki as the same code was there in two places # com10env) # feed from envelope tray, # mediasrc="6";; # End ] # [ Added by Ramki for supporting dj2000 envtray) # feed from envelope tray, mediasrc="3";; # End ] # paper destination bin2 | rearbin) # to back bin mediadest="2";; bin1 | topbin) # to top bin mediadest="1";; # paper size legal) # 8.5 x 14 paper="legal";; letter) # 8.5 x 11 paper="letter";; A3) # 297 mm x 420 mm paper="ISOA3";; A4) # 210 mm x 297 mm paper="ISOA4";; A5) paper="ISOA5";; # [ Commented by Ramki for supporting dj2000 # exec) # 7 1/4 x 10.5 # End ] # [ Added by Ramki for supporting dj2000 exec | executive) # 7 1/4 x 10.5 # End ] paper="exec";; ledger ) width2up=174 paper="ledger";; 11x17 ) width2up=174 paper="11x17";; B4-JIS) paper="JISB4";; B5-JIS) paper="JISB5";; B5-ISO) paper="ISOB5";; custom) paper="custom";; # [ Added by Ramki for supporting dj2000 card3x5) paper="card3x5";; card4x6) paper="card4x6";; card5x8) paper="card5x8";; A6Postcard) paper="A6Postcard";; hagaki) paper="hagaki";; # End ] PostCard) paper="postcard";; 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";; B5 | B5env) paper="B5" mediasrc="6";; monarch) # feed from envelope tray, paper="monarch" mediasrc="6";; # [ Added by Ramki for supporting dj2000 C6 | C6env ) paper="C6" mediasrc="6";; # [ Modified by Amit R. Raval on 16th Oct 98 to fix the defects #55725 # JIS-env2 ) # paper="JIS-env2" # mediasrc="6";; # ] JIS-env3 ) paper="JIS-env3" mediasrc="6";; JIS-env4 ) paper="JIS-env4" mediasrc="6";; B5 | B5env) paper="B5" mediasrc="6";; # End ] mtype*) mediatype="`echo "$i" | sed 's/^mtype//'`";; # feed banner page from upper(1)/lower (4) tray, btray1 | bupper | ubb) #[ Modified by Ramki to fix the bug of improper tray selection in # Laserjet 6MP #bannerpagesrc="1";; if [ "$PRINTMODEL" = "lj6p" ] then bannerpagesrc="4" else bannerpagesrc="1" fi ;; # ] btray2 | blower | lbb) #[ Modified by Ramki to fix the bug of improper tray selection in # Laserjet 6MP #bannerpagesrc="4";; if [ "$PRINTMODEL" = "lj6p" ] then bannerpagesrc="1" else bannerpagesrc="4" fi ;; # ] btray3 ) # feed from 3rd tray bannerpagesrc="5";; 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/^lm//'`";; # set right margin in columns rm[0-9]*) rmargin="`echo "$i" | sed 's/^rm//'`";; # PS specific a | ascii) # print postscript text ascii="yes";; f*) # new font used by ASCII-to-PS font="`echo "$i" | sed 's/^f//'`";; hpnpflog | job* | nojob*) ;; # to prevent them from being displayed # in illegal options. *) 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 # [ Added by Ramki for supporting dj2000 if [ -z "$envtray" ] #if envtray option is not given then # End ] if [ "$mediasrc" = "6" ] then banner="" # [ Added by Ramki for supporting dj2000 if [ "$PRINTMODEL" != "dj2000c" ] then # End ] orientation="l" paper="com10" # [ Added by Ramki for supporting dj2000 fi # End ] fi # [ Added by Ramki for supporting dj2000 else #envtray option is given mediasrc="3" fi # End ] # 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 # [Modified by Amit R to fix the problem of not printing proper pages for 2up # with 'srb#' and 'sre#' options on 22nd Dec 97. 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 # [Modified by Amit R to fix the problem of not printing proper pages for 2up # with 'srb#' and 'sre#' options on 22nd Dec 97. 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 1) echo "0 setpapertray";; # upper tray (4si) or MP tray;; 4) # case "$PRINTMODEL" in lj4 | lj4pls | lj4v) # tray 2 echo "3 setpapertray";; # PC Tray *) echo "1 setpapertray";; # lower tray (4si);; esac;; 5) case "$PRINTMODEL" in lj4 | lj4pls | lj4v) echo "1 setpapertray" ;; # LC tray ;; esac;; 6) echo "com10envelopetray";; # envelop tray ; 2) echo "/manualfeed true def";; # feed from manual 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 ISOA3) echo "a3tray";; ISOA4) echo "a4tray";; ISOA5) echo "a5tray";; JISB5 | ISOB5) echo "b5tray";; # [ Added by Ramki to support dj2000 JISB4) echo "jb4tray";; # End ] exec) echo "executivetray";; letter) echo "lettertray";; legal) echo "legaltray";; ledger) echo "ledgertray";; 11x17) echo "11x17tray";; B5) echo "b5envelopetray";; # [ Added by Ramki to support dj2000 custom) echo "customtray";; com10) echo "com10envelopetray";; postcard) echo "doublepostcardtray";; C5) echo "c5envelopetray";; DL) echo "dlenvelopetray";; monarch) echo "monarcenvelopetray";; # End ] 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 1) echo "/DeferredMediaSelection true /MediaPosition 0";;# upper tray (4si) or MP tray; 4) echo "/DeferredMediaSelection true /MediaPosition 1";;# Lower Tray 5) echo "/DeferredMediaSelection true /MediaPosition 4";;# Multipurpose Tray 6) echo "/DeferredMediaSelection true /MediaPosition 2";;# envelop tray ; 2) echo "/DeferredMediaSelection true /ManualFeed true";; # feed from manual esac case "$mediadest" in 1) echo "/OutputAttributes <>";; # up output bin (face down) 2) echo "/OutputAttributes <>";; # back output bin (face up) esac case "$paper" in B5) echo "/DeferredMediaSelection true /PageSize [500 708]";; #b5 envelope ISOA3) echo "/DeferredMediaSelection true /PageSize [842 1190]";; #a3 ISOA4) echo "/DeferredMediaSelection true /PageSize [595 842]";; #a4 paper ISOA5) echo "/DeferredMediaSelection true /PageSize [420 595]";; #a5 paper JISB4) echo "/DeferredMediaSelection true /PageSize [728 1032]";; #jb4tray JISB5 | ISOB5) echo "/DeferredMediaSelection true /PageSize [516 728]";; #jb5tray exec) echo "/DeferredMediaSelection true /PageSize [522 756]";; #executive 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 envelope DL) echo "/DeferredMediaSelection true /PageSize [312 624]";; # dl envelope postcard) echo "/DeferredMediaSelection true /PageSize [420 567]";; #double postcard monarch) echo "/DeferredMediaSelection true /PageSize [279 540]";; #monarch com10) echo "/DeferredMediaSelection true /PageSize [297 684]";; #com10 envelope esac case "$duplex" in simplex) echo "/Duplex false";; vduplex) echo "/Duplex true" echo "/Tumble false";; hduplex) echo "/Duplex true" echo "/Tumble true";; esac case "$mediatype" in def) ;; *) echo "/DeferredMediaSelection true /MediaType ($mediatype)" ;; esac echo ">>setpagedevice" } # end of Output_PS2_Options() # ----------------------------------------------------------------- # Output PCL options # ----------------------------------------------------------------- Output_PCL_Options() { case "$mediasrc" in def);; # [ Added by Ramki for supporting Deskjet 2000C 6) if [ "$PRINTMODEL" = "dj2000c" ] then mediasrc="1" fi echo "\033&l${mediasrc}H\c";; # End ] *) echo "\033&l${mediasrc}H\c";; esac case "$paper" in legal) echo "\033&l3A\c";; letter) echo "\033&l2A\c";; ISOA3) echo "\033&l27A\c";; ISOA4) echo "\033&l26A\c";; ISOA5) echo "\000&l25A\c";; exec) echo "\033&l1A\c";; ledger | 11x17) echo "\033&l6A\c";; JISB4) echo "\033&l46A\c";; JISB5) echo "\033&l45A\c";; ISOB5) echo "\033&l65A\c";; com10) echo "\033&l81A\c";; custom) echo "\033&l101A\c";; postcard) echo "\033&l72A\c";; C5) echo "\033&l91A\c";; DL) echo "\033&l90A\c";; B5) echo "\033&l100A\c";; monarch) echo "\033&l80A\c";; esac # does not matter if support or not, PCL will ignore it if not case "$duplex" in simplex) echo "\033&l0S\c";; vduplex) echo "\033&l1S\c";; hduplex) echo "\033&l2S\c";; esac # [ Added by Ramki for supporting Deskjet 2000C if [ "$PRINTMODEL" = "dj2000c" ] then if [ -n "$fgcolor" ] then echo "\033*r-3U\c" echo "\033*v${fgcolor}S" fi fi # End ] case "$orientation" in p) echo "\033&l0O\c";; l) echo "\033&l1O\c" 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 } # end of Output_PCL_Options() #---------------------------- # Trap Handler #---------------------------- CancelJob() { rm -f $TMP/lj4x$$ 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_lj4x 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 } #---------------------------------------------------------------- # Profile1 and 2 are used for user-level diagnostic purpose #---------------------------------------------------------------- Profile1() { if [ "$debug" = "yes" ] then echo "@PJL COMMENT **** Job ($jobid) Profile ****" case "$resolution" in 3|300) echo "@PJL COMMENT Resolution : 300";; 6|600) echo "@PJL COMMENT Resolution : 600";; esac echo "@PJL COMMENT Copies : $copies" if [ -n "$banner" -a -z "$reverse" ] then echo "@PJL COMMENT Banner page: Front" fi case "$mediasrc" in 1) echo "@PJL COMMENT Input Tray: tray 1 (Upper/MP Tray)" ;; 4) echo "@PJL COMMENT Input Tray: tray 2 (Lower/PC Tray)";; 5) echo "@PJL COMMENT Input Tray: tray 3 (LC Tray)";; 2) echo "@PJL COMMENT Input Tray: manual feed tray";; 6) echo "@PJL COMMENT Input Tray: envelop feed";; esac fi } Profile2() { if [ "$debug" = "yes" ] then if [ "$OS" = "HP-UX" ] then echo "@PJL COMMENT File: $fname" else echo "@PJL COMMENT File: $file" fi if [ "$WRONGTYPE" = "true" ] then echo "@PJL COMMENT ** Wrong file type (such as binary, shar,...) **" return fi echo "@PJL COMMENT ** LANGUAGE: $lang" if [ "$lang" = "PCL" ] then case "$outputmode" in raw) echo "@PJL COMMENT ** Raw mode (adding NO extra characters)";; cooked) echo "@PJL COMMENT ** 1-up Text printing (adding one CR for each LF)" ;; divide) case "$dividing" in -h) echo "@PJL COMMENT ** 2-up Text printing (adding one CR for each LF)" ;; -q) echo "@PJL COMMENT ** 4-up Text printing (adding one CR for each LF)" ;; esac;; esac fi case "$duplex" in simplex) echo "@PJL COMMENT ** simplex" ;; vduplex) echo "@PJL COMMENT ** duplex-vertical binding";; hduplex) echo "@PJL COMMENT ** duplex-horizontal binding";; esac echo "" fi } #end of debug section # [ 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 using 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 19th 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 19th 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 ] # [ Added by Devu to invoke better 2+ for all paper sizes # [ 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 }' # End of addition by Devu 19th 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() { # [ The function is modified by Ramki on 15/1/98 to fix the problem related # to non working of 2up option in solaris # expand $file | # adjustlength2 | # definite need this to do padding # $PR $length2up -t -2 -w$width2up # removing sed fixes a problem "loosing # a blank line at the beginning # [ 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 ] # End of modification ] 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, 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 } # [ Added by Ramki for supporting Deskjet 2000C Output_PCL3GUI_Options() { echo "\033%-12345X\c" echo "@PJL ENTER LANGUAGE = PCL3GUI" case "$paper" in # [ Modified by Amit R. Raval on 16th Oct 98 to fix the defects #55725 # card3x5) echo "033\&l??a\c";; # card4x6) echo "033\&l74a\c";; # card3x5) echo "033\&l75a\c";; # hagaki) echo "033\&l71a\c";; # A6Postcard) echo "033\&l73a\c";; # monarch) echo "033\&l80a\c";; # C5) echo "033\&l91a\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";; #Modified by Ramki on 6th Nov 1998 # card3x5) echo "033\&l78A\c";; # card4x6) echo "033\&l74A\c";; # card5x8) echo "033\&l75A\c";; # hagaki) echo "033\&l71A\c";; # A6Postcard) echo "033\&l73A\c";; # monarch) echo "033\&l80A\c";; # C5) echo "033\&l91A\c";; # C6) echo "033\&l92A\c";; # JIS-env3) echo "033\&l110A\c";; # JIS-env4) echo "033\&l111A\c";; card3x5) echo "\033&l78A\c";; card4x6) echo "\033&l74A\c";; card5x8) echo "\033&l75A\c";; hagaki) echo "\033&l71A\c";; A6Postcard) echo "\033&l73A\c";; monarch) echo "\033&l80A\c";; C5) echo "\033&l91A\c";; C6) echo "\033&l92A\c";; JIS-env3) echo "\033&l110A\c";; JIS-env4) echo "\033&l111A\c";; # End of change by Ramki ] # ] esac case "$resolution" in #[ Modified by Ramki on 6th Nov 1998 # 3 | 300) echo "033\&u300d\c";; # 6 | 600) echo "033\&u600d\c";; # 12 |1200) echo "033\&u1200d\c";; 3 | 300) echo "\033&u300d\c";; 6 | 600) echo "\033&u600d\c";; 12 |1200) echo "\033&u1200d\c";; #] esac case "$printqty" in #[ Modified by Ramki on 6th Nov 1998 #ecnofast | draft) echo "033\*o-1m\c" ;; # normal) echo "033\*o0m\c";; # high | best) echo "033\*o1m\c";; ecnofast | draft) echo "\033*o-1m\c" ;; normal) echo "\033*o0m\c";; high | best) echo "\033*o1m\c";; #] esac case "$mediatype" in #[ Modified by Ramki on 6th Nov 1998 # paper) echo "033\&l0m\c";; # glossy) echo "033\&l3m\c";; # special) echo "033\&l2m\c";; # transparency) echo "033\&l4m\c";; paper) echo "\033&l0m\c";; glossy) echo "\033&l3m\c";; special) echo "\033&l2m\c";; transparency) echo "\033&l4m\c";; #] esac echo "\033%-12345X\c" } # End ] # ------ 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/lj4x* # 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" # Begin-of-Job echo "@PJL USTATUS PAGE = OFF" # turn off, to prevent page # fluctuat # due to banner or option listing # [ Added by Ramki for supporting Deskjet 2000C if [ "$PRINTMODEL" != "dj2000c" ] then # End ] Profile1 # [ Added by Ramki for supporting Deskjet 2000C fi # End ] # banner page ; if [ -n "$banner" ] then echo "@PJL JOB" closejob="true" echo "@PJL SET COPIES = 1" # this is to prevent front panel from # causing troubles 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 echo "@PJL JOB" closejob="true" echo "@PJL SET COPIES = 1" all_options fi fi # 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" if [ "$debug" = "yes" ] then echo "@PJL COMMENT Start Page : $startpg " if [ "$endpg" -eq 0 ] then echo "@PJL COMMENT End Page : Last Page" else echo "@PJL COMMENT End Page : $endpg" fi fi # [ Added by Ramki for supporting Deskjet 2000C if [ "$PRINTMODEL" = "dj2000c" ] then Output_PCL3GUI_Options fi # End ] # set up PJL env. case "$resolution" in 3 | 300) echo "@PJL SET RESOLUTION = 300" ;; 6 | 600) echo "@PJL SET RESOLUTION = 600" ;; esac case "$econo" in on) echo "@PJL SET ECONOMODE = ON" ;; off) echo "@PJL SET ECONOMODE = OFF";; esac case "$printqty" in draft|best|normal|high) echo "@PJL SET PRINTQUALITY = $printqty";; esac case "$rendermode" in color) echo "@PJL SET RENDERMODE = COLOR" ;; gray) echo "@PJL SET RENDERMODE = GRAYSCALE";; esac case "$mediatype" in paper|glossy|transparency|special) echo "@PJL SET MEDIATYPE = $mediatype" ;; esac # this is to prevent front panel from causing troubles echo "@PJL SET COPIES = 1" 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 Ramki for supporting Deskjet 2000C if [ "$PRINTMODEL" != "dj2000c" ] then # End ] Profile2 # [ Added by Ramki for supporting Deskjet 2000C fi # End ] # [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 "@PJL ENTER LANGUAGE=PCL" 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) cat "$file" # straight to the printer echo "\033%-12345X\c" ;; PS) echo "@PJL ENTER LANGUAGE=POSTSCRIPT" 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) echo "@PJL ENTER LANGUAGE=PCL" 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/lj4x$$ ;; 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/lj4x$$ 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 # [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 # [ 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/lj4x$$" ] then cat $TMP/lj4x$$ >> $log rm -f $TMP/lj4x$$ fi echo "@PJL RESET" echo "@PJL EOJ NAME = \"User: $user; Job: $jobid\"" # end-of-job, if [ -n "$banner" ] then if [ "$debug" = "yes" ] then echo "@PJL COMMENT Banner page : Back" fi do_pcl_banner fi # end of job if [ "$closejob" = "true" ] then echo "@PJL RESET" echo "@PJL EOJ" fi if [ "$debug" = "yes" ] then echo "@PJL COMMENT End of Job" fi 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