#!/bin/sh
ps2img="gs -dQUIET -dNOPAUSE -dBATCH -sDEVICE=pnm -r75x75 -sOUTPUTFILE=- -"
testpage=/usr/share/cups/data/testprint.ps

TMPFILE=~/.displaytestpage.pnm
if [ -x /usr/bin/kview ]; then
  cat $testpage | $ps2img > $TMPFILE
  /usr/bin/kview $TMPFILE
elif [ -x /usr/bin/ee ]; then
  cat $testpage | $ps2img > $TMPFILE
  /usr/bin/ee $TMPFILE
elif [ -x /usr/bin/gqview ]; then
  cat $testpage | $ps2img > $TMPFILE
  /usr/bin/gqview $TMPFILE
elif [ -x /usr/bin/xv ]; then
  cat $testpage | $ps2img | /usr/bin/xv -
elif [ -x /usr/bin/kghostview ]; then
  /usr/bin/kghostview $testpage
elif [ -x /usr/X11R6/bin/gv ]; then
  /usr/X11R6/bin/gv $testpage
elif [ -x /usr/X11R6/bin/ghostview ]; then
  /usr/X11R6/bin/ghostview $testpage
else
  xmessage "No suitable program for viewing PostScript found, install GhostView, gv, or similar."
  exit 1
fi
rm $TMPFILE
