1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
#!/bin/sh
#
# convert ps to the format required by the printer on this queue
#
# if the printer is a PostScript printer, just cat it through
# if the printer uses ghostscript, we'll run it now
# if the printer is neither, we die (with good message to someone)
#
#
# read in PostScript configuration settings
#
. ${SPOOLDIR}/postscript.cfg
#
# see if we should reverse order
#
# support will be added for this in the future
# psorder needed and is part of netatalk, which we dont currently ship
#
if [ "$PAPERSIZE" = "letter" ]; then
mpage_paper="Letter"
elif [ "$PAPERSIZE" = "a4" ]; then
mpage_paper="A4"
elif [ "$PAPERSIZE" = "legal" ]; then
mpage_paper="Legal"
else
mpage_paper="Letter"
fi
#
# weird case - some PS doesnt get handled by mpage well
# so we allow nup=1 to just cat PS to printer w/o mpage interferring
#
if [ "$NUP" = "1" ]; then
border="-o"
mpage_cmd="cat -"
else
border=""
mpage_cmd="mpage -b$mpage_paper $border -$NUP -m${RTLFTMAR}lr -m${TOPBOTMAR}tb"
fi
#
# if the driver is "POSTSCRIPT" it means the printer handles Postscript
# natively, no need to run gs.
# if the driver is "TEXT" then it means the printer cannot handle PS input
#
if [ "$GSDEVICE" = "POSTSCRIPT" ]; then
eval $mpage_cmd
elif [ "$GSDEVICE" = "TEXT" ]; then
echo "Error - ps-to-printer.fpi - this printer cannot print postscript"
echo " and ghostscript does not have support"
exit 1
else
# we're using ghostscript
# stc740p.upp 740*740 mine
# stc740pl.upp 360*360 mine
# stc740_m.upp 740*740 from the net
if [ "$GSDEVICE" = "uniprint" ]; then
if [ "$RESOLUTION" = "720x720" ]; then
configfile="stc740p.upp"
elif [ "$RESOLUTION" = "1440x720" ]; then
configfile="stc740ih.upp"
else
configfile="stc740pl.upp"
fi
eval "$mpage_cmd | gs -q @$configfile \
-sPAPERSIZE=$PAPERSIZE \
-sOutputFile=- \
$EXTRA_GS_OPTIONS \
-"
else
eval "$mpage_cmd | gs -q -sDEVICE=$GSDEVICE \
-r$RESOLUTION \
-sPAPERSIZE=$PAPERSIZE \
-dNOPAUSE \
-dSAFER \
-sOutputFile=- \
$COLOR \
$EXTRA_GS_OPTIONS \
-"
fi
fi
#
#
# see if we need to send a form feed to eject the page from printer
#
if [ "$PS_SEND_EOF" = "YES" ]; then
printf "\004"
fi
exit 0
|