home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / hp / 12791 < prev    next >
Encoding:
Internet Message Format  |  1992-11-11  |  7.4 KB

  1. Path: sparky!uunet!ogicse!flop.ENGR.ORST.EDU!news.orst.edu!usenet
  2. From: larsen@OES.ORST.EDU (Scott Larsen)
  3. Newsgroups: comp.sys.hp
  4. Subject: Re: Printing PCL Files and awesome ljet3si interface script
  5. Summary: grow your own!
  6. Message-ID: <BxK5vG.7xx@news.orst.edu>
  7. Date: 11 Nov 92 15:33:09 GMT
  8. Article-I.D.: news.BxK5vG.7xx
  9. References: <7SS8MBG@math.fu-berlin.de>
  10. Sender: usenet@news.orst.edu
  11. Organization: Oregon Extension Service, Oregon State University, Corvallis, Or.
  12. Lines: 227
  13. Nntp-Posting-Host: oes.orst.edu
  14.  
  15. In article <7SS8MBG@math.fu-berlin.de> chatzi@metw3.met.fu-berlin.de (Andreas Chatziantoniou) writes:
  16. >I need some informations how to print PCL-files on a HP LaserJet 3 si which is
  17. >connected to an HP 9000/835 with HP-UX 8.0 .
  18. >The printer is installed with the PCL4 modelfile. I tried to print the file
  19. >using the raw Option ( lp -dlaser3si -oraw filename.pcl) which produced one
  20. >page with 1/2 inch of the picture I want to print and a lot of blank pages
  21. >afterwards. The PCL-file was produced from a PostScript Picture which was
  22. >converted to HP-PCL using GhostScript.
  23. >It is possible to print the PostScript picture on this printer but it takes 
  24. >about 20 minutes. As these pictures (satelite pictures) should be available 
  25. >as soon as possible, 20 minutes are just to long. If I print this PCL-picture 
  26. >from a PC it works just fine and takes about 1 1/2 minutes. 
  27. >
  28. >Any hint would be appreciated.
  29. >Thank you in advance.
  30. >Andreas
  31.  
  32. Well, I looked over _ALL_ the HP supplied model files and decided that all
  33. of them sucked. :)  Seriously, none could do what we wanted in relation to
  34. PCL graphics, HPGL2 graphics, postscript, duplex printing, and job seperation,
  35. so I wrote one myself for our Laserjet III si.
  36.  
  37. Please note that this interface model will handle si's with the Postscript
  38. ROMs, switching it from PCL to Postscript and back as needed.  Also, it takes
  39. advantage of the duplex printing hardware, if installed.
  40.  
  41. We also have a script referenced by the variable $mdchpglpenfix, which 
  42. makes HPGL lines thinner and more readable when plotting large drawings
  43. to a small paper size (8.5x11).
  44.  
  45. Send along vie email or News any questions, comments, or desires to see any 
  46. of the other interfaces we've developed (we have quite a few PCL/Postscript 
  47. printers that we have configured in a similar fashion).
  48.  
  49.  
  50. Scott Larsen
  51. larsen@oes.orst.edu                      UUCP: hplabs!hp-pcd!orstcs!larsen
  52. --------------------------------------------------------------------------
  53. "I assumed you needed help.  I see I am in error."
  54.         - Spock
  55.  
  56.  
  57.  
  58.  
  59. #! /bin/sh
  60. #
  61. # lp interface for HP LaserJet III SI Postscript/HPGL2/PCL5 printer
  62. #
  63. # Version:    2.0
  64. # Modified:    92/06/16 -- slarsen
  65. #
  66. #
  67. # The postscript and HPGL2 plot file detection method uses the "file" 
  68. # command, and relies heavily on a modifed /etc/magic file.  These lines
  69. # must be present in the /etc/magic file for this script to work properly:
  70. #
  71. #    0    string    %!PS-Adobe-    postscript file
  72. #    0    string    %!        postscript file
  73. #    0    string    E&l3O%-1B    MDC LJIII HPGL2 file
  74. #
  75. #
  76. # This script also uses a HPGL pen fix filter to patch up MDC HPGL plots.
  77. # This is defined as variable $mdchpglpenfix below...
  78. #
  79. #                  ************  NOTE  **********
  80. #                  ************  NOTE  **********
  81. #
  82. # We are assuming that all non-postscript or non-HPGL print jobs
  83. # need a line termination setting (old -ocrlf option).  We hope this
  84. # assumption doesn't fail with WordPerfect and 123.  They should send
  85. # reset commands, so we should be ok.
  86.  
  87.  
  88. #=======================================================================#
  89. # OPTIONS RECOGNIZED: ( all may be preceded by a "-" )            #
  90. #    ( Starred (*) items are defaults )                                 #
  91. #                                                                       #
  92. #        pcl                    force PCL mode on.  All data coming in  #
  93. #                               is taken as PCL data                    #
  94. #        duplex                 print 2 sides per page                  #
  95. #-----------------------------------------------------------------------#
  96. #                                                                       #
  97. #           These options apply only when using duplex printing         #
  98. #                                                                       #
  99. #                                                                       #
  100. #        shortbind              short edge binding.  (clipboard binding)#
  101. #                               also landscape quick reference guides.  #
  102. #      * longbind               long edge binding.  (book binding)      #
  103. #=======================================================================#
  104.  
  105.  
  106. log=/usr/spool/lp/log
  107. mdchpglpenfix=/usr/local/lib/printers/filters/mdc_hpgl_pwfix
  108.  
  109. echo "$*" >>$log
  110. echo "\tstart: `date`" >>$log
  111. exec 2>>$log                # catch errors, since printer won't print them
  112.  
  113. # Save all arguements...
  114. printer=`basename $0`
  115. reqid=$1
  116. user=$2
  117. title=$3
  118. copies=$4
  119.  
  120. # Set up interface
  121.  
  122. if [ -t 1 ]
  123. then
  124.     stty raw 9600 -parenb cs8 ixon -istrip clocal <&1 2>/dev/null
  125. else
  126.     slp -r 2>/dev/null
  127. fi
  128.  
  129.  
  130. # Handle disable and cancel traps.
  131.  
  132. trap "echo 'Terminated: $reqid' >> $log; trap 15; kill -15 0; exit 0" 15
  133.  
  134.  
  135. # Initialize the option variables...
  136.  
  137. pcl="no"
  138. duplex="no"
  139. pcltumble="1"
  140. postscripttumble="false"
  141.  
  142.  
  143. # Find out what options were used 
  144.  
  145. for i in $5
  146. do
  147.     case "$i" in
  148.     -pcl|pcl)            # Force PCL mode
  149.             pcl="yes";;
  150.     -duplex|duplex)            # Print two sides
  151.         duplex="yes";;
  152.     -shortbind|shortbind)        # Bind on short edge
  153.         pcltumble="2"
  154.         postscripttumble="true";;
  155.     -longbind|longbind)        # Bind on long edge
  156.         pcltumble="1"
  157.         postscripttumble="false";;
  158.     esac
  159. done
  160.  
  161.  
  162. # The remaining arguments are files
  163.  
  164. shift;shift;shift;shift;shift
  165. files="$*"
  166.  
  167.  
  168. # Print the spooled files
  169.  
  170. i=1
  171. while [ $i -le $copies ]
  172. do
  173.     for file in $files
  174.     do
  175.     ftype=`/usr/bin/file $file`
  176.     echo $ftype | grep postscript > /dev/null
  177.     ft=$?
  178.     if [ $ft = 0 -a "$pcl" = "no" ]    # It's a postscript file
  179.     then
  180.                         # Tell printer to switch from
  181.                         # PCL5 to postscript
  182.         echo "\tprinting postscript file" >>$log
  183.         echo "\033%-12345X@PJL ENTER LANGUAGE = POSTSCRIPT"
  184.  
  185.         if [ $duplex = "yes" ]        # Print both sides
  186.         then
  187.         echo "statusdict begin true setduplexmode end"
  188.         echo "statusdict begin $postscripttumble settumble end"
  189.         fi
  190.  
  191.         cat "$file"                # send the file to the printer
  192.         echo "\004\c"             # send Postscript EOJ
  193.  
  194.                         # Tell printer to switch back
  195.                         # into LJIII mode.
  196.         echo "\033%-12345X@PJL ENTER LANGUAGE = PCL"
  197.  
  198.     else                    # It's a LJIII file
  199.  
  200.                         # Force PCL5 mode ON and
  201.                         # toggle job offset
  202.         echo "\033%-12345X@PJL ENTER LANGUAGE = PCL"
  203.         echo "\033&l1T\c"
  204.  
  205.         if [ $duplex = "yes" ]        # Print both sides
  206.         then
  207.         echo "\033&l$pcltumble\c"    # set up the binding edge
  208.         echo "S\c"            # UGLY!
  209.         fi
  210.  
  211.         echo $ftype | grep 'MDC LJIII HPGL2 file' > /dev/null
  212.         ft2=$?
  213.         if [ $ft2 = 0 -a "$pcl" = "no" ]    # It's a MDC HPGL file
  214.         then
  215.         echo "\tprinting mdc plot file" >>$log
  216.                         # adjust the pen widths
  217.         cat "$file" | $mdchpglpenfix
  218.         else
  219.         echo "\tprinting regular file" >>$log
  220.         echo "\033&k2G\c"        # map LF -> CRLF
  221.         cat "$file"            # Just send the file...
  222.         fi
  223.     fi
  224.  
  225.     echo "\033E\c"                # PCL Reset.  This has the
  226.                         # added bonus of flushing jobs
  227.                         # that do not have a form feed.
  228.  
  229.     done
  230.     i=`expr $i + 1`
  231. done
  232.  
  233. echo "\tdone:  `date`" >>$log
  234.  
  235. # Insure all buffers are flushed to printer
  236. if [ -t 1 ]
  237. then
  238.     stty raw 9600 -parenb cs8 ixon -istrip clocal <&1 2>/dev/null
  239. fi
  240.  
  241. exit 0
  242.