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.

46 lines
1007 B

1 month ago
  1. #!/bin/sh
  2. # Convert DVI to PDF.
  3. #
  4. # Please contact Andrew Ford <A.Ford@ford-mason.co.uk> with any questions
  5. # about this file.
  6. #
  7. # Based on ps2pdf
  8. # This definition is changed on install to match the
  9. # executable name set in the makefile
  10. GS_EXECUTABLE=gs
  11. OPTIONS=""
  12. DVIPSOPTIONS=""
  13. while true
  14. do
  15. case "$1" in
  16. -R*) DVIPSOPTIONS="$DVIPSOPTIONS $1";;
  17. -?*) OPTIONS="$OPTIONS $1" ;;
  18. *) break ;;
  19. esac
  20. shift
  21. done
  22. if [ $# -lt 1 -o $# -gt 2 ]; then
  23. echo "Usage: `basename \"$0\"` [options...] input.dvi [output.pdf]" 1>&2
  24. exit 1
  25. fi
  26. infile=$1;
  27. if [ $# -eq 1 ]
  28. then
  29. case "${infile}" in
  30. *.dvi) base=`basename "${infile}" .dvi` ;;
  31. *) base=`basename "${infile}"` ;;
  32. esac
  33. outfile="${base}".pdf
  34. else
  35. outfile=$2
  36. fi
  37. # We have to include the options twice because -I only takes effect if it
  38. # appears before other options.
  39. exec dvips -Ppdf $DVIPSOPTIONS -q -f "$infile" | $GS_EXECUTABLE $OPTIONS -q -P- -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sstdout=%stderr -sOutputFile="$outfile" $OPTIONS -