#!/usr/bin/sh #(c) Copyright 1993 ~ 1995 Hewlett-Packard Company. All Rights Reserved. # #@(#) $Header: /users/hpnp/odyssey/repository/sh/net_ljcolor.psh,v 1.64 1999/11/28 16:00:10 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 customize 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_Options and/or Output_PS_Options and/or Output_PS2_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 Color LaserJet 4500 #supports HP Color LaserJet 8500 # 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 BPAPER="def" # CHANGE BANNER PAGE SIZE # Default Post script level PSLEVEL="2" # CHANGE POSTSCRIPT LEVEL PERSONALTY="AUTO" # CHANGE LANGUAGE BAUDRATE="9600" PRINTMODEL="lj4500" # CHANGE PRINTER MODEL TEOJ="on" # CHANGE TRUE END OF JOB BANNER="" # CHANGE BANNER PAGE PRINTING MPAGE=$HPNP/bin/mpage #Added by Ramki on 14th Oct 98 for PSNUP SPACECHAR="_-" OS="UNKNOWN" if [ "$OS" = "UNKNOWN" ] then OS=`uname` fi TMP=/tmp # --------------Security Related Change ----------------------------j # Username of the person invoking the command is got if it is root or lp # TMP environment variable is made as $HPNP/tmp. If it is normal user # .jpiu directory is created under home directory of the user if # the directory is not existant already. TMP environment variable # as $HOME/.jpiu. All the necessary debug files will go the directory # given by $TMP variable. 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 # ] # Sets the GREP, PR , log, OS and other variables according to the OS. 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" # '-F' option provides form-feed character for new pages 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 # Print list of options supported by the model script # -------- Part I Functions ----------------- all_options() { echo "@PJL ENTER LANGUAGE=PCL" echo "\033&k2G\c" echo " Description of available -o options for this script (net_ljcolor) is in man page. See \"man net_ljcolor\" 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" = "lj4500" ] then bannerpagesrc="4" else bannerpagesrc="8" fi ;; 2) bannerpagesrc="1";; 3) # feed from 3rd tray if [ "$PRINTMODEL" = "lj8500" ] then bannerpagesrc="4" else bannerpagesrc="5" fi;; 4) 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() { # No banner page for A5 and ISO B5 if [ "$paper" = "exec" ] # 7 1/4 x 10.5 then boxleftX=1908 #((725 - 460) * 72 ) / 10 boxrightX=4788 #((725 - 60 ) * 72 ) / 10 boxtopY=5349 #((1050 - 307 ) * 72 ) / 10 boxbottomY=7142 #(( 1050 - 58 ) * 72 ) / 10 echo "\033&a"`expr $boxtopY + 158 `"v28L\c" elif [ "$paper" = "letter" ] # 8.5 inch x 11 inch then boxleftX=2505 # ((850 - 502) * 72) / 10 boxrightX=5385 # ((850 - 102) * 72) / 10 boxtopY=5515 # ((1100 - 334) * 72) / 10 boxbottomY=7315 # ((1100 - 84) * 72) / 10 echo "\033&a"`expr $boxtopY + 158`"v36L\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=11491 # (( 1638 - 42 ) * 72 ) / 10 echo "\033&a"`expr $boxtopY + 158 `"v71L\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=5968 # (( 1158 - 329) * 72 ) / 10 boxbottomY=7761 # (( 1158 - 80 ) * 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=7812 # (( 1400 - 315 ) * 72 ) / 10 boxbottomY=9604 # (( 1400 - 66 ) * 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=9849 # (( 1700 - 332) * 72 ) / 10 boxbottomY=11649 # (( 1700 - 82 ) * 72 ) / 10 echo "\033&a"`expr $boxtopY + 158 `"v65L\c" elif [ "$paper" = "ledger" ] # 11x17 inches then boxleftX=4608 # (( 1100 - 460 ) * 72 ) / 10 boxrightX=7488 # (( 1100 - 60 ) * 72 ) / 10 boxtopY=9849 # (( 1700 - 332) * 72 ) / 10 boxbottomY=11649 # (( 1700 - 82 ) * 72 ) / 10 echo "\033&a"`expr $boxtopY + 158 `"v65L\c" elif [ "$paper" = "JISB4" ] # 257 mm x 364 mm (10.02" x 14.33") then boxleftX=3902 # ((1002 - 460 ) * 72 ) / 10 boxrightX=6782 # ((1002 - 60 ) * 72 ) / 10 boxtopY=7992 # ((1433 - 323 ) * 72 ) / 10 boxbottomY=9784 # ((1433 - 74) * 72 ) / 10 echo "\033&a"`expr $boxtopY + 158 `"v55L\c" elif [ "$paper" = "JISB5" ] # 182 mm x 257 mm (7.1" x 10.02") then boxleftX=1800 # (( 717 - 467 ) * 72 ) / 10 boxrightX=4680 # (( 717 - 67 ) * 72 ) / 10 boxtopY=4737 # (( 1012 - 354 ) * 72 ) / 10 boxbottomY=6530 # ((1012 - 105 ) * 72 ) / 10 echo "\033&a"`expr $boxtopY + 158 `"v26L\c" else # letter boxleftX=2505 # 2808 boxrightX=5385 # 5688 boxtopY=5518 boxbottomY=7315 # 7258 echo "\033&a"`expr $boxtopY + 158`"v36L\c" fi # Print the Option summary in the Banner page echo "********** Option Summary **********" echo " (See \"man net_ljcolor\" for details)\n" echo "\033&k2S\c" # use compressed font echo "auto (default), postscript, pcl, hpgl2, hpgl2_p, raw, relay" echo "manual, manenv, tray1, tray2, tray3, tray4, mtype" echo "legal, letter, exec, ledger/11x17 A3, A4, A5, B5-ISO" echo "B4-JIS, B5-JIS, com10, C5, DL, monarc, PostCard/PostCardD" echo "bin1, bin2, srbb#, srb#, sre#, topaz, yb, nb, job, nojob" echo "simplex, duplex, hduplex, vduplex, mduplex" echo "2up, 2+, 4up, portrait, landscape, finish" echo "pnh, collate, cctrl, halftone" echo "For PS : wmstr, wmnum#, ascii, ps1, ps2, ps3" echo "For PCL : text, ln66, stye#, italic, condensed, condensedi" echo "c, 10, 12, lpi# height#, weight#, medium, bold, ebold, type#" echo "\033&a"$boxtopY"v"$boxleftX"H\033*c4h1800v0P\033*c2880h4v0P\c" echo "\033&a"$boxbottomY"v"$boxleftX"H\033*c2880h4v0P\c" echo "\033&a"$boxtopY"v"$boxrightX"H\033*c4h1800v0P\c" } # Send PCL commands to the printer for selection of banner page tray source # Drawing of boxes, printing option summary, printing of user info etc do_pcl_banner() { # Print the standard header # where does the paper go to if [ $outb != "def" ] then echo "@PJL SET OUTBIN=$outb" echo "@PJL ENTER LANGUAGE=PCL" else echo "@PJL ENTER LANGUAGE=PCL" if [ $mediadest != "def" ] then echo "\033&l${mediadest}G\c" fi fi # where does the paper come from if [ "$bannerpagesrc" != "def" ] then echo "\033&l${bannerpagesrc}H\c" else case "$mediasrc" in 1 | 4 | 5 | 8 | 3) echo "\033&l${mediasrc}H\c";; esac 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 ] # No Banner page printing for PostcardD, Envelope, Custom and A5 case "$paper" in ISOA3) # 297 mm x 420 mm (11.58" x 16.38") echo "\033&l27A\c" boxbottomY=1920 boxtopY=240 echo "\033&a240v\c" # Set vertical start pos boxwidth=7833;; ISOA4) # 210 mm x 297 mm (8.19" x 11.58") echo "\033&l26A\c" boxwidth=5493 echo "\033&a240v\c" # Set vertical start pos boxbottomY=1920 boxtopY=240;; exec) echo "\033&l1A\c" # 7 1/4 x 10.5 boxtopY=180 boxbottomY=1860 echo "\033&a220v\c" # Set vertical start pos boxwidth=4737;; legal) echo "\033&l3A\c" # 8.5 x 14 boxtopY=180 boxbottomY=1855 echo "\033&a220v\c" # Set vertical start pos boxwidth=5616;; letter) echo "\033&l2A\c" boxwidth=5616 boxtopY=180 echo "\033&a220v\c" # Set vertical start pos boxbottomY=1860 ;; ledger | 11x17) echo "\033&l6A\c" boxtopY=180 echo "\033&a220v\c" # Set vertical start pos boxbottomY=1860 boxwidth=7416;; JISB4) echo "\033&l46A\c" # 257x364mm (10.02"x14.33") boxtopY=180 boxbottomY=1855 echo "\033&a220v\c" # Set vertical start pos boxwidth=6840;; JISB5) echo "\033&l45A\c" # 182x257mm (7.17"x10.12") echo "\033&a150v\c" # Set vertical start pos boxwidth=4700;; def) echo "\033&l2A\c" # set def as letter boxwidth=5616 boxtopY=180 echo "\033&a220v\c" # Set vertical start pos boxbottomY=1860 ;; esac echo "\033&k2G\033&l0O\c" # always in portrait mode if [ "$OS" = "HP-UX" ] then echo "\033)8U\033)s1p60v1s0b16901T\n $user\033)s14v0S" # print user name onto top of the banner page. user1=`pwget -n $user | line | cut -d: -f5` #get the user information from the password file. 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" # print user name onto top of the banner page. 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" # print system name. 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 # Print title if sepcified if [ -n "$title" ] then if [ "$OS" = "HP-UX" ] then echo "\t\t\t\t\tTitle: $title" else echo "\t\t\t\t\tTitle: $title\n" fi 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 if [ -r $HPNP/etc/hplogo.pcl ] then echo "\033&a140v"$boxwidth"H\c" cat $HPNP/etc/hplogo.pcl 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 ] } # Sets up margins, font, Number of lines per page etc 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="" psnup="" #Added by Ramki on 14th Oct 98 for PSNUP outputmode_specify="" invalidopt="" listopt="" 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 ascii="" font="Courier" # CHANGE DEFAULT FONT FOR POSTSCRIPT duplex="def" # CHANGE DEFAULT DUPLEX MODE mediasrc="def" # CHANGE DEFAULT MEDIA SOURCE mediadest="def" # CHANGE DEFAULT MEDIA DESTINATION ONLY FOR PCL FILE outb="def" # CHANGE DEFAULT MEDIA DESTINATION outbstring="OPTIONALOUTBIN" mtype="def" # CHANGE DEFAULT MEDIA TYPE halftone="smooth" # CHANGE DEFAULT HALFTONE MODE colorcontrol="screenmatch" # CHANGE DEFAULT COLORCONTROL MODE filetype="def" # CHANGE DEFAULT FILE TYPE finish="def" # CHANGE DEFAULT FINISHING wmnum="" # CHANGE DEFAULT WATER MARK STRING FROM 1 TO 15 wname="" wmstring="" # CHANGE DEFAULT WATER MARK STRING collate="on" # CHANGE DEFAULT COLLATE MODE proofnhold="def" # CHANGE DEFAULT PROOF AND HOLD MODE mtypestring="\033&n" pescfile="no" # CHANGE DEFAULT PESC MODE (pesc option) orientation="def" # CHANGE DEFAULT ORIENTATION paper="def" # CHANGE DEFAULT PAPER SIZE length="def" length2up="-l66" pitch="def" #pitch="10.7" hsi="def" lpagelen="def" textlen="def" lmargin="def" rmargin="def" tmargin="def" italic="" spacing="def" lpi="def" vsi="def" charset="def" height="def" style="def" typeface="def" weight="def" width2up=178 # for silent run use startpg=1 # CHANGE DEFAULT START PAGE (srb option) jrpg=0 # CHANGE JOBRECOVERY START PAGE extraEOJ="false" endpg=0 # CHANGE DEFAULT END PAGE (are option) rendermode="def" # CHANGE DEFAULT RENDER (COLOR-GRAY) MODE mediatype="" # CHANGE DEFAULT MEDIA TYPE rotate="" # CHANGE DEFAULT ROTATE MODE staple="def" # CHANGE DEFAULT STAPLE MODE topaz="def" # CHANGE DEFAULT TOPAZ MODE loffset="def" } # end of init_variables() #----------------------------------- # Parse the command line options #----------------------------------- Parsing_Options() { for i in $options do case "$i" in #Get debug file name debugm[/a-zA-Z0-9.-_]*) debug="yes";; #Debug option turned on debugm) debug="yes";; #Staple on staple) staple="yes";; #topaz on topaz) if [ $copies -gt 1 ] then topaz="yes" fi;; ps1) PSLEVEL="1";; ps2) PSLEVEL="2";; ps3) PSLEVEL="3";; auto) lang="AUTO" lang_user="AUTO";; #If relay is specified just dump output and exit 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";; #if hpgl2 or hpgl2_p set raw mode hpgl2) lang_specify="yes" outputmode_specify="yes" lang="PCL" lang_user="HPGL2" outputmode="raw";; hpgl2_p) lang_specify="yes" outputmode_specify="yes" lang="PCL" lang_user="HPGL2_P" outputmode="raw";; r | raw) outputmode_specify="yes" outputmode="raw";; text) lang_specify="yes" outputmode_specify="yes" lang="PCL" lang_user="PCL" outputmode="cooked";; # file type pesc) pescfile="yes";; # Job Control 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//'`";; color) rendermode="color";; gray) rendermode="gray";; 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 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" ;; # ] #3 hole 3hole) ThreeHoles="yes";; portrait) # print in portrait mode orientation="p";; landscape) # print in landscape mode orientation="l";; rotate) rotate="yes";; #Rotate the job # 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 tray1 ) # feed from tray 1 if [ "$PRINTMODEL" = "lj4500" ] then mediasrc="4" else mediasrc="8" fi ;; manual | man ) # manual sheet feed if [ "$PRINTMODEL" = "lj4500" ] then mediasrc="4" #modified by Ramki on 21 Nov 98 else mediasrc="2" fi ;; tray2 | upper | ub | ubin) # feed from upper tray mediasrc="1";; tray3 | lower | lb | lbin ) # feed from lower tray if [ "$PRINTMODEL" = "lj8500" ] #Feed from tray3 then mediasrc="4" else mediasrc="5" fi ;; tray4 ) # HCI mediasrc="5" ;; manualenv | manenv ) if [ $PRINTMODEL = "lj8500" ] then mediasrc="3" else mediasrc="4" fi ;; # paper destination # [ Modified by Raju on 25th Nov '98 to fix the problem of not printing to the # faceup bin # bin2 | rearbin | leftbin) # to back bin bin2 ) # to back bin (when mailbox is attached) # ] if [ "$PRINTMODEL" = "lj4500" ] then outb="LOWER" else outb="OPTIONALOUTBIN1" fi mediadest="2" ;; # [ Modified by Raju on 25th Nov '98 to fix the problem of not printing to the # faceup bin rearbin | leftbin ) # to back bin (when mailbox is not attached) outb="LOWER" mediadest="2" ;; # End ] bin1 | topbin) # to top bin outb="UPPER" mediadest="1" ;; bin*) binnum=`echo "$i" | sed 's/^bin//'` binnum=`expr $binnum - 1` outb="${outbstring}$binnum";; #Specify media type mtype*) mtype=`echo "$i" | sed 's/^mtype//'`;; #Specify halftone halftone*) halftone=`echo "$i" | sed 's/^halftone//'`;; #Specify colorcontrol colorcontrol*) colorcontrol=`echo "$i" | sed 's/^colorcontrol//'`;; cctrl*) colorcontrol=`echo "$i" | sed 's/^cctrl//'`;; #Specify file type filetype*) filetype=`echo "$i" | sed 's/^filetype//'`;; #finsish type matte or glossy finish*) finish=`echo "$i" | sed 's/^finish//'`;; #specify collate collate[o][nf]*) # Collate collate="`echo "$i" | sed 's/^collate//'`";; #specify watermark to be printed wmstr*) wmstring=`echo "$i" | sed 's/^wmstr//' | sed "s/${SPACECHAR}/ /g"`;; wmnum*) wmnum=`echo "$i" | sed 's/^wmnum//'` ;; proofnhold*) proofnhold=`echo "$i" | sed 's/^proofnhold//'`;; pnh*) proofnhold=`echo "$i" | sed 's/^pnh//'`;; # 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) # 148 mm x 210 mm paper="ISOA5" banner="";; # don't print banner page for this executive | exec) # 7 1/4 x 10.5 paper="exec";; ledger ) width2up=174 paper="ledger";; 11x17 ) width2up=174 paper="11x17";; B4-JIS) paper="JISB4";; B5-JIS) paper="JISB5";; B5-ISO) paper="ISOB5" banner="";; # don't print banner page for this custom) paper="custom" banner="";; # don't print banner page for this PostCard | PostCardD) paper="postcardD" banner="";; # don't print banner page for this com10 | com10env) # feed from envelope tray, paper="com10" banner="";; # don't print banner page for this 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="" ;; # feed banner page from nput trays btray1) if [ "$PRINTMODEL" = "lj4500" ] then bannerpagesrc="4" else bannerpagesrc="8" fi ;; btray2 | bupper | ubb) bannerpagesrc="1";; btray3 | blower | lbb) # feed from 3rd tray if [ "$PRINTMODEL" = "lj8500" ] then bannerpagesrc="4" else bannerpagesrc="5" fi;; btray4) bannerpagesrc="5" ;; 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//'`";; 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//'`";; style[4-5]) style="`echo "$i" | sed 's/^style//'`";; i | italic) style=italic;; upright) style="0";; conden | condensed) style="4" ;; condeni | condensedi) style="5" ;; # 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//'`";; m | medium) weight=0;; sb | sbold) weight=1;; b | bold) weight=3;; eb | ebold) weight=4;; #set absolute length of page ln66) ln66="yes";; eolwrap) eolwrap="yes";; 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";; f*) # new font used by ASCII-to-PS font="`echo "$i" | sed 's/^f//'`";; hpnpflog | job* | nojob*) ;; # to prevent them from being displayed *) invalidopt="$invalidopt $i";; esac done if [ "$topaz" = "yes" ] then banner="" fi # Part 2: Reolve conflict between options # settle outputmode precedence: pesc, raw, 2/4-up, and mdouble if [ "$lang_user" = "PCL" -a "$pescfile" = "yes" ] then if [ "$outputmode" = "raw" ] then outputmode="cooked" fi fi if [ "$outputmode" = "raw" ] then dividing="" # invalidate 2/4-up manuald="" # invalidate manual duplex fi if [ -n "$manuald" ] then outputmode="mdouble" omode_user="mdouble" fi if [ -n "$dividing" ] # override manaul double then case "$paper" in 11x17 | ledger) if [ "$dividing" = "-q" ] then dividing="" # not supported else outputmode="divide" omode_user="divide" if [ "$lpagelen" != "def" ] then length2up="-l$lpagelen" fi fi;; *) outputmode="divide" omode_user="divide" if [ "$lpagelen" != "def" ] then length2up="-l$lpagelen" fi;; esac fi if [ "$ln66" = "yes" ] then vsi="7.4" textlen="66" pitch="10.7" orientation="p" lpi="def" # reset, if specified. fi if [ "$ThreeHoles" = "yes" ] then # override pitch, lmargin, tmargin, vsi pitch="10.7" loffset="180" if [ "$orientation" = "def" ] then orientation="p" fi if [ "$orientation" = "p" ] then if [ "$lmargin" = "def" ] then lmargin="2" fi else if [ "$tmargin" = "def" ] then tmargin="2" fi if [ "$vsi" = "def" ] then vsi="7.85" fi fi fi if [ "$mediasrc" = "6" ] then banner="" orientation="l" fi # Silent run page adjustment # override startpg if jrpg not 0 if [ "$jrpg" -ne 0 ] then startpg=$jrpg listopt="no" banner="yes" fi if [ "$duplex" != "simplex" -a "$duplex" != "def" ] then if [ $startpg -gt 1 ] then num=$startpg num=`expr $num % 2` if [ $num -eq 0 ] then startpg=`expr $startpg - 1` fi fi fi if [ "$startpg" -gt 0 ] then if [ "$dividing" = "-h" -o "$dividing" = "-hh" ] then startpg2updiv=`expr $startpg / 2` startpg2upmod=`expr $startpg % 2` if [ "$startpg2upmod" -eq 0 ] then startpg=$startpg2updiv else startpg=`expr $startpg2updiv + 1` fi elif [ "$dividing" = "-q" ] then startpg4updiv=`expr $startpg / 4` startpg4upmod=`expr $startpg % 4` if [ "$startpg4upmod" -eq 0 ] then startpg=$startpg4updiv else startpg=`expr $startpg4updiv + 1` fi # [ Modified by Amit Raval to fix the defect # 57427 on Apr. 22nd 1999 elif [ "$dividing" = "8up" ] then startpg8updiv=`expr $startpg / 8` startpg8upmod=`expr $startpg % 8` if [ "$startpg8upmod" -eq 0 ] then startpg=$startpg8updiv else startpg=`expr $startpg8updiv + 1` fi # ] fi STARTPAGE="START = $startpg" else STARTPAGE="" fi if [ "$endpg" -gt 0 ] then if [ "$dividing" = "-h" -o "$dividing" = "-hh" ] then endpg2updiv=`expr $endpg / 2` endpg2upmod=`expr $endpg % 2` if [ "$endpg2upmod" -eq 0 ] then endpg=$endpg2updiv else endpg=`expr $endpg2updiv + 1` fi elif [ "$dividing" = "-q" ] then endpg4updiv=`expr $endpg / 4` endpg4upmod=`expr $endpg % 4` if [ "$endpg4upmod" -eq 0 ] then endpg=$endpg4updiv else endpg=`expr $endpg4updiv + 1` fi # [ Modified by Amit Raval to fix the defect # 57427 on Apr. 22nd 1999 elif [ "$dividing" = "8up" ] then endpg8updiv=`expr $endpg / 8` endpg8upmod=`expr $endpg % 8` if [ "$endpg8upmod" -eq 0 ] then endpg=$endpg8updiv else endpg=`expr $endpg8updiv + 1` fi # ] fi ENDPAGE="END = $endpg" else ENDPAGE="" fi # Validate banner page for all the medias # banner page is not supported in B5-ISO, A5, C5, PostCardD, # PostCardS, com10, DL, monarc if [ -n "$banner" ] then case "$paper" in B5-ISO | ISOA5 | C5 | PostCard* | com10 | DL | monarc) banner="";; esac 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";; # UC tray;; 4) echo "3 setpapertray";; # upper tray or MP tray;; 5) echo "2 setpapertray";; # UC tray ;; 8) echo "4 setpapertray" ;; 2) echo "/manualfeed true def";; # feed from manual 3) echo "/manualfeed envelope" ;; # feed envelope 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";; JISB4) echo "jb4tray";; JISB5) echo "jb5tray";; ISOB5) echo "b5tray";; exec) echo "executivetray";; letter) echo "lettertray";; legal) echo "legaltray";; ledger) echo "ledgertray";; 11x17) echo "11x17tray";; custom) echo "customtray";; C5) echo "c5envelopetray";; com10) echo "com10envelopetray";; DL) echo "dlenvelopetray";; postcardD) echo "doublepostcardtray";; monarc) echo "monarcenvelopetray";; esac case "$duplex" in simplex) echo "false setduplexmode";; vduplex) echo "true setduplexmode" echo "false settumble";; hduplex) echo "true setduplexmode" echo "true settumble";; esac echo "end" if [ "$mediasrc" = "6" ] then echo "90 rotate" fi } # end of Output_PS_Options() #This function sets the variables and sets up the globaldict for halftone #and colorcontrol printing. ColorSmartManual() { case "$colorcontrol" in screenmatch) colorcontrol="MatchScreen";; vivid) colorcontrol="Vivid";; *) invalidopt="$invalidopt $colorcontrol";; esac case "$halftone" in smooth) halftone="Smooth";; detail) halftone="Detail";; *) invalidopt="$invalidopt $halftone";; esac echo "{" echo "globaldict /ColorSmartColorMatching known {" echo "true ColorSmartColorMatching" echo "} if" echo "/setscreen { pop pop pop } def " echo "/setcolorscreen { pop pop pop pop pop pop pop pop pop pop pop pop } def " echo "/sethalftone { pop } def" echo "}" } #Print watermark string on all the pages of document is specified. #Iff numeral value is specified it prints standard text as watermark else #it will print the string which specified along with wmnum option WaterMark() { if [ -n "$wmnum" ] then case "$wmnum" in 1) wname="Company Confidential";; 2) wname="Company Proprietary";; 3) wname="Company Private";; 4) wname="Confidential";; 5) wname="Copy";; 6) wname="Draft";; 7) wname="File Copy";; 8) wname="Final";; 9) wname="For Internal Use Only";; 10) wname="Preliminary";; 11) wname="Proof";; 12) wname="Review Copy";; 13) wname="Sample";; 14) wname="Top Secret";; 15) wname="Urgent";; *) invalidopt="$invalidopt $wmnum";; esac elif [ -n "$wmstring" ] then wname=$wmstring fi if [ -n "$wname" ] then echo "userdict /HPwmText ($wname) put" fi } # ----------------------------------------------------------------- # Output PostScript level 2 options. This function sends Postscript # Level 2 commands for setting media size, media type, color control # duplex modes, halftone mode and finishing mode. # ----------------------------------------------------------------- Output_PS2_Options() { echo "<<" echo "/DeferredMediaSelection true" echo "/Policies <>" case "$mediasrc" in 1) echo "/DeferredMediaSelection true /MediaPosition 0";;# lower tray 4) echo "/DeferredMediaSelection true /MediaPosition 3";;# upper Tray 5) echo "/DeferredMediaSelection true /MediaPosition 1";; # LC Tray 2) echo "/DeferredMediaSelection true /ManualFeed true";; # feed from manual 8) echo "/DeferredMediaSelection true /MediaPosition 4";; 3) echo "/DeferredMediaSelection true /ManualFeed envelope" ;; esac # case "$mediadest" in # 1) echo "/OutputAttributes <>";; # up output bin (face down) # 2) echo "/OutputAttributes <>";; # back output bin (face up) # esac case "$paper" in ISOA3) echo "/DeferredMediaSelection true /PageSize [842 1191]";; #a3 ISOA4) echo "/DeferredMediaSelection true /PageSize [595 842]";; #a4 paper ISOA5) echo "/DeferredMediaSelection true /PageSize [420 595]";; #a5 paper ISOB5) echo "/DeferredMediaSelection true /PageSize [499 708]";; #b5 paper JISB4) echo "/DeferredMediaSelection true /PageSize [729 1032]";; #jb4tray JISB5) echo "/DeferredMediaSelection true /PageSize [516 729]";; #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 com10) echo "/DeferredMediaSelection true /PageSize [297 684]";; # comm10 envelope C5) echo "/DeferredMediaSelection true /PageSize [461 648]";; # c5 envelope DL) echo "/DeferredMediaSelection true /PageSize [312 624]";; # dl envelope postcardD) echo "/DeferredMediaSelection true /PageSize [420 567]";; #double postcard monarc) echo "/DeferredMediaSelection true /PageSize [279 540]";; #monarc esac case "$duplex" in simplex) echo "/Duplex false";; vduplex) echo "/Duplex true" echo "/Tumble false";; hduplex) echo "/Duplex true" echo "/Tumble true";; esac #The following statement is Modified by Ramki on 03 Nov 1998 #Type of finish which is require on the output case "$finish" in glossy) echo "<< /GlossFinish true >> setpagedevice";; matte) echo "<< /GlossFinish false >> setpagedevice";; esac # Send the halftone and color control commands depending on the type of # filetype. colorcontrol is vivid by default if [ "$filetype" != "def" ] then ColorSmartManual fi case "$filetype" in text) echo "{" echo "globaldict /ColorSmartColorMatching known {" echo "true ColorSmartColorMatching" echo "${colorcontrol} ColorSmartTextAdjustment" echo "${halftone} ColorSmartTextHalftone" echo "} if" echo "}" ;; graphics) echo "{" echo "globaldict /ColorSmartColorMatching known {" echo "true ColorSmartColorMatching" echo "${colorcontrol} ColorSmartGraphicsAdjustment" echo "${halftone} ColorSmartGraphicsHalftone" echo "} if" echo "}" ;; photographics) echo "{" echo "globaldict /ColorSmartColorMatching known {" echo "true ColorSmartColorMatching" echo "${colorcontrol} ColorSmartImageAdjustment" echo "${halftone} ColorSmartImageHalftone" echo "} if" echo "}" ;; esac #Rendering whether rendermode is color or gray case "$rendermode" in color) if [ "$PRINTMODEL" = "lj8500" ] then # [ Modified by Raju to correct the Postscript command for setting render mode # echo "<< /ProcessColorModel DeviceCMYK >> setpagedevice" echo "<< /ProcessColorModel /DeviceCMYK >> setpagedevice" # End ] else # [ Modified by Raju to correct the Postscript command for setting render mode # echo "<< /ProcessColorModel DeviceCMY >> setpagedevice" echo "<< /ProcessColorModel /DeviceCMY >> setpagedevice" # End ] fi ;; gray) echo "<< /ProcessColorModel /DeviceGray >> setpagedevice";; esac if [ "$PRINTMODEL" = "lj4500" ] then case "$mtype" in Gloss | Glossy) mtype="Gloss" ;; Cardstock | CardStock) mtype="Card Stock" ;; esac fi case "$mtype" in def) ;; *) echo "/DeferredMediaSelection true /MediaType ($mtype)" ;; esac echo ">>setpagedevice" } # end of Output_PS2_Options() # ----------------------------------------------------------------- # Output PostScript level 3 options. This function sends Postscript # Level 3 commands for setting media size, media type, color control, # duplex modes, halftone mode and finishing mode. This function will # be called only if printermodel is lj8500. # ----------------------------------------------------------------- Output_PS3_Options() { 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 # case "$mediadest" in # 1) # # echo "(printerinfo outtrayselect FACE_DOWN) =string # FieryXJdict /ExtCmdGetExec get exec {pop} if";; # up output bin (face down) # # 2) # # echo "(printerinfo outtrayselect FACE_UP) =string # FieryXJdict /ExtCmdGetExec get exec {pop} if";; # back output bin (face up) # # esac 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 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 postcardD) echo "<< /PageSize [420 567] /MediaType (null) /InputAttributes << 0 << /PageSize [420 567] /MediaType (null) >> >> >> setpagedevice";; #double postcard 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 case "$duplex" in simplex) echo "<> setpagedevice << /Tumble false >> setpagedevice";; vduplex) echo "<> setpagedevice << /Tumble false >> setpagedevice" ;; hduplex) echo "<> setpagedevice << /Tumble true >> setpagedevice" ;; esac #Type of finish which is require on the output case "$finish" in glossy) echo "(printerinfo setglossylevel GLOSSY) =string FieryXJdict /ExtCmdGetExec get exec {pop} if";; matte) echo "(printerinfo setglossylevel STANDARD) =string FieryXJdict /ExtCmdGetExec get exec {pop} if";; esac case $filetype in text) case $halftone in detail) echo "FieryXJdict /XJDefineTextHT known { (Detail) FieryXJdict /XJDefineTextHT get exec } if";; smooth) echo "FieryXJdict /XJDefineTextHT known { (Smooth) FieryXJdict /XJDefineTextHT get exec } if" ;; esac case $colorcontrol in vivid) echo "FieryXJdict /XJDefineTextCRD known { /Presentation FieryXJdict /XJDefineTextCRD get exec } if";; screenmatch) echo "FieryXJdict /XJDefineTextCRD known { /Photographic FieryXJdict /XJDefineTextCRD get exec } if" ;; oht) echo "FieryXJdict /XJDefineTextCRD known { /OHT FieryXJdict /XJDefineTextCRD get exec } if" ;; esac ;; graphics) case $halftone in detail) echo "FieryXJdict /XJDefineGraphicsHT known { (Detail) FieryXJdict /XJDefineGraphicsHT get exec } if" ;; smooth) echo "FieryXJdict /XJDefineGraphicsHT known { (Smooth) FieryXJdict /XJDefineGraphicsHT get exec } if" ;; esac case $colorcontrol in vivid) echo "FieryXJdict /XJDefineGraphicsCRD known { /Presentation FieryXJdict /XJDefineGraphicsCRD get exec } if";; screenmatch) echo "FieryXJdict /XJDefineGraphicsCRD known { /Photographic FieryXJdict /XJDefineGraphicsCRD get exec } if";; oht) echo "FieryXJdict /XJDefineGraphicsCRD known { /OHT FieryXJdict /XJDefineGraphicsCRD get exec } if";; esac ;; photographics) case $halftone in detail) echo "FieryXJdict /XJDefineImagesHT known { (Detail) FieryXJdict /XJDefineImagesHT get exec } if" ;; smooth) echo "FieryXJdict /XJDefineImagesHT known { (Smooth) FieryXJdict /XJDefineImagesHT get exec } if" ;; esac case $colorcontrol in vivid) echo "FieryXJdict /XJDefineImagesCRD known { /Presentation FieryXJdict /XJDefineImagesCRD get exec } if";; screenmatch) echo "FieryXJdict /XJDefineImagesCRD known { /Photographic FieryXJdict /XJDefineImagesCRD get exec } if";; oht) echo "FieryXJdict /XJDefineImagesCRD known { /OHT FieryXJdict /XJDefineImagesCRD get exec } if";; esac ;; esac case "$rendermode" in color) echo "<< /ProcessColorModel /DeviceCMYK >> setpagedevice" ;; gray) echo "<< /ProcessColorModel /DeviceGray >> setpagedevice" ;; esac 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. This function sends PCL # commands for setting media size, media type, color control # duplex modes, halftone mode , finishing mode etc... # ----------------------------------------------------------------- Output_PCL_Options() { # Specify the tray selection case "$mediasrc" in def);; *) echo "\033&l${mediasrc}H\c";; esac # Specify the media type if [ "$PRINTMODEL" = "lj4500" ] then case "$mtype" in Gloss | Glossy) mtype="Gloss";; CardStock | Cardstock) mtype="Cardstock";; esac fi case "$mtype" in def);; *) count=`echo "$mtype" | wc |awk '{print $3}'` echo "\033&n${count}Wd${mtype}\c";; esac #specify the media size 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 "\033&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&l100A\c";; com10) echo "\033&l81A\c";; custom) echo "\033&l101A\c";; postcardD) echo "\033&l72A\c";; C5) echo "\033&l91A\c";; DL) echo "\033&l90A\c";; monarc) echo "\033&l80A\c";; esac # does not matter if support or not, PCL will ignore it if not # Duplex mode case "$duplex" in simplex) echo "\033&l0S\c";; vduplex) echo "\033&l1S\c";; hduplex) echo "\033&l2S\c";; esac #Orientation 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 #End of line wrap case "$eolwrap" in yes) echo "\033&s0C\c" ;; no) echo "\033&s1C\c" ;; esac #VSI case "$vsi" in def);; *) echo "\033&l${vsi}C\c";; esac #Lines per inch case "$lpi" in def);; *) echo "\033&l${lpi}D\c";; esac #number of lines per page case "$lpagelen" in def) if [ "$length" = "def" ] then length="-l60" fi;; *) echo "\033&l${lpagelen}P\c" length="-l$lpagelen";; esac #specify top margin case "$tmargin" in def);; *) echo "\033&l${tmargin}E\c";; esac #text length case "$textlen" in def);; *) echo "\033&l${textlen}F\c" length="-l$textlen";; esac case "$charset" in def);; *) echo "\033(${charset}\c";; esac #Select spacing as proportional or fixed case "$spacing" in def);; *) echo "\033(s${spacing}P\c";; esac #Pitch case "$pitch" in def);; c) echo "\033&k2S\c";; *) echo "\033(s${pitch}H\c";; esac #HSI case "$hsi" in def);; *) echo "\033&k${hsi}H\c";; esac #height of font case "$height" in def);; *) echo "\033(s${height}V\c";; esac #style of font case "$style" in def);; italic) echo "\033(s1S\c" italic="-i";; condeni | condenseditalic) echo "\033(s5S\c" italic="-i";; *) echo "\033(s${style}S\c";; esac #specify font weight case "$weight" in def);; *) echo "\033(s${weight}B\c";; esac case "$typeface" in def);; *) echo "\033(s${typeface}T\c";; esac #specify left margin case "$lmargin" in def);; *) echo "\033&a${lmargin}L\c";; esac # specify right margin case "$rmargin" in def);; *) echo "\033&a${rmargin}M\c";; esac #select output bin case "$mediadest" in def);; *) echo "\033&l${mediadest}G\c";; # esac # Output mode as color or gray case "$rendermode" in color) ;; gray) echo "\033&b1M\c";; esac #Finish at the output case "$finish" in matte) echo "\033&b0F\c";; glossy) echo "\033&b1F\c";; esac # Send the commands depending on the type of filetype. case "$filetype" in text) if [ "$halftone" = "detail" ] then echo "\033*t0J\c" else if [ "$PRINTMODEL" = "lj8500" ] then echo "\033*t11j\c" #Smooth for lj8500 else echo "\033*t18j\c" #Smooth for lj4500 fi fi ;; graphics | photographics) if [ "$halftone" = "detail" ] then echo "\033*t15J\c" else echo "\033*t18j\c" #Smooth fi ;; esac # Send the commands depending on the type of filetype. filetype is text # by default. colorcontrol is vivid by default case "$filetype" in text | graphics | photographics ) case "$colorcontrol" in screenmatch) echo "\033*o3W646\c" ;; oht) echo "\033*o3W643\c" ;; vivid) if [ "$PRINTMODEL" = "lj8500" ] then echo "\033*o3W642\c" #Vivid for lj8500 else echo "\033*o3W643\c" #Vivid for lj4500 fi ;; esac ;; esac } # end of Output_PCL_Options() #--------------------------------------------------------------------- # Trap Handler. Echo the job cancel message to log and set the terminal # type when job is canceled. #--------------------------------------------------------------------- CancelJob() { rm -f $TMP/ljcolor$$ 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). # Set the font using 'fontdl' command for 2up and 4up # printing. #--------------------------------------------------------- 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_ljcolor 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 ****" 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 2 (Lower/PC Tray)" ;; 4) echo "@PJL COMMENT Input Tray: tray 1 (Upper/MP 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";; 8) echo "@PJL COMMENT Input Tray: tray 4" ;; 3) echo "@PJL COMMENT Input Tray: manual feed envelop" ;; esac fi } #---------------------------------------------------------------- # Profile1 and 2 are used for user-level diagnostic purpose #---------------------------------------------------------------- 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 case $colorcontrol in vivid) echo "@PJL COMMENT ** colorcontrol vivid, filetype $filetype" ;; screenmatch) echo "@PJL COMMENT ** colorcontrol screenmatch, filetype $filetype" ;; oht) echo "@PJL COMMENT ** colorcontrol oht, filetype $filetype" ;; esac case $halftone in detail) echo "@PJL COMMENT ** halftone detail filetype $filetype" ;; smooth) echo "@PJL COMMENT ** halftone smooth filetype $filetype" ;; esac case $finish in glossy) echo "@PJL COMMENT ** finishing glossy" ;; matte) echo "@PJL COMMENT ** finishing matte" ;; esac case $proofnhold in proof) echo "@PJL COMMENT ** proof and print on" ;; nohold) echo "@PJL COMMENT ** proof and print off" ;; esac case $collate in on) echo "@PJL COMMENT ** collate on" ;; off) echo "@PJL COMMENT ** collate off" ;; 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. # [ Change by Devu 30 JUL 1999 # pr -l$lineperpage -t -f pr -l$lineperpage -t -f | cut -c 1-$width2up #end Change ] # 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 | # sed handles the line feed character 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. Handle the 2up options by printing lines, # putting shadings for 2+ option in Solaris and HP-UX. #---------------------------------------------------------------- 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 output if 2up is specified #-------------------------------------- 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 } ' } #------------------------------------------------------------- # The prepfile1() is called, If 2+ option is specified. Add # date, line number to the page. #------------------------------------------------------------- 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 output if 2up is specified #-------------------------------------- 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 }' } #------------------------------------------------------------- # The prepfile1() is called, If 2 up option is specified. Add # date, line number to the page. #------------------------------------------------------------- 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" } #------------------------------------------------------ # Call the prepfile1 function if 2+ options is specified # and call the prepfile2 if 2up options is specified. #------------------------------------------------------ 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 # and if the paper size 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 } #------------------------------------------------------ #User dictionary is setup for watermark printing #------------------------------------------------------ User_Dict_Setup() { # [Modified by Kumaresan on 8th Nov'98 to fix the problem of printing bigger # fonts when water mark and -oascii is selected if [ -z "$ascii" ] then # ] echo "%%BeginFeature: *HPNup OneUp" echo "% Copyright (c) Hewlett-Packard Co 1997" echo "userdict begin" echo "true setglobal /HPwm 5 dict dup begin /HPwmOn true def /HPwmOdd true def end def false setglobal " echo "userdict /HPwmAngle known not {/HPwmAngle 45 def} if" echo "userdict /HPwmSize known not {/HPwmSize 48 def} if" echo "userdict /HPwmLocation known not {/HPwmLocation true def} if" echo "userdict /HPwmStyle known not {/HPwmStyle .48 def} if" echo "userdict /HPwmDuplex known not {/HPwmDuplex 0 def} if" echo "/HPwmEOP {HPwmDuplex 0 eq {true}{HPwmDuplex 1 eq HPwmOdd eq dup not {erasepage}if" echo "true setglobal /HPwmOdd HPwmOdd not def false setglobal}ifelse} bind def" echo "end" echo "<<" echo "/EndPage {userdict begin" echo "userdict /HPwmText known HPwm /HPwmOn get and" echo "{initmatrix" echo "0 setgray 1 setlinewidth true setstrokeadjust 0 setlinejoin 0 setlinecap [] 0 setdash" echo "currentpagedevice /PageSize get aload pop 2 div exch 2 div exch translate" echo "HPwmAngle rotate /HPwmFont userdict /HPppScale known {HPwmSize HPppScale mul}{HPwmSize}ifelse selectfont" echo "HPwmText stringwidth 2 div neg exch 2 div neg exch" echo "userdict /HPppScale known {HPwmSize HPppScale mul}{HPwmSize}ifelse .25 mul sub moveto" echo "HPwmText false charpath userdict /HPwmStyle1 known" echo "{gsave 1 setgray HPwmStyle1 HPwmStyle add setlinewidth stroke grestore} if" echo "0 setgray HPwmStyle setlinewidth stroke" echo "HPwmLocation not {true setglobal HPwm /HPwmOn false put false setglobal} if" echo "} if" echo "2 eq {pop false}{pop HPwm begin HPwmEOP end} ifelse" echo "end } bind" echo ">> setpagedevice" echo "%%EndFeature" # [Modified by Kumaresan on 8th Nov'98 to fix the problem of printing bigger # fonts when water mark and -oascii is selected fi # ] } # [ 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/ljcolor* # 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" echo "@PJL USTATUS PAGE = OFF" # turn off, to prevent page # fluctuat Profile1 # banner page ; if [ -n "$banner" ] then echo "@PJL JOB" closejob="true" echo "@PJL SET COPIES = 1" # this is to prevent front panel from 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 if [ "$proofnhold" = "proof" ] then echo "@PJL SET JOBNAME = \"$jobid\"" echo "@PJL SET USERNAME = \"$user\"" echo "@PJL SET HOLDJOB=ON" topaz="yes" # Must be yes to print multiple copies collate="on" else echo "@PJL JOB NAME = \"User: $user; Job: $jobid\" $STARTPAGE $ENDPAGE" fi 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 # set up PJL env. if [ "$staple" = "yes" ] then echo "@PJL SET FINISH = STAPLE" fi if [ "$topaz" = "yes" ] # collate must be given along with topaz then if [ "$collate" = "on" ] then echo "@PJL SET QTY = $copies" # collated copies echo "@PJL SET COPIES = 1" elif [ "$collate" = "off" ] then echo "@PJL SET COPIES = $copies" echo "@PJL SET QTY = 1" # Non-collated copies fi copies="1" fi # case "$rendermode" in # Render Mode # color) echo "@PJL SET RENDERMODE = COLOR" ;; # gray) echo "@PJL SET RENDERMODE = GRAYSCALE";; # esac # outbin mailbox using aliases case "$outb" in def ) ;; # do nothing *) echo "@PJL SET OUTBIN = $outb" ;; esac if [ $topaz = "def" ] then echo "@PJL SET COPIES = 1" # this is to prevent front panel from fi copy=1 fno=1 while [ $copy -le $copies ] do for file in $files do WRONGTYPE="false" if [ "$lang_user" = "AUTO" ] then Resolve_Lang fi # moved to here from 2up area, so that it can be shared by # both. if [ "$OS" = "HP-UX" ] then fname=`echo $fnamelist | cut -f$fno -d" "` if [ -f /usr/bin/file ] then if /usr/bin/file $file | cut -f2 -d: | $GREP > /dev/null then # let it print WRONGTYPE="true" fi fi # [This change is revoked back becase it is not working for the data piped # to lp by Kumaresan on 27th July'99. ## [ Modified by Amit Raval to fix the defect# 57424 on Apr. 21th 1999 # else # fname=$file ## ] # ] fi Profile2 # [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) banner="" cat "$file";; # straight to the printer PS) echo "@PJL ENTER LANGUAGE=POSTSCRIPT" if [ "$PRINTMODEL" = "lj8500" ] then PSLEVEL="3" elif [ "$PRINTMODEL" = "lj4500" ] then PSLEVEL="2" fi case $PSLEVEL in 1) Output_PS_Options ;; 2) Output_PS2_Options ;; 3) Output_PS3_Options ;; esac #User_Dict_Setup is called to set the dictnory to be used by watermark function #Watermark function is called to print the Standard string or user defined #String on background of all the pages of the document. if [ -n "$wmstring" -o -n "$wmnum" ] then User_Dict_Setup WaterMark 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" # enter to PCL mode 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 # Setup for nup printing fi Output_PCL_Options # send the pcl commands according to the options specified 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/ljcolor$$;; # dump the file to temp file. cooked) echo "\033&k2G\c" if [ "$pescfile" = "yes" ] then # 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 # handle the reverse option. else if [ "$nroff" = "" ] # only use lprpp when nroff is set then cat "$file" 2>>$TMP/ljcolor$$ # dump the file to temp file. else lprpp $italic $length $nroff < "$file" 2>&1 #handle the nroof option. fi fi else # Solaris and others cat "$file" 2>>$log # dump the file to log file. 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 #handle the reverse option. else lprpp $italic $length $nroff -o < "$file" 2>&1 # handle the nroff option. fi echo "\033&l2H\c" lprpp $italic $length $nroff -e < "$file" 2>&1;; divide) # handle the nup printing. 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 problem 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/ljcolor$$" ] then cat $TMP/ljcolor$$ >> $log rm -f $TMP/ljcolor$$ 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