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