1

I am having issues figuring out how to add a filter for a raw queue in CUPS - if this is possible.

Basically, what I need to do, is convert a TIFF to PS before sending it to the raw queue. The printer does not have built-in TIFF support, so the output is junk.

I need to keep the printer setup as a raw queue, and cannot add a second print queue for this same printer for the filtering.

Is there anyway to capture a TIFF file (desirably for a single printer) and convert it to PS before sending it raw?

Would this be something I would do in the mime.convs for the raw application?

2
  • Are you sending the TIFF in with lpr or similar? Or how is the TIFF getting into CUPS? Commented Jun 26, 2014 at 16:29
  • @derobert It is happening from an application, as well as using lpr (main goal is to get it working from the application, which is an in-house application). Commented Jun 26, 2014 at 16:53

1 Answer 1

0

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.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.