Re: [SLUG] CUPS / filter question

From: Ian C. Blenke (ian@blenke.com)
Date: Wed Aug 02 2006 - 15:31:22 EDT


Daniel Jarboe wrote:

> Hrm, I haven't created PPDs just for a filter, so YMMV on this, but I
> don't see any reason why you couldn't have your filter just cat the
> input to stdout, followed by your escape sequence. Raw is by
> definition unfiltered (null filter - in mime.convs), so you wouldn't
> be raw anymore, but your filter would in effect cat the input without
> modifications, followed by your control character. So your idea
> should work.
>
> As far as an easier way than the PPD cupsFilter route goes, what
> protocol/backend do you use to send data to your printer? Depending
> on what you are relying on cups to do, a solution that would not rely
> on a PPD of your creation to specify a filter of your creation, is to
> create a backend instead of a filter. Cups backends are almost
> identical to filters, same arguments, just a different stage in the
> process. You would print to your backend raw... and the main
> difference is your backend would be responsible for sending the input
> data (either stdin or as a file, depending on how the print was
> submitted) to the printer. So if all you need is a cat to a locally
> attached lp0 or similar, then the backend way may be easier for you
> (though likely less reliable) than the filter and letting cups
> backends do the hairier printer communication.

Looking into Daniel's suggestion a bit, it looks like this is relatively
simple.

Follow something like the universal "beh" script:

    http://linuxprinting.org/beh.html

It's a simple perl script that you put into the backend directory, and
it intercepts backend errors.

    $ cd /usr/lib/cups/backend/
    $ wget 'http://linuxprinting.org/download.cgi?filename=beh&show=0'
    $ chmod 755 beh

Taking beh as a template, you can easily modify it to append your escape
sequence to the end of the printFile before handing it off to the
original backend.

- Ian C. Blenke <ian@blenke.com> http://ian.blenke.com/

-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 15:33:42 EDT