save input file before filter processing

Helge Blischke h.blischke at acm.org
Wed Apr 18 07:32:54 PDT 2012


Myska Ludek wrote:

> I read documentation about file mime.convs.I found filter definition for
> printed file.I change the file with add lines:
> 
> application/postscript application/psacoounting 100 psaccounting
> application/psaccounting application/vn.cups-postscript 100 pstops
> 
> Then i place file to /usr/lib/cups/filters/psaccounting make executable
> for anyone with this content: ---
> #!/bin/bash
> 
> echo $6 > /tmp/`date`.ps
> exit
> ---
> Just test script.But when i print poscript file nothing happend.No file in
> tmp. No error in cups log.Then i read documentation second time and i find
> line with recomendation to store own conv file to /etc/cups/.I dit it and
> nothing happend. How i change mime.convs file to make any change in filter
> processing?
> 
>> Yes, there is.  $6 is the print job pre filters, you would just need to
>> insert your filter first in the chain via the .convs process
>> > Hi.
>> > I use windows generic postscript and cupsaddsmb to assing driver to
>> > printer and share this driver to network.Then i use tea4cups and
>> > pkpgcounter for job accounting a then send print to real backend with
>> > driver for printer.And here is a problem.If printert can print
>> > postscript there is no problem with accounting.If print use only
>> > pcl(5,5e,6) pkpgcounter dont work well but printing is fine. Is there a
>> > way to catch print job (postscript from windows clients) before run
>> > thrue filter pstopxl a send him to pkpgcounter or to another printer
>> > with tea4cups backend ?. I use Debian GNU/Linux 6.4 i386 in vmware and
>> > samba is connected to windows active directory.samba v3.5.4 and cups
>> > v1.4.4.Sorry for my bad english.
>>

First, as your filter is not the very first one in the chain, $6 son't be 
defined, instead the data are expected to be read from STDIN. And you need 
to write the output of your filter (which is the input to the next filter or 
the backend) to STDOUT.
So you script should do a check if $6 is defined, then use the cat command 
to write your temp file, and then cat the temp file o STDOUT agein.

Second, in your xxx.convs, you should write
application/vnd.cups-postscript

Helge





More information about the cups mailing list