| 1 | #!/bin/sh |
| 2 | # "Distill" PostScript with the Ghostscript 'ps2write' device |
| 3 | # this generates a PDF-style stream with an attached |
| 4 | # PostScript program to interpret it. |
| 5 | |
| 6 | # This definition is changed on install to match the |
| 7 | # executable name set in the makefile |
| 8 | GS_EXECUTABLE=gs |
| 9 | |
| 10 | OPTIONS="-P- -dSAFER" |
| 11 | while true |
| 12 | do |
| 13 | case "$1" in |
| 14 | -?*) OPTIONS="$OPTIONS $1" ;; |
| 15 | *) break ;; |
| 16 | esac |
| 17 | shift |
| 18 | done |
| 19 | |
| 20 | if [ $# -ne 2 ]; then |
| 21 | echo "Usage: `basename \"$0\"` [options] input.ps output.ps" 1>&2 |
| 22 | echo " e.g. `basename \"$0\"` -sPAPERSIZE=a4 input.ps output.ps" 1>&2 |
| 23 | exit 1 |
| 24 | fi |
| 25 | |
| 26 | exec $GS_EXECUTABLE -q -sDEVICE=ps2write -sstdout=%stderr "-sOutputFile=$2" -dNOPAUSE -dBATCH $OPTIONS "$1" |