Altere a seção PDF do smb.conf para
[pdf]
comment = Gerador de PDF
path = /tmp
guest ok = no
printable = yes
printing = bsd
printcap name = cups
print command = /usr/local/bin/printpdf "%s" "%H" "//%L/%u" "%m" "%I" "%J" &
lpq command = /bin/true
O script de impressão ficou mais complexo. Altere-o para
PS2PDF=ps2pdf13
OPTIONS="-dAutoFilterColorImages=false -sColorImageFilter=FlateEncode"
#Values taken from arguments:
INPUT=$1
PREFIX="$2"
WINBASE=$(echo "$3"|sed -e 's,/,\\\\,g')
#NAME=`echo "$6"|sed -e 's/[&/:{}\\\[<>$#@*^!?=|]/-/g;s/]/-/g'`
NAME=`echo "$6"|tr '[:punct:]' '[-*]'`
# Source config file if it exists:
CONFFILE=/etc/samba/print-pdf.conf
[ -e $CONFFILE ] && . $CONFFILE
#Values not taken as arguments, could be set via env. vars (?) or config file
KEEP_PS=${KEEP_PS=0}
PERMS=${PERMS=640}
BASEFILE=${BASEFILE=pdf-service}
TEMP="${TEMP=$2}"
UMASK=${UMASK=006}
#Make sure that destination directory exists
mkdir -p "$PREFIX"
INFILE=$(basename $INPUT)
umask $UMASK
[ -n "$NAME" ] && TEMP="$PREFIX"
#make a temp file to use for the output of the PDF
OUTPUT=`mktemp -q $TEMP/$BASEFILE-XXXXXX`
if [ $? -ne 0 ]; then
echo "$0: Can't create temp file $TEMP/$OUTPUT, exiting..."
exit 1
fi
if [ -n "$NAME" ]; then
FINALOUTPUT="$PREFIX/$NAME"
else
FINALOUTPUT="$OUTPUT"
fi
if [ -n "$7" ]; then
OPTIONS="$OPTIONS -dPDFSETTINGS=/${7#pdf-}"
else
OPTIONS="$OPTIONS -dPDFSETTINGS=/default"
fi
WIN_OUTPUT="$WINBASE\\"`basename "$FINALOUTPUT"`
#mv "$INPUT" "$INPUT.ps";INPUT="$INPUT.ps"
# create the pdf
$PS2PDF $OPTIONS "$INPUT" "$OUTPUT.pdf" >/dev/null 2>&1
mv -f "${OUTPUT}.pdf" "${FINALOUTPUT}".pdf
# Generate a message to send to the user, and deal with the original file:
MESSAGE=$(echo "Your PDF file has been created as $WIN_OUTPUT.pdf
")
# Cleanup
if [ $KEEP_PS != 0 ];then
mv -f $INPUT "${FINALOUTPUT}".ps
MESSAGE=$(echo "$MESSAGE and your postscript file as $WIN_OUTPUT.ps")
# Fix permissions on the generated files
chmod $PERMS "${FINALOUTPUT}".ps "${FINALOUTPUT}".pdf
else
rm -f $INPUT
# Fix permissions on the generated files
chmod $PERMS "${FINALOUTPUT}".pdf
fi
#Remove empty file from mktemp:
rm -f $OUTPUT
# Send notification to user
echo -e $MESSAGE|smbclient -M $4 -I $5 -U "PDF Generator" >/dev/null 2>&1
Para imprimir colorido use uma impressora como a HP COLOR LASERJET 8500 PS.
Créditos do script melhorado para Buchan Milne <
[email protected]>