pdf2ps 844 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/sh
  2. # $Id: pdf2ps,v 1.7 2004/08/04 00:55:46 giles Exp $
  3. # Convert PDF to PostScript.
  4. # This definition is changed on install to match the
  5. # executable name set in the makefile
  6. GS_EXECUTABLE=gs
  7. OPTIONS=""
  8. while true
  9. do
  10. case "$1" in
  11. -?*) OPTIONS="$OPTIONS $1" ;;
  12. *) break ;;
  13. esac
  14. shift
  15. done
  16. if [ $# -eq 2 ]
  17. then
  18. outfile=$2
  19. elif [ $# -eq 1 ]
  20. then
  21. outfile=`basename "$1" \.pdf`.ps
  22. else
  23. echo "Usage: `basename $0` [-dASCII85EncodePages=false] [-dLanguageLevel=1|2|3] input.pdf [output.ps]" 1>&2
  24. exit 1
  25. fi
  26. # Doing an initial 'save' helps keep fonts from being flushed between pages.
  27. # We have to include the options twice because -I only takes effect if it
  28. # appears before other options.
  29. exec $GS_EXECUTABLE $OPTIONS -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pswrite "-sOutputFile=$outfile" $OPTIONS -c save pop -f "$1"