#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
#
# To configure this interface script under Solaris LP use the following
# command:
#
# lpadmin -p printer -v /dev/... -I"postscript,pdf" -Tunknown \
# -i /usr/sfw/share/ghostscript/interfaces/GSinterface \
# -o GS_DEVICE=(gs-device-type) \
# [-o RESOLUTION=XxY] [-o banner-type=(ascii|postscript)] \
# [-o GS_OPTIONS="-sIjsServer=... -sIjsParams=..."]
#
# see gs(1) for more information about values that can be used for
# GS_DEVICE, PAPERSIZE, and RESOLUTION, and GS_OPTIONS.
#
# on a Solaris x86 machine. If you have selected the correct GS_DEVICE
# and get garbled output when printing under this configuration, running
# "lpadmin -p printer -H nopush"
# should fix the problem.
if [ $# -lt 5 ] ; then
"wrong number of arguments to interface program" 1>&2
echo "wrong number of arguments to interface program" 1>&2
exit 1
fi
request_id=$1
user_name=$2
title=$3
copies=$4
option_list=$5
shift 5
files="$*"
tag="GSinterface: ${request_id}"
error_file="/tmp/${printer}-log.$$"
}
banner="postscript_banner"
nobanner="no"
nofilebreak="no"
for i in ${option_list}
do
case "${inlist}${i}" in
nobanner )
nobanner="yes"
;;
nofilebreak="yes"
;;
banner-type=* )
;;
GS_DEVICE=* )
;;
OutputFile=* )
OutputFile="yes"
;;
RESOLUTION=* )
;;
PAPERSIZE=* )
;;
GS_OPTIONS=* )
;;
* )
"unrecognized \"-o ${i}\" option, ignored" 1>&2
;;
esac
done
if [ "${OutputFile}" = "" ] ; then
GS_OPTIONS="-sOutputFile=- ${GS_OPTIONS}"
fi
# Don't pause between pages, exit upon completion, don't print startup and
# page messages, don't allow deletefile, rename, or write access to files
GS_OPTIONS="-dNOPAUSE -dBATCH -dQUIET -dSAFER ${GS_OPTIONS}"
#
# Generate an ASCII banner page and pass it to the printer
# This is much faster than the PostScript(TM) banner
#
cat <<EOF
${title}
Request: ${request_id}
User: ${user_name}
Printer: ${printer}
Time: `date`
Copies: ${copies}
EOF
}
#
# Generate a PostScript(TM) banner page and run it through GhostScript.
# This assumes an 8.5x11 page size.
#
cat <<EOF | gs - 2>> ${error_file}
%!ps
/PrintLine { exch findfont exch scalefont setfont moveto show } def
newpath 4 setlinewidth 1 setlinejoin
15 760 moveto 595 760 lineto 595 585 lineto 15 585 lineto closepath
gsave .75 setgray fill grestore
0 setgray stroke
(${user_name}) 30 730 /Times-Bold 24 PrintLine
(${request_id}) 415 730 /Times-Bold 24 PrintLine
(${printer}) 30 600 /Times-Bold 16 PrintLine
(`date`) 350 600 /Times-Roman 16 PrintLine
(${title}) 100 660 /Times-Bold 36 PrintLine
(Copies: ${copies}) 30 25 /Times-Roman 16 PrintLine
showpage
EOF
}
#
# should create a banner
# a simple text or PCL banner would be prefered, because a PS one
# would require GhostScript to RIP and pass the whole image to the
# printer.
#
case "${nobanner}" in
"no")
;;
esac
#
# process the files
#
i=1
done
i=`expr $i + 1`
done
if [ -s ${error_file} ] ; then
rm -f ${error_file}
fi
exit 0