Subject: ps to eps conversion

From: Steve Greatbanks <[email-masked]>
Date: Mon, 11 Apr 94 11:49:10 BST

Hi,
  for anybody out there with ghostscript, a more elegant solution
is to use the following shell script ( which I hasten to add, I
did not write, but found hiding on our system )

**********cut here***********
#!/bin/sh

LOCALPATH=/usr/contrib/bin
PATH=/bin:/usr/bin:/usr/ucb\:$LOCALPATH\

export PATH outfile

if [ $# -lt 1 -o $# -gt 2 ]; then
        echo "Usage: pstoepsi file.ps [file.epsi]" 1>&2
        exit 1
fi

infile=$1

if [ $# -eq 1 ]
then
        case "${infile}" in
          *.ps)         base=`basename ${infile} .ps` ;;
          *.cps)        base=`basename ${infile} .cps` ;;
          *.eps)        base=`basename ${infile} .eps` ;;
          *.epsf)       base=`basename ${infile} .epsf` ;;
          *)            base=`basename ${infile}` ;;
        esac
        outfile=${base}.epsi
else
        outfile=$2
fi

gs -q -dNOPAUSE -dNODISPLAY ps2epsi.ps < ${infile} 1>&2

(
cat << BEGINEPS
/InitDictCount countdictstack def
gsave
save
mark
newpath
/showpage {} def
BEGINEPS

cat ${infile}

cat << ENDEPS
countdictstack InitDictCount sub { end } repeat
cleartomark
restore
grestore
ENDEPS

) >> ${outfile}

exit 0
********cut here***************
All you need to do is change the paths to whatever are appropraite for your system
and all should be well.

Steve Greatbanks.