[bug-pcl] reducing the size Ghostpcl generated PDFs
Brian K. White
brian at aljex.com
Wed Sep 29 10:31:09 PDT 2004
Stefan Kemper wrote:
> Jon,
>
> You might want to try:
>
> gs -sDEVICE=pdfwrite -sOutputFile=/home/jon/smaller.pdf bigger.pdf
>
> looking at the gs/doc/Ps2pdf.htm there are distiller parameters that
> you can use to shrink the output pdf even more.
In that case, wouldn't it be better to have pcl6 output ps instead of pdf
and pipe it into gs ?
On my systems I have the following two pcl6 wrappers, both based on
pcl2pdfwr but I dispensed with the extra layer of having pcl2pdf run
pcl2pdfwr and just renamed pcl2pdfwr to pcl2pdf. Then copied that to pcl2ps
and edited appropriately.
I use pcl2ps mostly to pipe legacy apps hplaser output right into hylafax.
Slick!
Thank you Artifex!
I noticed along the way that pcl6 generates ps a lot faster than it
generates pdf.
Understandable and expected. I'm sure it has to generate ps every time and
the pdf is just more processing after that.
So, if it were me, I'd see if this doesn't run faster than creating a bad
pdf and the converting it to a better pdf:
pcl2ps invoice.pcl - |gs -sDEVICE=pdfwrite -sOutputFile=invoice.pdf -
If it works and produces better output and doesn't run too much slower than
the built-in pdfwriter, I suggest simply editing pcl2pdf.
Maybe that is the most sensible way to go for other reasons too. It seems a
waste to have to keep pcl6 up to date with all of ghostscript, and/or live
without things. Just junk all the 200 output drivers and focust on the
pcl-ps engine and let the external gs interpret the ps.
They really are two distinct jobs and better served by two seperate tools.
That should make your jobs easier maintaining the code and users get the
benefit of always using the latest gs (or ImageMagic or commercial ps
interpreter / pdf distiller or whatever they want) to turn the ps into
whatever. Maybe pcl6 shouldn't even have a -sDEVICE option?
pcl2ps
------------------------------------
#!/bin/sh
# Copied from pcl2pdfwr
# Convert PCL or PXL to PS
# Handy for feeding legacy application print data into hylafax.
# brian at aljex.com 2004-06-20
OPTIONS=
while true
do
case "$1" in
-?*) OPTIONS="$OPTIONS $1" ;;
*) break ;;
esac
shift
done
if [ $# -lt 1 -o $# -gt 2 ]; then
echo "Usage: `basename $0` [options...] (input.pcl|-) [output.ps|-]" 1>&2
exit 1
fi
infile=$1;
if [ $# -eq 1 ]
then
case "${infile}" in
-) outfile=- ;;
*.pcl) base=`basename ${infile} .pcl`; outfile=${base}.ps ;;
*.pxl) base=`basename ${infile} .pxl`; outfile=${base}.ps ;;
*) base=`basename ${infile}`; outfile=${base}.ps ;;
esac
else
outfile=$2
fi
# We have to include the options twice because -I only takes effect if it
# appears before other options.
exec pcl6 $OPTIONS -dNOPAUSE -dBATCH -sDEVICE=pswrite -sOutputFile=$outfile
$OPTIONS $infile
-------------------------------
my current pcl2pdf:
----------------------------------------
#!/bin/sh
# $RCSfile: pcl2pdfwr,v $ $Revision: 1.2 $
# Convert PCL or PXL to PDF without specifying CompatibilityLevel.
OPTIONS=
while true
do
case "$1" in
-?*) OPTIONS="$OPTIONS $1" ;;
*) break ;;
esac
shift
done
if [ $# -lt 1 -o $# -gt 2 ]; then
echo "Usage: `basename $0` [options...] (input.pcl|-) [output.pdf|-]" 1>&2
exit 1
fi
infile=$1;
if [ $# -eq 1 ]
then
case "${infile}" in
-) outfile=- ;;
*.pcl) base=`basename ${infile} .pcl`; outfile=${base}.pdf ;;
*.pxl) base=`basename ${infile} .pxl`; outfile=${base}.pdf ;;
*) base=`basename ${infile}`; outfile=${base}.pdf ;;
esac
else
outfile=$2
fi
# We have to include the options twice because -I only takes effect if it
# appears before other options.
exec pcl6
$OPTIONS -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=$outfile $OPTIONS
$infile
------------------------------------
proposed new pcl2pdf:
----------------------------------------
#!/bin/sh
# $RCSfile: pcl2pdfwr,v $ $Revision: 1.3 $
# Convert PCL or PXL to PDF without specifying CompatibilityLevel.
# only use pcl6 to render the pcl into ps
# pipe into gs to render the ps into pdf
OPTIONS=
while true
do
case "$1" in
-?*) OPTIONS="$OPTIONS $1" ;;
*) break ;;
esac
shift
done
if [ $# -lt 1 -o $# -gt 2 ]; then
echo "Usage: `basename $0` [options...] (input.pcl|-) [output.pdf|-]" 1>&2
exit 1
fi
infile=$1;
if [ $# -eq 1 ]
then
case "${infile}" in
-) outfile=- ;;
*.pcl) base=`basename ${infile} .pcl`; outfile=${base}.pdf ;;
*.pxl) base=`basename ${infile} .pxl`; outfile=${base}.pdf ;;
*) base=`basename ${infile}`; outfile=${base}.pdf ;;
esac
else
outfile=$2
fi
# We have to include the options twice because -I only takes effect if it
# appears before other options.
exec pcl6 $OPTIONS -dNOPAUSE -dBATCH -sDEVICE=pswrite -sOutputFile=-
$OPTIONS $infile
|gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=$outfile -
------------------------------------
--
Brian K. White -- brian at aljex.com -- http://www.aljex.com/bkw/
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro BBx Linux SCO Prosper/FACTS AutoCAD #callahans Satriani
More information about the bug-pcl
mailing list