home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / doc / cupsys / examples / pstopdf < prev    next >
Encoding:
Text File  |  2006-08-30  |  1.3 KB  |  69 lines

  1. #!/bin/sh
  2.  
  3. # $Id: pstopdf,v 1.3 2003/02/15 15:21:00 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. PSTOPDF=/usr/bin/ps2pdf13
  15. OPTIONS="-r150 -dAutoRotatePages=/None -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dNOPLATFONTS"
  16.  
  17. echo "INFO: pstopdf argv[$#] = $@" >&2
  18.  
  19. if [ $# -lt 5 -o $# -gt 6 ]; then
  20.  
  21.   echo "ERROR: $0 job-id user title copies options [file]" >&2
  22.   exit 1
  23.  
  24. fi
  25.  
  26. jobid=$1
  27.  
  28. #infile=`mktemp /tmp/$jobid.pstopdf.in.XXXXXX`
  29. #if [ $? -ne 0 ]; then
  30. #  echo "ERROR: Error creating tmpfile $infile" >&2
  31. #  exit 1
  32. #fi
  33. #outfile=`mktemp /tmp/$jobid.pstopdf.out.XXXXXX`
  34. #if [ $? -ne 0 ]; then
  35. #  echo "ERROR: Error creating tmpfile $outfile" >&2
  36. #  exit 1
  37. #fi
  38.  
  39. if [ $# -eq 6 ]; then
  40.  
  41.   echo "INFO: file is $6" >&2
  42.   #cp $6 $infile
  43.   #rm -f $6
  44.  
  45.   infile="$6"
  46.   outfile="$infile".pdf
  47.  
  48.   $PSTOPDF $OPTIONS "$infile" "$outfile" 2>&1 >> /tmp/pstopdf.log
  49.  
  50. else
  51.  
  52.   outfile=`mktemp /tmp/$jobid.pstopdf.out.XXXXXX`
  53.   if [ $? -ne 0 ]; then
  54.     echo "ERROR: Error creating tmpfile $outfile" >&2
  55.     exit 1
  56.   fi
  57.  
  58.   $PSTOPDF $OPTIONS - "$outfile" 2>&1 >> /tmp/pstopdf.log
  59.  
  60. fi
  61.  
  62. cat $outfile
  63.  
  64. # cp "$infile" "$outfile" /tmp/cups/
  65.  
  66. rm -f "$outfile"
  67.  
  68. exit 0
  69.