#!/bin/ksh -p export PATH=/usr/local/bin:/opt/sfw/bin:/usr/bin # Takes a postscript filename as an arg, and dumps it to stdout: /dev/fd/1 # OR, if -o specified, puts it in that file. # # Output is suitable for an hp laserjet printer that does NOT have # the extra postscript option installed # You MIGHT want to tweak this between "laserjet" or "ljet4" or whatever #DEVICE=laserjet DEVICE=ljet4 ############################################################ # Nothing below here should change # OUTFILE=/dev/fd/1 # args copied from ps2ascii GS='gs -q -dSAFER -dNOPAUSE ' GS="$GS -sDEVICE=$DEVICE" usage() { print "Usage:" print " ps2pcl" print " ps2pcl file.ps" print " ps2pcl -o output.pcl file.ps" print "" print "Given a postscript file, will convert to PCL and dump to stdout" print "or the specified output file" print "" print "From http://www.bolthole.com/solaris/ by Phil Brown" } while getopts "o:h" flag ; do case $flag in o) OUTFILE=$OPTARG ;; h|*) usage exit 1 ;; esac done shift $(($OPTIND - 1)) INFILE="$1" if [[ "$INFILE" == "" ]] ; then INFILE=- fi $GS -sOutputFile=$OUTFILE $INFILE -c quit