Hey everyone,
Just to save anyone else the time should they need it, we've written up a
print script for sgd. Since the sgd pdf printing stuff requires postscript
input, we had to write up a converter script for our users. This script is
pretty simple and if copied into a users PATH can accept a file or std in for:
jpg, tiff, png, pdf, ps, and acsii, and sends it to the unix pdf "printer".
Hope someone finds it helpful.
Christian McHugh
Northern Arizona University
#!/bin/sh
if [ ! "$TTA_USERNAME" ]; then
echo "Not running through sgd. Exiting..."
exit 2
fi
myprint()
{
LPDEST=tta_printer
PRINTER=tta_printer
export PRINTER LPDEST
/opt/tarantella/bin/lpr -P "Print to Local PDF File" /tmp/stuff.ps.$$
rm /tmp/stuff.ps.$$
exit 0
}
if [ "$*" = "" ]; then
cat - > /tmp/incoming.$$
if [ ! -s /tmp/incoming.$$ ]; then
echo no input
rm /tmp/incoming.$$
exit 1
fi
elif [ ! -f "$*" ]; then
echo no such file
exit 1
else
#file arg given and it exists
cp "$*" /tmp/incoming.$$
fi
filetype=`file /tmp/incoming.$$ | awk '{print $2}'`
echo "$filetype"
case "$filetype" in
JPEG)
jpegtopnm 2>/dev/null /tmp/incoming.$$ | pnmtops 2>/dev/null >
/tmp/stuff.ps.$$
;;
TIFF)
tiff2ps -O /tmp/stuff.ps.$$ /tmp/incoming.$$
;;
PNG)
pngtopnm /tmp/incoming.$$ | pnmtops > /tmp/stuff.ps.$$
;;
Adobe)
pdf2ps /tmp/incoming.$$ /tmp/stuff.ps.$$
;;
PostScript)
cp /tmp/incoming.$$ /tmp/stuff.ps.$$
;;
ascii)
a2ps -q -o /tmp/stuff.ps.$$ /tmp/incoming.$$
;;
*)
echo "Error not recognized file type"
exit 1
;;
esac
rm /tmp/incoming.$$
myprint
echo "should not get here"
exit 3
_______________________________________________
SGD-Users mailing list
[email protected]
http://www.filibeto.org/mailman/listinfo/sgd-users