home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / bin / ps2pdfwr < prev    next >
Encoding:
Text File  |  2005-11-16  |  952 b   |  41 lines

  1. #!/bin/sh
  2. # $Id: ps2pdfwr,v 1.9 2002/02/21 21:49:28 giles Exp $
  3. # Convert PostScript to PDF without specifying CompatibilityLevel.
  4. gs="`dirname $0`/gs"
  5. if test ! -x "$gs"; then
  6.     gs=gs
  7. fi
  8.  
  9. OPTIONS="-dSAFER"
  10. while true
  11. do
  12.     case "$1" in
  13.     -?*) OPTIONS="$OPTIONS $1" ;;
  14.     *)  break ;;
  15.     esac
  16.     shift
  17. done
  18.  
  19. if [ $# -lt 1 -o $# -gt 2 ]; then
  20.     echo "Usage: `basename $0` [options...] (input.[e]ps|-) [output.pdf|-]" 1>&2
  21.     exit 1
  22. fi
  23.  
  24. infile="$1";
  25.  
  26. if [ $# -eq 1 ]
  27. then
  28.     case "${infile}" in
  29.       -)        outfile=- ;;
  30.       *.eps)    base=`basename "${infile}" .eps`; outfile="${base}.pdf" ;;
  31.       *.ps)        base=`basename "${infile}" .ps`; outfile="${base}.pdf" ;;
  32.       *)        base=`basename "${infile}"`; outfile="${base}.pdf" ;;
  33.     esac
  34. else
  35.     outfile="$2"
  36. fi
  37.  
  38. # We have to include the options twice because -I only takes effect if it
  39. # appears before other options.
  40. exec "$gs" $OPTIONS -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite "-sOutputFile=$outfile" $OPTIONS -c .setpdfwrite -f "$infile"
  41.