4fafa5c
#!/bin/sh
4fafa5c
#
4fafa5c
# CUPS filter script for Ghostscript.
4fafa5c
#
4fafa5c
# Copyright 2001-2002 by Easy Software Products.
4fafa5c
# Copyright 2006 by Hewlett-Packard Development Company, L.P.
4fafa5c
#
4fafa5c
# This program is free software; you can redistribute it and/or modify
4fafa5c
# it under the terms of the GNU General Public License as published by
4fafa5c
# the Free Software Foundation; either version 2, or (at your option)
4fafa5c
# any later version.
4fafa5c
#
4fafa5c
# This program is distributed in the hope that it will be useful,
4fafa5c
# but WITHOUT ANY WARRANTY; without even the implied warranty of
4fafa5c
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4fafa5c
# GNU General Public License for more details.
4fafa5c
#
4fafa5c
# You should have received a copy of the GNU General Public License
4fafa5c
# along with this program; if not, write to the Free Software
4fafa5c
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
4fafa5c
#
4fafa5c
4fafa5c
# Installation directories...
4fafa5c
prefix=/usr
4fafa5c
exec_prefix=${prefix}
4fafa5c
bindir=${exec_prefix}/bin
4fafa5c
4fafa5c
# Set the library/font path...
4fafa5c
GS_FONTPATH="$CUPS_FONTPATH"
4fafa5c
export GS_FONTPATH
4fafa5c
4fafa5c
# Options we use with Ghostscript...
4fafa5c
gsopts="-dQUIET -dDEBUG -dPARANOIDSAFER -dNOPAUSE -dBATCH "
4fafa5c
gsopts="$gsopts -dNOMEDIAATTRS -sDEVICE=pdfwrite -sstdout=%stderr"
4fafa5c
4fafa5c
# See if we have a profile=n,n,n,n,n,n,n,n,n,n,n option...
4fafa5c
profile=""
4fafa5c
for option in $5; do
4fafa5c
    case $option in
4fafa5c
        profile=*)
4fafa5c
	    profile="-scupsProfile=`echo $option | awk -F= '{print $2}'`"
4fafa5c
	    ;;
4fafa5c
    esac
4fafa5c
done
4fafa5c
4fafa5c
# See if we have a filename on the command-line...
4fafa5c
if test -z "$6"; then
4fafa5c
	ifile="-"
4fafa5c
else
4fafa5c
	ifile="$6"
4fafa5c
fi
4fafa5c
4fafa5c
# Now run Ghostscript...
4fafa5c
$bindir/gs $gsopts -sOUTPUTFILE="%stdout" $profile $ifile
4fafa5c