[cups.development]Simple accounting filter/backend (With Perl or another script language)

Nayco (.free.fr) nayco at spam.me
Wed Oct 27 01:48:24 PDT 2004


Jerome Alet wrote:
> The fact that PostScript is a real and complete computer language doesn't help, because only a complete parser (gs ?) can deal with such constructs. The "pseudo" code I described above is just a workaround, it can easily be bypassed.

Thanks a lot :-) !!

So, That's the method you used in Pykota ?
Anyway, lets imagine users are non-malicious: Your method should work with all (most) of the "normal" printjobs ?

Ok, I tried manually with "grep" with a document printed to file (2 pages, and I asked 37 copies...):

$ grep -i "1 dict dup " toto.ps
1051 dict dup begin
1 dict dup /NumCopies 37 put setpagedevice
1 dict dup /NumCopies 37 put setpagedevice

Sounds good :) !!! So, I can assume here that NumCopies shows the right value, and appears 2 times because of the 2 pages length of the document... I'm right ? Ok, this document comes from Mozilla Firefox. I'll try with others.

But, something I can't explain:

$ grep -i "Bounding" toto.ps
%%BoundingBox: 0 0 612 792   #Only one Bounding box ?

Although:
$ /usr/bin/gs -sDEVICE=bbox -dNOPAUSE -c save pop -f toto.ps -c quit 2>&1
%%BoundingBox: 0 0 612 792
%%HiResBoundingBox: 0.036000 0.324000 611.891981 791.981976
%%BoundingBox: 0 0 612 792
%%HiResBoundingBox: 0.036000 0.324000 611.891981 791.981976

Ok, two pages, but no 37 copies :)

Lastly:
$ grep -i "BeginNonPPDF" toto.ps
<nothing>

So, what I need now is to make the algorhythm... I need to sort these methods from most accurate to less accurate, as to correctly nest my "IFs" ;) What do you think about it ?






More information about the cups-devel mailing list