[cups.general] Restrict print job based on MIME type

Ari Constancio ari.constancio at gmail.com
Wed Nov 8 03:06:52 PST 2006


Hello again,

The printer in question (HP Laserjet 1300) is set with its PPD file;
with the script Jerome kindly sent, the MIME type appears as
"application/postscript" and not as "application/pdf" (I want to deal
specifically with PDFs).

I found no answers reading the CUPS manual or browsing the
mime.{types,convs} files.

Thanks again,
Ari Constancio


On 11/7/06, Ari Constancio <ari.constancio at gmail.com> wrote:
> That is great! Thank you.
> Ari Constancio
>
> On 11/7/06, Jerome Alet <alet at librelogiciel.com> wrote:
> > Hi,
> >
> > On Tue, Nov 07, 2006 at 06:50:35PM +0000, Ari Constancio wrote:
> > >
> > > I'm looking for a simple (but no simpler :)) way to restrict print
> > > jobs based on MIME types.
> > > I need to prevent printing of specific types.
> >
> > What I'd do :
> >
> >   0 - Let's say your print queue is named "MyQueue"
> >       and its Device URI in CUPS is, for example,
> >       ipp://myprinter.example.com/printers/port1
> >
> >   1 - Download and install Tea4CUPS from :
> >
> >           http://www.pykota.com/software/tea4cups
> >
> >       If you don't want to fork 25 bucks, download
> >       it using subversion.
> >
> >   2 - Modify tea4cups.conf and define something like this :
> >
> >           --- CUT ---
> >           prehook_checkmime : /path/to/your/script.sh
> >           --- CUT ---
> >
> >   3 - Create script.sh with content looking like :
> >
> >           --- CUT ---
> >           #! /bin/sh
> >           MIME=`/usr/bin/file --mime $TEADATAFILE | cut -f 2,2 -d " " | cut -f 1,1 -d \;`
> >           case "$MIME" in
> >               *text/plain)
> >                   exit 0
> >                   ;;
> >               *application/pdf)
> >                   exit 0
> >                   ;;
> >               *)
> >                   exit -1
> >                   ;;
> >           esac
> >           --- CUT ---
> >
> >   4 - Change the Device URI for MyQueue so that Tea4CUPS is used :
> >
> >         lpadmin -p MyQueue -v tea4cups://ipp://myprinter.example.com/printers/port1
> >
> >   5 - Print something.
> >
> > Only files of MIME type text/plain or application/pdf will be printed. All other
> > files will be silently ignored.
> >
> > IMPORTANT : my shell script skills are very very bad, so maybe the shell
> > script above doesn't work. You're mostly on your own, it's YOUR script
> > after all :-)
> >
> > hoping this helps anyway
> >
> > bye
> >
> > Jerome Alet
> >
> > _______________________________________________
> > cups mailing list
> > cups at easysw.com
> > http://lists.easysw.com/mailman/listinfo/cups
> >
>





More information about the cups mailing list