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