[cups.general] Restrict print job based on MIME type
Ari Constancio
ari.constancio at gmail.com
Tue Nov 7 14:19:03 PST 2006
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