Michael Loßin on Thu, 28 Feb 2002 22:22:29 +0100 (CET)(envelope-from owner-apsfilter-help@apsfilter.org)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: software page accounting and apsfilter


On 28-Feb-02 Michal Szymanski wrote:
> Hi,
> 
> I wonder how easy (or how difficult :) would it be to implement software
> page accounting into apsfilter setup.

In short: it's not worth trying.
 
> I know, I know. Hardware page accounting is better. Yes it is. But it
> does not work :-))) At least for me.

That's just too bad :^) But hardware accounting is actually
the only reliable way to count the pages.

> On the other hand, most (if not all) jobs printed by these printers are
> PS jobs.

This may be true, but once you introduce accounting on
your printer(s), your users will start to create non-PS
print jobs :^)

The easiest way to bypass page counting will be printing
(printer-ready) data in raw mode -- there's no chance to
know how many pages the data contains. So you'll have to
forbid raw mode.

Then there's the possibility to add a commented header
to the PostScript file that will cause file(1) to say
it's a "data" file instead of PostScript, resulting in
apsfilter passing it through -- but your PS printer
accepts it, because the comments are skipped. So you'll
have to forbid "data" files as well (which upsets all
applications that have their own printer drivers).

Then you can have a "numcopies" included in the PS file;
the psutils will say the file has only 5 pages, but these
may be printed 20 times, without you even knowing it...

I'm pretty sure there are more pitfalls.

> The only problem is to insert this "psnup" and 'stderr' grabbing into
> the apsfilter pipeline in a way that would not screw up other things.
> So, a question to experts: how can one do it nicely? Maybe even
> apsfilter is already prepared and has an option to add extra "user
> filter" into the pipeline?

Since psselect does very little to the PS data, you can
easily add something like

  ... | psselect 2> "$APS_TMPDIR/count"

to the end of the pipeline in ps_postprocessing, and after
that you can scan the "count" file for the actual page count

  sed 's/.*Wrote \(.*\) page.*/\1/' "$APS_TMPDIR/count"

and do whatever you like, e.g. write a proper line into
the accounting file.


If you really manage to set up a working software accounting
system (I haven't seen one yet), please report it here...


Michael