home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume19 / pclcomp / part01 next >
Encoding:
Internet Message Format  |  1991-05-02  |  11.9 KB

  1. From: tony@sdd.hp.com (Tony Parkhurst)
  2. Newsgroups: comp.sources.misc
  3. Subject: v19i013:  pclcomp - HP-PCL graphics compression filter for printers., Part01/02
  4. Message-ID: <1991May2.172359.13758@sparky.IMD.Sterling.COM>
  5. Date: 2 May 91 17:23:59 GMT
  6. Approved: kent@sparky.imd.sterling.com
  7. X-Checksum-Snefru: 6cec3b39 c61383ec 0c3d29b5 a74c4d13
  8.  
  9. Submitted-by: Tony Parkhurst <tony@sdd.hp.com>
  10. Posting-number: Volume 19, Issue 13
  11. Archive-name: pclcomp/part01
  12.  
  13. PCL graphics files, and outputs compressed PCL files which may be sent
  14. directly to printers that support the compressions.  A partial list of
  15. printer support is included.
  16.  
  17.      Why use pclcomp?
  18.     1)  PCL files are much smaller (I routinely see compressions up
  19.         to 90%.
  20.     2)  Graphics printing on a LaserJet (IIP or III) is faster.
  21.  
  22.      If you have a LaserJet II that does not support compression, you can
  23. still compress the files for storage, and decompress them while printing.
  24.  
  25.      I wrote this program for testing.  This is NOT an HP product.  It will
  26. NOT be supported by HP, but rather myself, in my spare time, if need be.
  27.  
  28.      If you need real support for driver development, then call Hewlett-
  29. Packard directly, preferably the ISV support group at the Boise Division
  30. (I think).
  31.  
  32.      You may use parts of this code within your drivers to support compression
  33. if you wish.
  34.  
  35.      I did what I think is a reasonable job to make the program work for
  36. most possible PCL files.  Please feel free to send comments, complaints 
  37. or suggestions to me at tony@sdd.hp.com.  If you have a file that does
  38. not survive the filter intact, please e-mail me the file and describe the
  39. problem.
  40.  
  41.      You will have to proved a getopt() function.
  42. This filter runs under UNIX and MS-DOS and hopefully anything else that
  43. supports ANSI-C.
  44.  
  45.      Please direct all compliments and praise to:  tony@sdd.hp.com
  46.  
  47. Tony Parkhurst
  48. ----
  49. # This is a shell archive.  Remove anything before this line,
  50. #! /bin/sh
  51. # This is a shell archive.  Remove anything before this line, then feed it
  52. # into a shell via "sh file" or similar.  To overwrite existing files,
  53. # type "sh file -c".
  54. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  55. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  56. # Contents:  pclcomp.1 pclcomp.man printer.note
  57. # Wrapped by kent@sparky on Thu May  2 12:17:56 1991
  58. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  59. echo If this archive is complete, you will see the following message:
  60. echo '          "shar: End of archive 1 (of 2)."'
  61. if test -f 'pclcomp.1' -a "${1}" != "-c" ; then 
  62.   echo shar: Will not clobber existing file \"'pclcomp.1'\"
  63. else
  64.   echo shar: Extracting \"'pclcomp.1'\" \(3532 characters\)
  65.   sed "s/^X//" >'pclcomp.1' <<'END_OF_FILE'
  66. X.TH PCLCOMP 1
  67. X.SH NAME
  68. Xpclcomp \- Compress PCL graphics files.
  69. X.SH SYNOPSIS
  70. X.B pclcomp
  71. X[
  72. X.B "-0123drsvz"
  73. X]
  74. X[
  75. X.B "-n"
  76. X.I num
  77. X]
  78. X[
  79. X.I inputfile
  80. X[
  81. X.I outputfile
  82. X]]
  83. X.br
  84. X.SH DESCRIPTION
  85. X.PP
  86. X.B Pclcomp
  87. Xcompresses (or decompresses) HP-PCL (Printer Control Language) graphics data.
  88. XThe supported compression modes are 0 (uncompressed), 1, 2 and 3.
  89. X.B Pclcomp
  90. Xwill read files using any of the modes 0 through 3, and will output using the
  91. Xmodes which will give the best compression.  This compressed version of
  92. Xthe file may be sent directly to a PCL compatible printer, thus reducing
  93. XI/O bandwidth.  Pictures may also be saved in compressed form, reducing
  94. Xdisk usage.
  95. XIn addition, PCL "imaging" files for the PaintJet XL are also supported.
  96. X.PP
  97. XThe options to
  98. X.B pclcomp
  99. Xcontrol the compression modes.  By default,
  100. X.B pclcomp
  101. Xwill use all modes it knows about, but the user may restrict which output
  102. Xmodes it uses by specifying them on the command line with the
  103. X.B -0,
  104. X.B -1,
  105. X.B -2
  106. Xand
  107. X.B -3
  108. Xoptions.  To decompress a file, simply specify
  109. X.B -0
  110. Xas the only mode to use for output.  Mode 0 (
  111. X.B -0
  112. X) should always be allowed since modes 1, 2 and 3 cannot be guaranteed to
  113. Xbe better than mode 0 for all types of pictures.
  114. X.PP
  115. XThe
  116. X.B -z
  117. Xoption disables the zero "strip" feature.  Since most printers do 
  118. Xzero "filling",
  119. X.B pclcomp,
  120. Xby default, "strips" the trailing zeros of each row (or plane) of data.
  121. XSome printers or programs may require that zero "stripping" be disabled.
  122. X.PP
  123. XBy default,
  124. X.B pclcomp
  125. Xexpects the input raster width to be 2400 pixels (8" at 300 dpi), and if it is
  126. Xdifferent (e.g. PaintJet), then the raster width should be specified by
  127. Xthe Source Raster Width escape sequence
  128. X.I <esc*r#S>.
  129. XHowever, many applications do not set the width and assume a default, therefore,
  130. Xthe user may use the 
  131. X.B -n
  132. Xoption to
  133. X.B pclcomp
  134. Xto specify a new default raster width.  For PaintJet (8" at 180 dpi), the
  135. Xnumber should be 1440.  If the PCL file contains the Source Raster Width
  136. Xescape sequence, it will override this default.  If
  137. X.B pclcomp
  138. Xthinks that more data is coming in than the specified width, it will
  139. Xgenerate a warning, and continue processing (and perhaps truncating) data.
  140. X.PP
  141. XThe
  142. X.B -r
  143. Xoption causes
  144. X.B pclcomp
  145. Xto append a
  146. Xreset sequence
  147. X.I "(<esc>E)"
  148. Xto the end of the job.
  149. X.PP
  150. XUse the
  151. X.B "-d"
  152. Xoption to
  153. X.B pclcomp
  154. Xif the output is to be sent to a DeskJet printer.
  155. X.PP
  156. XSome applications erroneously send
  157. X.I "<esc>*rB"
  158. Xand
  159. X.I "<esc>*rA"
  160. Xsequences between every row of graphics data.  The 
  161. X.B -s
  162. Xoption to
  163. X.B pclcomp
  164. Xwill "strip" all 
  165. X.I "<esc>*rB"
  166. Xsequences, and all
  167. X.I "<esc>*rA"
  168. Xsequences after the first occurrence of this sequence.  
  169. XIn addition, text and control characters residing between
  170. X.I "<esc>*rA"
  171. Xand
  172. X.I "<esc>*rB"
  173. Xsequences will be discarded.
  174. XWhile this will work
  175. Xwell
  176. Xfor many jobs, it may have problems on multi-page or complex jobs.
  177. X.PP
  178. XThe
  179. X.B -v
  180. Xoption simply gives statistics to
  181. X.I stderr
  182. Xabout which compression modes were used.
  183. X.SH EXAMPLES
  184. X.nf
  185. XTo compress a PCL file for LaserJet III, use:
  186. X    pclcomp infile outfile
  187. X
  188. XTo compress a PCL file for the PaintJet (A size page at 180 dpi), use:
  189. X    pclcomp -01 -n 1440 infile outfile
  190. X
  191. XTo compress a PCL file for DeskJet, use:
  192. X    pclcomp -d012 infile outfile
  193. X
  194. XTo fully decompress a PCL file, use:
  195. X    pclcomp -0z < infile > outfile
  196. X.fi
  197. X.SH WARNINGS
  198. X.PP
  199. XThe 
  200. X.B -z
  201. Xoption can cause the output to be larger than the input.
  202. X.PP
  203. XThe 
  204. X.B -s
  205. Xoption is useful, but it can cause erroneous output.
  206. X.SH AUTHOR
  207. XTony Parkhurst, Hewlett-Packard, San Diego Division  (tony@sdd.hp.com)
  208. END_OF_FILE
  209.   if test 3532 -ne `wc -c <'pclcomp.1'`; then
  210.     echo shar: \"'pclcomp.1'\" unpacked with wrong size!
  211.   fi
  212.   # end of 'pclcomp.1'
  213. fi
  214. if test -f 'pclcomp.man' -a "${1}" != "-c" ; then 
  215.   echo shar: Will not clobber existing file \"'pclcomp.man'\"
  216. else
  217.   echo shar: Extracting \"'pclcomp.man'\" \(3743 characters\)
  218.   sed "s/^X//" >'pclcomp.man' <<'END_OF_FILE'
  219. X
  220. X
  221. X
  222. X     PCLCOMP(1)                         PCLCOMP(1)
  223. X
  224. X
  225. X
  226. X     NAME
  227. X      pclcomp - Compress PCL graphics files.
  228. X
  229. X     SYNOPSIS
  230. X      pclcomp [ -0123drsvz ] [ -n num ] [ inputfile [ outputfile ]]
  231. X
  232. X
  233. X     DESCRIPTION
  234. X      Pclcomp compresses (or decompresses) HP-PCL (Printer Control
  235. X      Language) graphics data.  The supported compression modes
  236. X      are 0 (uncompressed), 1, 2 and 3.  Pclcomp will read files
  237. X      using any of the modes 0 through 3, and will output using
  238. X      the modes which will give the best compression.  This
  239. X      compressed version of the file may be sent directly to a PCL
  240. X      compatible printer, thus reducing I/O bandwidth.  Pictures
  241. X      may also be saved in compressed form, reducing disk usage.
  242. X      In addition, PCL "imaging" files for the PaintJet XL are
  243. X      also supported.
  244. X
  245. X      The options to pclcomp control the compression modes.  By
  246. X      default, pclcomp will use all modes it knows about, but the
  247. X      user may restrict which output modes it uses by specifying
  248. X      them on the command line with the -0, -1, -2 and -3 options.
  249. X      To decompress a file, simply specify -0 as the only mode to
  250. X      use for output.  Mode 0 ( -0 ) should always be allowed
  251. X      since modes 1, 2 and 3 cannot be guaranteed to be better
  252. X      than mode 0 for all types of pictures.
  253. X
  254. X      The -z option disables the zero "strip" feature.  Since most
  255. X      printers do zero "filling", pclcomp, by default, "strips"
  256. X      the trailing zeros of each row (or plane) of data.  Some
  257. X      printers or programs may require that zero "stripping" be
  258. X      disabled.
  259. X
  260. X      By default, pclcomp expects the input raster width to be
  261. X      2400 pixels (8" at 300 dpi), and if it is different (e.g.
  262. X      PaintJet), then the raster width should be specified by the
  263. X      Source Raster Width escape sequence <esc*r#S>. However, many
  264. X      applications do not set the width and assume a default,
  265. X      therefore, the user may use the -n option to pclcomp to
  266. X      specify a new default raster width.  For PaintJet (8" at 180
  267. X      dpi), the number should be 1440.  If the PCL file contains
  268. X      the Source Raster Width escape sequence, it will override
  269. X      this default.  If pclcomp thinks that more data is coming in
  270. X      than the specified width, it will generate a warning, and
  271. X      continue processing (and perhaps truncating) data.
  272. X
  273. X      The -r option causes pclcomp to append a reset sequence
  274. X      (<esc>E) to the end of the job.
  275. X
  276. X      Use the -d option to pclcomp if the output is to be sent to
  277. X      a DeskJet printer.
  278. X
  279. X
  280. X
  281. X                   - 1 -    Formatted:    April 30, 1991
  282. X
  283. X
  284. X
  285. X
  286. X
  287. X
  288. X     PCLCOMP(1)                         PCLCOMP(1)
  289. X
  290. X
  291. X
  292. X      Some applications erroneously send <esc>*rB and <esc>*rA
  293. X      sequences between every row of graphics data.  The -s option
  294. X      to pclcomp will "strip" all <esc>*rB sequences, and all
  295. X      <esc>*rA sequences after the first occurrence of this
  296. X      sequence. In addition, text and control characters residing
  297. X      between <esc>*rA and <esc>*rB sequences will be discarded.
  298. X      While this will work well for many jobs, it may have
  299. X      problems on multi-page or complex jobs.
  300. X
  301. X      The -v option simply gives statistics to stderr about which
  302. X      compression modes were used.
  303. X
  304. X     EXAMPLES
  305. X      To compress a PCL file for LaserJet III, use:
  306. X           pclcomp infile outfile
  307. X
  308. X      To compress a PCL file for the PaintJet (A size page at 180 dpi), use:
  309. X           pclcomp -01 -n 1440 infile outfile
  310. X
  311. X      To compress a PCL file for DeskJet, use:
  312. X           pclcomp -d012 infile outfile
  313. X
  314. X      To fully decompress a PCL file, use:
  315. X           pclcomp -0z < infile > outfile
  316. X
  317. X     WARNINGS
  318. X      The -z option can cause the output to be larger than the
  319. X      input.
  320. X
  321. X      The -s option is useful, but it can cause erroneous output.
  322. X
  323. X     AUTHOR
  324. X      Tony Parkhurst, Hewlett-Packard, San Diego Division
  325. X      (tony@sdd.hp.com)
  326. X
  327. X
  328. X
  329. X
  330. X
  331. X
  332. X
  333. X
  334. X
  335. X
  336. X
  337. X
  338. X
  339. X
  340. X
  341. X
  342. X
  343. X
  344. X
  345. X
  346. X
  347. X                   - 2 -    Formatted:    April 30, 1991
  348. X
  349. X
  350. X
  351. END_OF_FILE
  352.   if test 3743 -ne `wc -c <'pclcomp.man'`; then
  353.     echo shar: \"'pclcomp.man'\" unpacked with wrong size!
  354.   fi
  355.   # end of 'pclcomp.man'
  356. fi
  357. if test -f 'printer.note' -a "${1}" != "-c" ; then 
  358.   echo shar: Will not clobber existing file \"'printer.note'\"
  359. else
  360.   echo shar: Extracting \"'printer.note'\" \(350 characters\)
  361.   sed "s/^X//" >'printer.note' <<'END_OF_FILE'
  362. X
  363. X
  364. XHere is a list of printers and the compression modes they support:
  365. X
  366. X
  367. X
  368. XPrinter            Modes
  369. X-------            -----
  370. X
  371. XLaserJet        0
  372. XLaserJet+        0
  373. XLaserJet 500        0
  374. XLaserJet 2000        0
  375. XLaserJet II        0
  376. XLaserJet IIP        0 1 2
  377. XLaserJet III        0 1 2 3
  378. X
  379. XDeskJet            0 1 2
  380. XDeskJet+        0 1 2
  381. XDeskJet 500        0 1 2 3
  382. X
  383. XPaintJet        0 1
  384. XPaintJet XL        0 1 2 3
  385. X
  386. X
  387. XMode 0 is uncompressed graphics data.
  388. END_OF_FILE
  389.   if test 350 -ne `wc -c <'printer.note'`; then
  390.     echo shar: \"'printer.note'\" unpacked with wrong size!
  391.   fi
  392.   # end of 'printer.note'
  393. fi
  394. echo shar: End of archive 1 \(of 2\).
  395. cp /dev/null ark1isdone
  396. MISSING=""
  397. for I in 1 2 ; do
  398.     if test ! -f ark${I}isdone ; then
  399.     MISSING="${MISSING} ${I}"
  400.     fi
  401. done
  402. if test "${MISSING}" = "" ; then
  403.     echo You have unpacked both archives.
  404.     rm -f ark[1-9]isdone
  405. else
  406.     echo You still must unpack the following archives:
  407.     echo "        " ${MISSING}
  408. fi
  409. exit 0
  410. exit 0 # Just in case...
  411. -- 
  412. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  413. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  414. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  415. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  416.