Print Server / Printer Accounting

Samuel Greenfeld Gree3776 at rowan.edu
Thu Jul 20 01:11:35 GMT 2000


   Postscript documents that follow Adobe's conventions should contain "%%Page:" once per page to be printed (without the quotes).  Microsoft products seem to follow this.   However, no one says everyone must follow this.   You can have a perfectly legal postscript document without these markers.   I myself need to do PCL and PS counting, but I myself have run into problems, especially since PCL seems to use ^L for both graphics and denoting pages (I do not know any PCL myself - this was just me studying what was in various print jobs).   PCL 6 is even more of a nightmare than PCL 5 to understand - it encodes text in binary form (Unicode or UTF-8, I suspect).

   If you have a bidirectional link to your printers (often available around port 9100 on HP's JetDirect Boxes), and have printers that keep track of page counts internally, you might be able to query the printer before and after each print job for the number of pages it has printed.   Subtract the two (or let a utility do it) and you have the number of pages printed.   Any decent departmental printer should support some method to do this (either by Hewlett Packard's PJL language or in Postscript itself).

   The way I've done this is one many people probably would not like - I replaced my lpd with the one from the LPRng (lpr next-generation) project.   This is because a print filter capable of doing this method of accounting, ifhp, is designed alongside this particular lpd project.   These are not likely to disappear soon - LPRng has been around since 1988, and some significant places (such as MIT) supposively use it.

   Lprng supports using accounting filters and many other tricks that a standard lpd can not do.   Ifhp can recognize various types of input, and use a converter if needed.   Ifhp also has a printer database of what can do what; tell it your model if it knows it, and you're basically set.   And best of all; Samba *does* know how to use lprng for printing.   I really should clarify and note that the ifhp/lprng combo only logs users and the number of pages they have printed; you still need to write some code to parse the print log they generate to account for what has been made.

   Granted, like any page count method, this is not perfect.   The case where two servers spool for the same printer comes to mind.   When you have cheap supervisors that buy little desktop lasers that count pages but do not seem to be queriable, this might also be a problem.   But for anyone with at least the equivalent of an HP 4000 (and probably less), this is one route you can go that does not care what protocol is used for the print job.   (And if anyone can get a page count out of the parallel port of a HP 1100 printer, please let me know privately.)

   LPRng and ifhp can be found at http://www.astart.com/LPRng/LPRng.html .   See their respective HOWTOs for the basics, and how samba can fit in.   The GNU and "Artistic" Licenses apply, although commercial support and licensing is available as well.

---
SJG

>>> Schlomo Schapiro <schapiro at clerk.pi.huji.ac.il> 07/19/00 10:56AM >>>
Hi,

actually counting PS pages is not so simple because counting the ShowPage
command is not enough, especially in cases where people print multiple
pages in one.

Schlomo




More information about the samba-ntdom mailing list