I have found a solution to this. Basically, I am creating a new printer with a custom backend, that lets me manipulate the incoming data before sending it out again. So I have one printer acting as a wrapper, that receives the data, converts the image, then sends it to the actual printer.
To accomplish this, there is an openSUSE RPM package that provides a CUPS pipe backend that can be used with CentOS. This backend is used like a command line pipe.
I downloaded that RPM above and extracted the pipe script. This script copied to /usr/lib/cups/backend/pipe and made executable.
I then wrote a small script, that will take the printing information passed to it, including printer options from the printer URI. This script does the image conversion (for this task TIFF to PDF) if needed, and then sends it on to the actual printer.
#!/bin/bash
FILE=${PIPE_BACKEND_ARGV6}
MIME_TYPE=$(file --mime-type "${FILE}" | awk '{print $2}')
if [[ $MIME_TYPE == *tiff ]]
then
tiff2pdf -o /tmp/printConv-$$.pdf "$FILE"
FILE=/tmp/printConv-$$.pdf
CONV=1
fi
lpr -P "$1" "${FILE}"
if [[ $CONV -eq 1 ]]
then
rm "${FILE}"
fi
I then setup a "wrapper" printer with the following URI syntax:
pipe:/path/to/cups-wrapper-script?actualPrinterName
Here the pipe backend is used. It calls the script at /path/to/cups-wrapper-script with the argument actualPrinterName, which is used to tell the script what actual printer to send the job to.
lpror similar? Or how is the TIFF getting into CUPS?