#!/bin/sh

RSVG_CONVERT=`which rsvg-convert`

echo "DEBUG: svgtopdf argv[$#] = $@" >&2
echo "DEBUG: PPD: $PPD" >&2

if [ $# -lt 5 -o $# -gt 6 ]; then
    echo "ERROR: $0 job-id user title copies options [file]" >&2
    exit 1
fi

# Read from given file.
if [ -n "$6" ]; then
    exec <"$6"
fi

$CUPS_SERVERBIN/filter/svgtosvg "$1" "$2" "$3" "$4" "$5" | $RSVG_CONVERT -f pdf
