Debian Codegraph @

lib/pdf2ps

raw
1 #!/bin/sh
2 # Convert PDF to PostScript.
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=""
14 while true
15 do
16 case "$1" in
17 -?*) OPTIONS="$OPTIONS $1" ;;
18 *) break ;;
19 esac
20 shift
21 done
22
23 if [ $# -eq 2 ]
24 then
25 outfile=$2
26 elif [ $# -eq 1 ]
27 then
28 outfile=`basename "$1" \.pdf`.ps
29 else
30 echo "Usage: `basename \"$0\"` [-dASCII85EncodePages=false] [-dLanguageLevel=1|2|3] input.pdf [output.ps]" 1>&2
31 exit 1
32 fi
33
34 # Doing an initial 'save' helps keep fonts from being flushed between pages.
35 # We have to include the options twice because -I only takes effect if it
36 # appears before other options.
37 exec "$GS_EXECUTABLE" $OPTIONS -q -dNOPAUSE -dBATCH -P- -dSAFER -sDEVICE=ps2write "-sOutputFile=$outfile" $OPTIONS -c save pop -f "$1"