home *** CD-ROM | disk | FTP | other *** search
/ tusportal.tus.k12.pa.us / tusportal.tus.k12.pa.us.tar / tusportal.tus.k12.pa.us / Wyse / latest-image.raw / 0.img / usr / lib / cups / filter / pstopdf < prev    next >
Text File  |  2010-02-10  |  1KB  |  66 lines

  1. #!/bin/sh
  2.  
  3. # $Id: pstopdf,v 1.2 2003/01/02 15:39:26 gurubert Exp $
  4. #
  5. # This is a Postscript to PDF filter for CUPS
  6. #
  7. # (C) 2003 Robert Sander <robert.sander@epigenomics.com>
  8. #
  9. # Released under GPL
  10. #
  11. # NO WARRANTY AT ALL
  12. #
  13.  
  14. echo "INFO: pstopdf argv[$#] = $@" >&2
  15.  
  16. if [ $# -lt 5 -o $# -gt 6 ]; then
  17.  
  18.   echo "ERROR: $0 job-id user title copies options [file]" >&2
  19.   exit 1
  20.  
  21. fi
  22.  
  23. jobid=$1
  24.  
  25. #infile=`mktemp /tmp/$jobid.pstopdf.in.XXXXXX`
  26. #if [ $? -ne 0 ]; then
  27. #  echo "ERROR: Error creating tmpfile $infile" >&2
  28. #  exit 1
  29. #fi
  30. #outfile=`mktemp /tmp/$jobid.pstopdf.out.XXXXXX`
  31. #if [ $? -ne 0 ]; then
  32. #  echo "ERROR: Error creating tmpfile $outfile" >&2
  33. #  exit 1
  34. #fi
  35.  
  36. if [ $# -eq 6 ]; then
  37.  
  38.   echo "INFO: file is $6" >&2
  39.   #cp $6 $infile
  40.   #rm -f $6
  41.  
  42.   infile="$6"
  43.   outfile="$infile".pdf
  44.  
  45.   /usr/bin/ps2pdf "$infile" "$outfile" 2>&1 >> /tmp/pstopdf.log
  46.  
  47. else
  48.  
  49.   outfile=`mktemp /tmp/$jobid.pstopdf.out.XXXXXX`
  50.   if [ $? -ne 0 ]; then
  51.     echo "ERROR: Error creating tmpfile $outfile" >&2
  52.     exit 1
  53.   fi
  54.  
  55.   /usr/bin/ps2pdf - "$outfile" 2>&1 >> /tmp/pstopdf.log
  56.  
  57. fi
  58.  
  59. cat $outfile
  60.  
  61. # cp "$infile" "$outfile" /tmp/cups/
  62.  
  63. rm -f "$outfile"
  64.  
  65. exit 0
  66.