You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.1 KiB

1 month ago
  1. #!/bin/sh
  2. # Convert PostScript to PDF without specifying CompatibilityLevel.
  3. # This definition is changed on install to match the
  4. # executable name set in the makefile
  5. GS_EXECUTABLE=gs
  6. gs="`dirname \"$0\"`/$GS_EXECUTABLE"
  7. if test ! -x "$gs"; then
  8. gs="$GS_EXECUTABLE"
  9. fi
  10. GS_EXECUTABLE="$gs"
  11. OPTIONS="-P- -dSAFER"
  12. while true
  13. do
  14. case "$1" in
  15. -?*) OPTIONS="$OPTIONS $1" ;;
  16. *) break ;;
  17. esac
  18. shift
  19. done
  20. if [ $# -lt 1 -o $# -gt 2 ]; then
  21. echo "Usage: `basename \"$0\"` [options...] (input.[e]ps|-) [output.pdf|-]" 1>&2
  22. exit 1
  23. fi
  24. infile="$1";
  25. if [ $# -eq 1 ]
  26. then
  27. case "${infile}" in
  28. -) outfile=- ;;
  29. *.eps) base=`basename "${infile}" .eps`; outfile="${base}.pdf" ;;
  30. *.ps) base=`basename "${infile}" .ps`; outfile="${base}.pdf" ;;
  31. *) base=`basename "${infile}"`; outfile="${base}.pdf" ;;
  32. esac
  33. else
  34. outfile="$2"
  35. fi
  36. # We have to include the options twice because -I only takes effect if it
  37. # appears before other options.
  38. exec "$GS_EXECUTABLE" $OPTIONS -q -P- -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sstdout=%stderr "-sOutputFile=$outfile" $OPTIONS "$infile"