#!/usr/bin/sh # (c) Copyright 1993,1994 Hewlett-Packard Company. All Rights Reserved. #@(#) $Header: /users/hpnp/odyssey/repository/sh/net_dsnj.psh,v 1.19 1999/10/12 09:28:35 hpnp Exp $ # USER CAUTION: If any changes are desired, you should first make a copy # of this model under a new name. Changes can then be made to the copy #=======================================================================# # **** This script may be used with Designjet plotter models **** # # **** which understand PostScript. Options below may **** # # **** NOT be available to all models. Use them discreetly **** # # # # OPTIONS RECOGNIZED: # # # # Language Switch # # auto script determines the personality (PS or HPGLx) # # postscript print in PostScript mode # # hpgl send HPGL file to plotter wrapped with IN/PG # # hpgl2 send HPGL2 to plotter wrapped with IN/PG # # relay pass the data to the plotter without adding any # # options or personality switching statement # # or HPGLx commands # #=======================================================================# #[ For WJA use #version E.10.05 #supports HP DesignJet 750C (C3196A) #supports HP DesignJet 750C Plus (C4708A) #supports HP DesignJet 750C Plus (C4709A) #supports HP DesignJet 755CM (C3198A) #supports HP DesignJet 755CM (C3198B) #supports HP DesignJet 700 (C4705A) #supports HP DesignJet 700 (C4706A) #supports HP DesignJet 2500CP (C4704A) #supports HP DesignJet 2000CP (C4703A) #supports HP DesignJet 3500CP (C4724A) #supports HP DesignJet 3000CP (C4723A) #supports DesignJet 1055CM (C6075A) #supports DesignJet 1050C (C6074A) # by Devu 1 oct 1999] PERSONALTY="AUTO" # CHANGE LANGUAGE BAUDRATE="9600" PRINTMODEL="dsnj" # CHANGE PRINTER MODEL TEOJ="off" # CHANGE TRUE END OF JOB BANNER="na" # CHANGE BANNER PAGE PRINTING HPNPS=/opt/hpnp/bin/hpnps # [ Modified by Suresha on 26th Sep 99 to support JPIU HPNPS=/opt/hpnpl/bin/hpnps # for serial connection PATH="/usr/bin:/usr/lib" export PATH # set up redirection of stderr log=/var/adm/lp/log exec 2>>$log # Save the arguments to the model printer=`basename $0` reqid=$1 user=$2 title=$3 # CHANGE TITLE copies=$4 # CHANGE COPIES options=$5 # CHANGE OPTIONS # Assume that the rest of the arguments are files shift; shift; shift; shift; shift files="$*" # 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 fi # Handle disable and cancel traps. trap "trap 15; kill -15 0; exit 0 " 15 # initialize the variables # Default Personality # Other possible lang_user/lang values: PCL/PCL, PS/PS, RELAY/RELAY, # HPGL/HPGL, HPGL2/HPGL2 lang_user=$PERSONALTY lang=$PERSONALTY # Determine which options have been invoked for i in $options do case "$i" in auto) lang="AUTO" lang_user="AUTO";; hpgl) lang="HPGL" lang_user="HPGL";; hpgl2) lang="HPGL2" lang_user="HPGL2";; postscript) lang="PS" lang_user="PS";; relay) for file in $files; do cat "$file" done exit 0;; esac done # ********** Start sending bytes out **************** echo "\033%-12345X@PJL" # Begin-of-Job echo "@PJL JOB NAME = \"Job:$reqid; User: $user\"" # Print the spooled files i=1 while [ $i -le $copies ] do for file in $files do if [ $lang_user = "AUTO" ] then if [ -x $HPNPS ] then # file does exist $HPNPS -q <$file > /dev/null pers=$? if [ $pers -eq 1 ] then #PS lang="PS" elif [ $pers -eq 0 ] then #not PS and no ESC, this is text and should print RELAY not HPGL lang="HPGL" elif [ $pers -eq 2 ] then #not PS and at least one ESC lang="HPGL" elif [ $pers -eq 3 ] then #UEL and PJL at beginning of file lang="RELAY" fi else # file not exist lang_user="HPGL" # no need to stay AUTO for next file lang="HPGL" fi # [Modified by Kumaresan to fix the problem of selecting HPGL in AUTO mode # for the 2500CP plotter which gives problem for HPGL (on 6th March '98). if [ $PRINTMODEL = "dsnj2500CP" -o $PRINTMODEL = "dsnj3500CP" ] then if [ $lang = "HPGL" ] then lang="HPGL2" fi fi # ] fi case "$lang" in HPGL) echo "\033%-12345X@PJL enter language=HPGL" echo "IN;\n" cat "$file" 2>&1 # straight to the printer echo "PG;\n" echo "\033%-12345X@PJL";; HPGL2) echo "\033%-12345X@PJL enter language=HPGL2" echo "IN;\n" cat "$file" 2>&1 # straight to the printer echo "PG;\n" echo "\033%-12345X@PJL";; PS) echo "\033%-12345X@PJL enter language=postscript" cat "$file" 2>&1 # straight to the printer echo "\033%-12345X@PJL";; RELAY) cat "$file" 2>&1 # straight to the printer echo "\033%-12345X@PJL";; esac done i=`expr $i + 1` done # end of job echo "\033%-12345X@PJL RESET" echo "@PJL EOJ NAME = \"Job: $reqid, User: $user\" " # end-of-job, echo "\033%-12345X@PJL" # 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 exit 0