dvipdf 965 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/sh
  2. # $Id: dvipdf,v 1.5 2004/08/04 00:55:46 giles Exp $
  3. # Convert DVI to PDF.
  4. #
  5. # Please contact Andrew Ford <A.Ford@ford-mason.co.uk> with any questions
  6. # about this file.
  7. #
  8. # Based on ps2pdf
  9. # This definition is changed on install to match the
  10. # executable name set in the makefile
  11. GS_EXECUTABLE=gs
  12. OPTIONS=""
  13. while true
  14. do
  15. case "$1" in
  16. -*) OPTIONS="$OPTIONS $1" ;;
  17. *) break ;;
  18. esac
  19. shift
  20. done
  21. if [ $# -lt 1 -o $# -gt 2 ]; then
  22. echo "Usage: `basename $0` [options...] input.dvi [output.pdf]" 1>&2
  23. exit 1
  24. fi
  25. infile=$1;
  26. if [ $# -eq 1 ]
  27. then
  28. case "${infile}" in
  29. *.dvi) base=`basename "${infile}" .dvi` ;;
  30. *) base=`basename "${infile}"` ;;
  31. esac
  32. outfile="${base}".pdf
  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 dvips -q -f "$infile" | $GS_EXECUTABLE $OPTIONS -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile="$outfile" $OPTIONS -c .setpdfwrite -