[cups.general] block print jobs from specific file types

alet at librelogiciel.com alet at librelogiciel.com
Tue Mar 17 02:44:39 PDT 2009


On Tue, Mar 17, 2009 at 02:08:23AM -0700, Gareth Clark wrote:
> Thanks.
>
> I will look into those.
>
> >
> > --Apple-Mail-2-352512392
> > Content-Transfer-Encoding: 7bit
> > Content-Type: text/plain;
> > 	delsp=yes;
> > 	charset=us-ascii;
> > 	format=flowed
> >
> > For just jobs printed from web browsers? Probably not - Pykota or
> > Tea4CUPS might provide the hooks for post-filtering the print jobs,
> > but it will be tricky. A better option would be to use those tools to
> > offer per-user page limits of all print jobs.

With Tea4CUPS it would be very easy to reject jobs based on any
information (job's content, mime type, etc...).

Let's say your printer is named 'HP', just create a section in
tea4cups.conf with the following content :

--- CUT ---
[HP]
prehook_rejectonmimetype : /usr/local/bin/rejectonmimetype.sh
--- CUT ---

(if you want this on all printers, simply put the prehook line in the
[global] section)

Then in /usr/local/bin/rejectonmimetype.sh check the value of either the
'CONTENT_TYPE' or 'FINAL_CONTENT_TYPE' environment variable (depending
on your exact need), or do anything you want, and then ensure your
script exits with -1 if job is to be rejected, or exits with 0 if job is
to be printed.

See tea4cups.conf for more details and examples.

To see which environment variables are available to your script, simply
define an additional hook in the same section with :

prehook_environment : /usr/bin/printenv | /usr/bin/sort >/tmp/prehook_env

and look at this file after having printed something.

hth

Jerome Alet





More information about the cups mailing list