home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / sgi / admin / 74 < prev    next >
Encoding:
Internet Message Format  |  1992-12-23  |  7.9 KB

  1. Path: sparky!uunet!mcsun!sunic!dkuug!uts!carlkb
  2. From: carlkb@uts.uni-c.dk (Klaus Bock)
  3. Newsgroups: comp.sys.sgi.admin
  4. Subject: Re: Problem with HP Laserjet III
  5. Message-ID: <1992Dec23.112128.16075@uts.uni-c.dk>
  6. Date: 23 Dec 92 11:21:28 GMT
  7. References: <1992Dec16.125135.14385@news.uni-stuttgart.de>
  8. Organization: UNI-C, Danish Computing Centre for Research and Education
  9. Lines: 368
  10.  
  11. In <1992Dec16.125135.14385@news.uni-stuttgart.de> erwin@cvtserv1.verfahrenstechnik.uni-stuttgart.de (Erwin Dieterich) writes:
  12.  
  13. >Hi net-people,
  14.  
  15. >I have a problem getting a HP Laserjet III working at my parallel
  16. >port running 4.0.1. Is there anyone out there who has written an
  17. >interface for our Printer? And is he willing to send it to me?
  18.  
  19. >Thanks for your help and merry Xmas!
  20.  
  21. You might try to use some of the following stuff:
  22.  
  23. ============= File: ihplj ===========================================
  24. #!/bin/sh
  25. #
  26. # lp interface for dumb line printers, serial or parallel
  27. #
  28. # Configurable paramters:
  29. #
  30. # BANNER    If non-zero, print a 132 column banner before each job
  31. # TRAILER    If non-zero, print a page separator with some form feeds at
  32. #        the end of the job.
  33. # RAW        If non-zero, don't do any post-processing like newline to
  34. #        newline/carriage return conversion.
  35. # STTYPARAMS    Add any non-default stty options here.
  36. # BAUDRATE    Sets the baud rate for tty printers
  37. #
  38. # The BANNER, TRAILER, and RAW flags may be turned on or off for a given
  39. # print job by using the "-o" option of the lp command.
  40. #
  41. # P10    Print in portrait mode with courier 10 pitch
  42. # P16    Print in portrait mode with courier 16.66 pitch
  43. # L10    Print in landscabe mode with courier 10 pitch
  44. # L16    Print in landscabe mode with courier 16.66 pitch
  45. # G    Print in graphics mode
  46. # GD    Print in graphics mode and delete the file afterwords.
  47. #
  48. # The PORT10, PORT1666, LAND10, LAND1666, GRAPHICS, GRAPHICSD flags 
  49. # may be turned on or off for a given
  50. # print job by using the "-o" option of the lp command.
  51. #
  52. # Info for administration tools:
  53. #
  54. # NAME=HP LaserJet series II
  55. #
  56. NAME="HP LaserJet series II"
  57. TYPE=Dumb
  58.  
  59. # Change the following to set up defaults
  60. STTYPARAMS=
  61. BAUDRATE=9600
  62. BANNER=0
  63. TRAILER=0
  64. RAW=0
  65. PORT10=1
  66. PORT1666=0
  67. LAND10=0
  68. LAND1666=0
  69. GRAPHICS=0
  70. GRAPHICSD=0
  71. CNT=0
  72. MCNT=0
  73.  
  74. #
  75. # Grab command line arguments
  76. printer=`basename $0`
  77. seqid=$1
  78. name=$2
  79. title="$3"
  80. copies=$4
  81. options="$5"
  82. shift; shift; shift; shift; shift
  83. files="$*"
  84.  
  85. #
  86. # Parse printer-specific options specified with lp(1) -o option
  87. #
  88. set -- "$options"
  89. while test $# -ne 0
  90. do
  91.     case $1 in
  92.         notrailer)
  93.             TRAILER=0
  94.             ;;
  95.         trailer)
  96.             TRAILER=1
  97.             ;;
  98.         banner)
  99.             BANNER=1
  100.             ;;
  101.         nobanner)
  102.             BANNER=0
  103.             ;;
  104.         raw)
  105.             # Don't do any post processing on this one.  This works
  106.             # well when sending bitmaps and things to an intelligent
  107.             # printer.
  108.             RAW=1
  109.             ;;
  110.         cooked)
  111.             RAW=0
  112.             ;;
  113.                 p10)
  114.             PORT10=1
  115.             PORT1666=0
  116.             LAND10=0
  117.             LAND1666=0
  118.             GRAPHICS=0
  119.             GRAPHICSD=0
  120.             ;;
  121.                 p16)
  122.             PORT10=0
  123.             PORT1666=1
  124.             LAND10=0
  125.             LAND1666=0
  126.             GRAPHICS=0
  127.             GRAPHICSD=0
  128.             ;;
  129.                 l10)
  130.             PORT10=0
  131.             PORT1666=0
  132.             LAND10=1
  133.             LAND1666=0
  134.             GRAPHICS=0
  135.             GRAPHICSD=0
  136.             ;;
  137.                 l16)
  138.             PORT10=0
  139.             PORT1666=0
  140.             LAND10=0
  141.             LAND1666=1
  142.             GRAPHICS=0
  143.             GRAPHICSD=0
  144.             ;;
  145.                 g)
  146.             PORT10=0
  147.             PORT1666=0
  148.             LAND10=0
  149.             LAND1666=0
  150.             GRAPHICS=1
  151.             GRAPHICSD=0
  152.             RAW=1
  153.             ;;
  154.                 gd)
  155.             PORT10=0
  156.             PORT1666=0
  157.             LAND10=0
  158.             LAND1666=0
  159.             GRAPHICS=0
  160.             GRAPHICSD=1
  161.             RAW=1
  162.             ;;
  163.                 cnt)
  164.             PORT10=0
  165.             PORT1666=0
  166.             LAND10=0
  167.             LAND1666=0
  168.             GRAPHICS=1
  169.             GRAPHICSD=0
  170.             RAW=1
  171.             CNT=1
  172.             ;;
  173.                 mcnt)
  174.             PORT10=0
  175.             PORT1666=0
  176.             LAND10=0
  177.             LAND1666=0
  178.             GRAPHICS=1
  179.             GRAPHICSD=0
  180.             RAW=1
  181.             MCNT=1
  182.             ;;
  183.         *)
  184.             # Save any extra options and pass on to filter.
  185.             if [ -n "$1" ]
  186.             then
  187.                 opts="$opts $1"
  188.             fi
  189.             ;;
  190.     esac
  191.     shift
  192. done
  193.  
  194. #
  195. # Initialize port parameters
  196. #
  197. if [ -t 1 ]
  198. then
  199.     stty sane $BAUDRATE <&1
  200.     if [ "$STTYPARAMS" != "" ]
  201.     then
  202.         stty $STTYPARAMS <&1
  203.     fi
  204.     if [ $RAW != 0 ]
  205.     then
  206.         stty -opost <&1
  207.     fi
  208.     filter="cat $opts"
  209. else
  210.     if [ $RAW != 0 ]
  211.     then
  212.         filter="cat $opts"
  213.     else
  214.         # The plp filter supports the sane, onlcr, opost, and tab3
  215.         # stty options.
  216.         filter="/usr/lib/plp sane $STTYPARAMS $opts"
  217.     fi
  218. fi
  219.  
  220. (
  221. # Change this for prettier banners or different number of columns
  222. x="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  223. if [ $BANNER != 0 ]
  224. then
  225.     echo "$x\n$x\n$x\n$x\n"
  226.     banner "$name"
  227.     echo "\n"
  228.     user=`grep "^$name:" /etc/passwd | line | cut -d: -f5`
  229.     if [ "$user" = "" ]
  230.     then
  231.         user=`(ypmatch $name passwd | line | cut -d: -f5) 2> /dev/null`
  232.     fi
  233.     if [ -n "$user" ]
  234.     then
  235.         echo "User: $user\n"
  236.     else
  237.         echo "\n"
  238.     fi
  239.     echo "Request id: $seqid    Printer: `basename $0`\n"
  240.     date
  241.     echo "\n"
  242.     if [ -n "$title" ]
  243.     then
  244.         banner $title
  245.     fi
  246.     echo "\014\c"
  247. fi
  248.  
  249. # Now setup the printer for the selected printing type
  250.  
  251. if [ $PORT10 != 0 ]
  252. then
  253.     echo "\033E\033&l0O\c"
  254. fi
  255.  
  256. if [ $PORT1666 != 0 ]
  257. then
  258.     echo "\033E\033&l0O\033&k2S\c"
  259. fi
  260.  
  261. if [ $LAND10 != 0 ]
  262. then
  263.     echo "\033E\033&l1O\c"
  264. fi
  265.  
  266. if [ $LAND1666 != 0 ]
  267. then
  268.     echo "\033E\033&l1O\033&k2S\c"
  269. fi
  270.  
  271. if [ $GRAPHICS != 0 ]
  272. then
  273.     echo "\033E\033&l0O\033(11U\033(sp10h12vsb3T\c"
  274. fi
  275.  
  276. if [ $GRAPHICSD != 0 ]
  277. then
  278.     echo "\033E\033&l0O\033(11U\033(sp10h12vsb3T\c"
  279. fi
  280.  
  281. i=1
  282. while [ $i -le $copies ]
  283. do
  284.     for file in $files
  285.     do
  286.         if [ $CNT != 0 ]
  287.         then
  288.             /sgi320/carlsberg/Inmrprog/cnt < $file 2>&1
  289.         else
  290.             if [ $MCNT != 0 ]
  291.             then
  292.                 /sgi320/carlsberg/Inmrprog/IOmcnt < $file 2>&1
  293.             else
  294.                 cat "$file" 2>&1
  295.             fi
  296.         fi
  297.         if [ $RAW = 0 ]
  298.         then
  299.             echo "\033E\c"
  300.         fi
  301.  
  302.         if [ $GRAPHICS != 0 ]
  303.         then
  304.             echo "\033E\c"
  305.         fi
  306.  
  307.         if [ $GRAPHICSD != 0 ]
  308.         then
  309.             echo "\033E\c"
  310.             rm $file
  311.         fi
  312.     done
  313.     i=`expr $i + 1`
  314. done
  315.  
  316. #
  317. # Print a couple rows of XXX followed by some newlines
  318. #
  319. if [ $TRAILER != 0 ]
  320. then
  321. echo "$x\n$x\n$x\n$x\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
  322. echo "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n$x\n$x\n$x\n$x"
  323. echo "$x\n$x\n$x\n$x\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
  324. echo "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
  325. echo "$x\n$x\n$x\n$x\n$x\n$x\n$x\n$x\n"
  326. fi
  327. ) | $filter
  328.  
  329. exit 0
  330. ============= End of file ===========================================
  331.  
  332. Save the portion between the ==== lines as ihplj, and install the
  333. printer (assuming you are using Sys V printer spooler!) by:
  334.  
  335.  
  336. /usr/lib/lpshut
  337. /usr/lib/lpadmin -pihplj -v/dev/plp -chplaser -iihplj
  338. /usr/lib/lpadmin -dihplj
  339. /usr/lib/accept ihplj
  340. /usr/lib/accept hplaser
  341. /usr/lib/lpsched
  342. enable ihplj
  343.  
  344. Some of the "cnt" stuff you can't use, but this is just an example of
  345. how we use the printer to print out large graphics files; instead of filling
  346. the disks with 500 graphics print jobs (each might be 1Mb), we simply call
  347. the program generating the graphics in the spooler script file, and then
  348. the output will be passed directly to the printer. It is then just necessary
  349. to submit the input to the graphics program to the queue...
  350.  
  351. To use this printer:
  352.  
  353. lp -dihplj -op10 file        !Print out file in 10 pitch portrait
  354. lp -dihplj -ol10 file        !Print out file in 10 pitch landscape
  355. lp -dihplj -op16 file        !Print out file in 16.67 pitch portrait
  356. lp -dihplj -ol16 file        !Print out file in 16.67 pitch landscape
  357. lp -dihplj -og file        !Print out graphics file
  358.  
  359. You could also implement printing in 12 pitch on the LaserJet III printer -
  360. this was originally written for the LaserJet II.
  361.  
  362. If you want to print out PostScript, get the Ghostscript package - you
  363. can simply set it up so that the queue script file calls the gs program and
  364. sends the output directly to the printer. If you think that the fonts in
  365. the GhostScript package look awful - don't panic - all the fonts you
  366. need (Courier, Helvetica, Times-Roman) already exist on the SGI machines in
  367. the directory /usr/lib/DPS/outline/base. Of course they cannot send out
  368. these fonts with the GhostScript package, as they are copyrighted by
  369. Adobe.
  370.  
  371. Good luck, merry Xmas&happy New Year from:
  372.  
  373. Mogens Kjaer
  374. Carlsberg Laboratory, Dept. of Chemistry
  375. Gamle Carlsberg Vej 10
  376. DK-2500 Valby
  377. Denmark
  378. carlkb@uts.uni-c.dk
  379.