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

Jerome Alet alet at librelogiciel.com
Tue Oct 26 23:45:20 PDT 2004


Nayco wrote:
> Jerome Alet wrote:
>
> >         "%%BeginNonPPDFeature: NumCopies "
> >         "1 dict dup /NumCopies "
> >
> > the lines in the PS document which contain the above code snippet
> > (depending on driver and/or application) set the number of copies,
> > you have to analyze the line to extract it, and then multiply by the
> > number of pages returned by the "bbox" method.
>
> > any comment ?
>
> Errr... Yes ;-) !
>
> By "NumCopies", your not talking about "number of pages", but "number of times I want these pages printed in a this single jobs", right ?

Correct.

these documents MAY (see below) also contain the number of pages,
but these snippets set the number of times these (each ?) pages
have to be duplicated by the printer.

> So, you mean in some (Oddly formed ?) postscript documents, "bbox"
> nor "%%Pages:" are used to specify the number of pages, but instead
> "Number of copies" ? I find this strange, but I trust you, I see
> everyday bad html pages (;-)), so there must be bad postscript as
> well...

No that's not what I mean.

I didn't say these documents were "oddly formed", I believe they are perfectly correct PostScript documents.

> So, "%%Pages:" is _not_ the good way (Never ?) ? I mean, wasn't this
> tag designed for this very purpose: Count pages ?

%%Pages: is a comment, only a comment, so it may not be present, and that's why the bbox thing is better than trying to read this comment.

BTW the %%BeginNonPPDFeature thing is also a comment, so you can understand that no foolproof solution exists. Maybe there's a way to tell GhostScript to correctly analyze this sort of things, but I don't know it currently.

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.

Jerome Alet




More information about the cups mailing list