home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
-
- # $Id: pstopdf,v 1.3 2003/02/15 15:21:00 gurubert Exp $
- #
- # This is a Postscript to PDF filter for CUPS
- #
- # (C) 2003 Robert Sander <robert.sander@epigenomics.com>
- #
- # Released under GPL
- #
- # NO WARRANTY AT ALL
- #
-
- PSTOPDF=/usr/bin/ps2pdf13
- OPTIONS="-r150 -dAutoRotatePages=/None -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dNOPLATFONTS"
-
- echo "INFO: pstopdf argv[$#] = $@" >&2
-
- if [ $# -lt 5 -o $# -gt 6 ]; then
-
- echo "ERROR: $0 job-id user title copies options [file]" >&2
- exit 1
-
- fi
-
- jobid=$1
-
- #infile=`mktemp /tmp/$jobid.pstopdf.in.XXXXXX`
- #if [ $? -ne 0 ]; then
- # echo "ERROR: Error creating tmpfile $infile" >&2
- # exit 1
- #fi
- #outfile=`mktemp /tmp/$jobid.pstopdf.out.XXXXXX`
- #if [ $? -ne 0 ]; then
- # echo "ERROR: Error creating tmpfile $outfile" >&2
- # exit 1
- #fi
-
- if [ $# -eq 6 ]; then
-
- echo "INFO: file is $6" >&2
- #cp $6 $infile
- #rm -f $6
-
- infile="$6"
- outfile="$infile".pdf
-
- $PSTOPDF $OPTIONS "$infile" "$outfile" 2>&1 >> /tmp/pstopdf.log
-
- else
-
- outfile=`mktemp /tmp/$jobid.pstopdf.out.XXXXXX`
- if [ $? -ne 0 ]; then
- echo "ERROR: Error creating tmpfile $outfile" >&2
- exit 1
- fi
-
- $PSTOPDF $OPTIONS - "$outfile" 2>&1 >> /tmp/pstopdf.log
-
- fi
-
- cat $outfile
-
- # cp "$infile" "$outfile" /tmp/cups/
-
- rm -f "$outfile"
-
- exit 0
-