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 10# This definition is changed on install to match the 11# executable name set in the makefile 12GS_EXECUTABLE=gs 13 14 15OPTIONS="" 16while true 17do 18 case "$1" in 19 -*) OPTIONS="$OPTIONS $1" ;; 20 *) break ;; 21 esac 22 shift 23done 24 25if [ $# -lt 1 -o $# -gt 2 ]; then 26 echo "Usage: `basename $0` [options...] input.dvi [output.pdf]" 1>&2 27 exit 1 28fi 29 30infile=$1; 31 32if [ $# -eq 1 ] 33then 34 case "${infile}" in 35 *.dvi) base=`basename "${infile}" .dvi` ;; 36 *) base=`basename "${infile}"` ;; 37 esac 38 outfile="${base}".pdf 39else 40 outfile=$2 41fi 42 43# We have to include the options twice because -I only takes effect if it 44# appears before other options. 45exec dvips -q -f "$infile" | $GS_EXECUTABLE $OPTIONS -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile="$outfile" $OPTIONS -c .setpdfwrite - 46