v19i013: pclcomp - HP-PCL graphics compression filter for printers., Part01/02
Tony Parkhurst
tony at sdd.hp.com
Fri May 3 03:23:59 AEST 1991
Submitted-by: Tony Parkhurst <tony at sdd.hp.com>
Posting-number: Volume 19, Issue 13
Archive-name: pclcomp/part01
PCL graphics files, and outputs compressed PCL files which may be sent
directly to printers that support the compressions. A partial list of
printer support is included.
Why use pclcomp?
1) PCL files are much smaller (I routinely see compressions up
to 90%.
2) Graphics printing on a LaserJet (IIP or III) is faster.
If you have a LaserJet II that does not support compression, you can
still compress the files for storage, and decompress them while printing.
I wrote this program for testing. This is NOT an HP product. It will
NOT be supported by HP, but rather myself, in my spare time, if need be.
If you need real support for driver development, then call Hewlett-
Packard directly, preferably the ISV support group at the Boise Division
(I think).
You may use parts of this code within your drivers to support compression
if you wish.
I did what I think is a reasonable job to make the program work for
most possible PCL files. Please feel free to send comments, complaints
or suggestions to me at tony at sdd.hp.com. If you have a file that does
not survive the filter intact, please e-mail me the file and describe the
problem.
You will have to proved a getopt() function.
This filter runs under UNIX and MS-DOS and hopefully anything else that
supports ANSI-C.
Please direct all compliments and praise to: tony at sdd.hp.com
Tony Parkhurst
----
# This is a shell archive. Remove anything before this line,
#! /bin/sh
# This is a shell archive. Remove anything before this line, then feed it
# into a shell via "sh file" or similar. To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix at uunet.uu.net if you want that tool.
# Contents: pclcomp.1 pclcomp.man printer.note
# Wrapped by kent at sparky on Thu May 2 12:17:56 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
echo If this archive is complete, you will see the following message:
echo ' "shar: End of archive 1 (of 2)."'
if test -f 'pclcomp.1' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'pclcomp.1'\"
else
echo shar: Extracting \"'pclcomp.1'\" \(3532 characters\)
sed "s/^X//" >'pclcomp.1' <<'END_OF_FILE'
X.TH PCLCOMP 1
X.SH NAME
Xpclcomp \- Compress PCL graphics files.
X.SH SYNOPSIS
X.B pclcomp
X[
X.B "-0123drsvz"
X]
X[
X.B "-n"
X.I num
X]
X[
X.I inputfile
X[
X.I outputfile
X]]
X.br
X.SH DESCRIPTION
X.PP
X.B Pclcomp
Xcompresses (or decompresses) HP-PCL (Printer Control Language) graphics data.
XThe supported compression modes are 0 (uncompressed), 1, 2 and 3.
X.B Pclcomp
Xwill read files using any of the modes 0 through 3, and will output using the
Xmodes which will give the best compression. This compressed version of
Xthe file may be sent directly to a PCL compatible printer, thus reducing
XI/O bandwidth. Pictures may also be saved in compressed form, reducing
Xdisk usage.
XIn addition, PCL "imaging" files for the PaintJet XL are also supported.
X.PP
XThe options to
X.B pclcomp
Xcontrol the compression modes. By default,
X.B pclcomp
Xwill use all modes it knows about, but the user may restrict which output
Xmodes it uses by specifying them on the command line with the
X.B -0,
X.B -1,
X.B -2
Xand
X.B -3
Xoptions. To decompress a file, simply specify
X.B -0
Xas the only mode to use for output. Mode 0 (
X.B -0
X) should always be allowed since modes 1, 2 and 3 cannot be guaranteed to
Xbe better than mode 0 for all types of pictures.
X.PP
XThe
X.B -z
Xoption disables the zero "strip" feature. Since most printers do
Xzero "filling",
X.B pclcomp,
Xby default, "strips" the trailing zeros of each row (or plane) of data.
XSome printers or programs may require that zero "stripping" be disabled.
X.PP
XBy default,
X.B pclcomp
Xexpects the input raster width to be 2400 pixels (8" at 300 dpi), and if it is
Xdifferent (e.g. PaintJet), then the raster width should be specified by
Xthe Source Raster Width escape sequence
X.I <esc*r#S>.
XHowever, many applications do not set the width and assume a default, therefore,
Xthe user may use the
X.B -n
Xoption to
X.B pclcomp
Xto specify a new default raster width. For PaintJet (8" at 180 dpi), the
Xnumber should be 1440. If the PCL file contains the Source Raster Width
Xescape sequence, it will override this default. If
X.B pclcomp
Xthinks that more data is coming in than the specified width, it will
Xgenerate a warning, and continue processing (and perhaps truncating) data.
X.PP
XThe
X.B -r
Xoption causes
X.B pclcomp
Xto append a
Xreset sequence
X.I "(<esc>E)"
Xto the end of the job.
X.PP
XUse the
X.B "-d"
Xoption to
X.B pclcomp
Xif the output is to be sent to a DeskJet printer.
X.PP
XSome applications erroneously send
X.I "<esc>*rB"
Xand
X.I "<esc>*rA"
Xsequences between every row of graphics data. The
X.B -s
Xoption to
X.B pclcomp
Xwill "strip" all
X.I "<esc>*rB"
Xsequences, and all
X.I "<esc>*rA"
Xsequences after the first occurrence of this sequence.
XIn addition, text and control characters residing between
X.I "<esc>*rA"
Xand
X.I "<esc>*rB"
Xsequences will be discarded.
XWhile this will work
Xwell
Xfor many jobs, it may have problems on multi-page or complex jobs.
X.PP
XThe
X.B -v
Xoption simply gives statistics to
X.I stderr
Xabout which compression modes were used.
X.SH EXAMPLES
X.nf
XTo compress a PCL file for LaserJet III, use:
X pclcomp infile outfile
X
XTo compress a PCL file for the PaintJet (A size page at 180 dpi), use:
X pclcomp -01 -n 1440 infile outfile
X
XTo compress a PCL file for DeskJet, use:
X pclcomp -d012 infile outfile
X
XTo fully decompress a PCL file, use:
X pclcomp -0z < infile > outfile
X.fi
X.SH WARNINGS
X.PP
XThe
X.B -z
Xoption can cause the output to be larger than the input.
X.PP
XThe
X.B -s
Xoption is useful, but it can cause erroneous output.
X.SH AUTHOR
XTony Parkhurst, Hewlett-Packard, San Diego Division (tony at sdd.hp.com)
END_OF_FILE
if test 3532 -ne `wc -c <'pclcomp.1'`; then
echo shar: \"'pclcomp.1'\" unpacked with wrong size!
fi
# end of 'pclcomp.1'
fi
if test -f 'pclcomp.man' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'pclcomp.man'\"
else
echo shar: Extracting \"'pclcomp.man'\" \(3743 characters\)
sed "s/^X//" >'pclcomp.man' <<'END_OF_FILE'
X
X
X
X PCLCOMP(1) PCLCOMP(1)
X
X
X
X NAME
X pclcomp - Compress PCL graphics files.
X
X SYNOPSIS
X pclcomp [ -0123drsvz ] [ -n num ] [ inputfile [ outputfile ]]
X
X
X DESCRIPTION
X Pclcomp compresses (or decompresses) HP-PCL (Printer Control
X Language) graphics data. The supported compression modes
X are 0 (uncompressed), 1, 2 and 3. Pclcomp will read files
X using any of the modes 0 through 3, and will output using
X the modes which will give the best compression. This
X compressed version of the file may be sent directly to a PCL
X compatible printer, thus reducing I/O bandwidth. Pictures
X may also be saved in compressed form, reducing disk usage.
X In addition, PCL "imaging" files for the PaintJet XL are
X also supported.
X
X The options to pclcomp control the compression modes. By
X default, pclcomp will use all modes it knows about, but the
X user may restrict which output modes it uses by specifying
X them on the command line with the -0, -1, -2 and -3 options.
X To decompress a file, simply specify -0 as the only mode to
X use for output. Mode 0 ( -0 ) should always be allowed
X since modes 1, 2 and 3 cannot be guaranteed to be better
X than mode 0 for all types of pictures.
X
X The -z option disables the zero "strip" feature. Since most
X printers do zero "filling", pclcomp, by default, "strips"
X the trailing zeros of each row (or plane) of data. Some
X printers or programs may require that zero "stripping" be
X disabled.
X
X By default, pclcomp expects the input raster width to be
X 2400 pixels (8" at 300 dpi), and if it is different (e.g.
X PaintJet), then the raster width should be specified by the
X Source Raster Width escape sequence <esc*r#S>. However, many
X applications do not set the width and assume a default,
X therefore, the user may use the -n option to pclcomp to
X specify a new default raster width. For PaintJet (8" at 180
X dpi), the number should be 1440. If the PCL file contains
X the Source Raster Width escape sequence, it will override
X this default. If pclcomp thinks that more data is coming in
X than the specified width, it will generate a warning, and
X continue processing (and perhaps truncating) data.
X
X The -r option causes pclcomp to append a reset sequence
X (<esc>E) to the end of the job.
X
X Use the -d option to pclcomp if the output is to be sent to
X a DeskJet printer.
X
X
X
X - 1 - Formatted: April 30, 1991
X
X
X
X
X
X
X PCLCOMP(1) PCLCOMP(1)
X
X
X
X Some applications erroneously send <esc>*rB and <esc>*rA
X sequences between every row of graphics data. The -s option
X to pclcomp will "strip" all <esc>*rB sequences, and all
X <esc>*rA sequences after the first occurrence of this
X sequence. In addition, text and control characters residing
X between <esc>*rA and <esc>*rB sequences will be discarded.
X While this will work well for many jobs, it may have
X problems on multi-page or complex jobs.
X
X The -v option simply gives statistics to stderr about which
X compression modes were used.
X
X EXAMPLES
X To compress a PCL file for LaserJet III, use:
X pclcomp infile outfile
X
X To compress a PCL file for the PaintJet (A size page at 180 dpi), use:
X pclcomp -01 -n 1440 infile outfile
X
X To compress a PCL file for DeskJet, use:
X pclcomp -d012 infile outfile
X
X To fully decompress a PCL file, use:
X pclcomp -0z < infile > outfile
X
X WARNINGS
X The -z option can cause the output to be larger than the
X input.
X
X The -s option is useful, but it can cause erroneous output.
X
X AUTHOR
X Tony Parkhurst, Hewlett-Packard, San Diego Division
X (tony at sdd.hp.com)
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X - 2 - Formatted: April 30, 1991
X
X
X
END_OF_FILE
if test 3743 -ne `wc -c <'pclcomp.man'`; then
echo shar: \"'pclcomp.man'\" unpacked with wrong size!
fi
# end of 'pclcomp.man'
fi
if test -f 'printer.note' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'printer.note'\"
else
echo shar: Extracting \"'printer.note'\" \(350 characters\)
sed "s/^X//" >'printer.note' <<'END_OF_FILE'
X
X
XHere is a list of printers and the compression modes they support:
X
X
X
XPrinter Modes
X------- -----
X
XLaserJet 0
XLaserJet+ 0
XLaserJet 500 0
XLaserJet 2000 0
XLaserJet II 0
XLaserJet IIP 0 1 2
XLaserJet III 0 1 2 3
X
XDeskJet 0 1 2
XDeskJet+ 0 1 2
XDeskJet 500 0 1 2 3
X
XPaintJet 0 1
XPaintJet XL 0 1 2 3
X
X
XMode 0 is uncompressed graphics data.
END_OF_FILE
if test 350 -ne `wc -c <'printer.note'`; then
echo shar: \"'printer.note'\" unpacked with wrong size!
fi
# end of 'printer.note'
fi
echo shar: End of archive 1 \(of 2\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked both archives.
rm -f ark[1-9]isdone
else
echo You still must unpack the following archives:
echo " " ${MISSING}
fi
exit 0
exit 0 # Just in case...
--
Kent Landfield INTERNET: kent at sparky.IMD.Sterling.COM
Sterling Software, IMD UUCP: uunet!sparky!kent
Phone: (402) 291-8300 FAX: (402) 291-4362
Please send comp.sources.misc-related mail to kent at uunet.uu.net.
More information about the Comp.sources.misc
mailing list