How should backends handle multi-file jobs?

Michael Sweet mike at easysw.com
Fri Feb 16 15:26:28 PST 2007


Jeremy Parrish wrote:
>> Jeremy Parrish wrote:
>>> Hi,
>>>
>>> Forgive me if this has been asked before. I could not find a definitive answer in my searching.
>>>
>>> How are backends supposed to deal with milti-file jobs? It appears that if a job has more than one file, the data file is named with a "-001", "-002", etc. suffix (i.e. d000001-001 instead of just d000001). It appears that the backend only gets "invoked" for the "-001" file. So, I'm guessing that it is the backend's job to look for the "-002" etc. files on its own... Is this correct, or is something wrong here?
>> That is not correct.
>>
>> Backends only handle a single file, or read one or more files worth
>> of data from stdin.  Your backend should either read the file in
>> argv[6] or read from stdin.
>>
>> There is a pending bug in CUPS 1.2 (that will not be fixed until 1.3)
>> for *raw* printing of multiple files.  Basically, when printing raw
>> (or with no driver), you'll only get the first file in a job printed.
> 
> Ok, good. That is how I _thought_ it should work in the first place. I am indeed using a raw queue, so that's the source of my problem. I need to grab a plain text stream in the backend and do fun things to it.
> 
> Know of better workaround than doing what I described in the backend until 1.3 is readily available for production?

Use a simple passthru interface script for your queue, e.g.:

     lpadmin -p printer -i passthru.sh

where "passthru.sh" is something simple like:

     #!/bin/sh
     copies=$4
     while test $copies -gt 0; do
         cat $6
         copies=`expr $copies - 1`
     done

-- 
______________________________________________________________________
Michael Sweet, Easy Software Products           mike at easysw dot com
Internet Printing and Publishing Software        http://www.easysw.com




More information about the cups-devel mailing list