#!/bin/sh ######################################################################## # # Convert an rtf document to pdf format using 'Ted' and 'GhostScript'. # # Usage rtf2pdf.sh --paper paper something.rtf something.pdf # Or rtf2pdf.sh something.rtf something.pdf # # This is an example. Refer to http://www.nllgg.nl/Ted/index.html for the # 'Ted' documentation. # # If you want 'Ted' to use X11 configurable resources, use # Ted ++printToFilePaper ... # ######################################################################## PAPER= case $# in 2) ;; 4) case $1 in --paper) ;; *) echo $0: '$1='$1 exit 1 ;; esac case $2 in a4|a5|a6|letter|legal|executive) PAPER=$2 ;; *) echo $0: '$2='$2 exit 1 ;; esac shift; shift; ;; *) echo $0: '$#='$# exit 1 ;; esac case $PAPER in ?*) Ted --printToFilePaper $1 /tmp/$$.ps $PAPER gs -q -dNOPAUSE \ -sDEVICE=pdfwrite \ -sPAPERSIZE=$PAPER \ -sOutputFile=$2 \ /tmp/$$.ps \ -c quit rm /tmp/$$.ps ;; *) Ted --printToFile $1 /tmp/$$.ps gs -q -dNOPAUSE \ -sDEVICE=pdfwrite \ -sOutputFile=$2 \ /tmp/$$.ps \ -c quit rm /tmp/$$.ps ;; esac