logo       

Re: Simple accounting filter/backend (With Perl or another script languag: msg#00041

printing.cups.devel

Subject: Re: Simple accounting filter/backend (With Perl or another script language)

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 ?


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise