|
Re: chain of filters: msg#00299printing.cups.general
Peter van Schijndel wrote: > I have my Laserjet 5N running nicely with Cups and Foo-matic. I however > want to implement a simple kind of accounting. In order to do this > i need to run an extra *cupsFilter. This filter will not do anything > with the printjob itself, it will just log the user. Based on the 7 > arguments filters are called with. > I however do not seem to able to have the job traverse more than one > filter. Is it possible at all, to setup such a chain of filters. Ie > have multiple filters react on the same mime-type? > Regards, > Peter > Create two separate files: /etc/cups/petersch.types /etc/cups/petersch.convs The separate files inoculate your setup in case of updates, which would overwrite "/etc/cups/mime.types" and "/etc/cups/mime.convs". At cupsd startup, all *.types and *.convs files are parsed and taken into account for the setup of any filtering chains. Now in "/etc/cups/petersch.types" define the "rules", for the MIME types you want to either auto-recognize, or to process in the middle of your filtering chain. Your definitions could be anything you like. See the "mime.types" file for instuctions. Your mime.convs conversion rules must match your definitions, of course. I'll assume, that you want to plug a few of your own filters after CUPS' own "pstops" filter, and that your filters don't change the fact that the processed files are all PostScript /etc/cups/petersch.types: ------------------------- application/vnd.cups-postscript_post_1 contains(0,128,<1B>%-12345X) + (contains(0,1024,"LANGUAGE=POSTSCRIPT") contains(0,1024,"LANGUAGE = Postscript") contains(0,1024,"LANGUAGE = POSTSCRIPT")) application/vnd.cups-postscript_post_2 contains(0,128,<1B>%-12345X) + (contains(0,1024,"LANGUAGE=POSTSCRIPT") contains(0,1024,"LANGUAGE = Postscript") contains(0,1024,"LANGUAGE = POSTSCRIPT")) application/vnd.cups-postscript_post_3 contains(0,128,<1B>%-12345X) + (contains(0,1024,"LANGUAGE=POSTSCRIPT") contains(0,1024,"LANGUAGE = Postscript") contains(0,1024,"LANGUAGE = POSTSCRIPT")) /etc/cups/petersch.convs: ------------------------- application/vnd.cups-postscript application/vnd.cups-postscript_post_1 66 petersch-filter.sh1 application/vnd.cups-postscript_post_1 application/vnd.cups-postscript_post_2 66 petersch-filter.sh1 application/vnd.cups-postscript_post_2 application/vnd.cups-postscript_post_3 66 petersch-filter.sh2 application/vnd.cups-postscript_post_3 application/vnd.cups-postscript 66 petersch-filter.sh3 This invokes a filtering chain of pstops --> petersch-filter.sh1 --> petersch-filter.sh2 --> petersch-filter.sh3 Now it is your responsibility to program your various "petersch-filter.sh*".... ;-) Your first filter could for example do the page-counting, The second one could print a watermark onto each page. The third one could do an "imposition", laying out several pages on one sheet (like you need for pamphlet output.). Of course, you can also do all these steps inside one filter. The setup with 3 different filters is artificial, just to show how it could be done, if you need various custom filters concatenated.... Of course, you can also do much more "wild" things, with your very own MIME types defined, and the target MIME type (the one that is the last generated by the filtering chain, going to the "backend", which finally sends the job to the printer), defined in a "*cupsFilter:" line in the PPD. Cheers, Kurt |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Re: change printer (cupsaddsmb, WINXP etc): 00299, Kurt Pfeifle |
|---|---|
| Next by Date: | Re: SendError() code=401: 00299, Michael Sweet |
| Previous by Thread: | chain of filtersi: 00299, Peter van Schijndel |
| Next by Thread: | Stripes are printed with Cups, gs prints correct: 00299, Kay Obermueller |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |