🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #313

Re: Page counting software

#313
From: Mark Bartelt
Date: Thu, 23 Jul 1992 11:45
57 lines
3369 bytes
[ Michael Roberts ]

| In article <ROBERTS.92Jul15122728@dyall.admin.ists.ca> I wrote:
|
|    I am in need of some postscript page counting software.  The simpler
|    the software the better.  It would be nice if this software could read
|    in a postscript file on stdin and spit out the number of pages that
|    would be printed if it were sent to a PS printer.
|
| The replies I have got were generously received and I am gratefull for
| them.  They are based on digging up the %%Pages: comment in the
| actual postscript file to be printed.
|
| I do not consider this an acceptable solution.

 [ ... ]

| The reason I don't like the "use the %%Pages: line" idea is it's too
| easy for people to get out of paying their bill by editing the PS
| file, if you know what I mean....
|
| Any starters on how I can get ghostscript to count pages for me?  Also
| what is the magic needed to get a PS printer to cough up the number of
| pages it has printed?  Will this work with ghostscript?

I posted a similar query a few weeks ago, not only regarding page count
(and I agree that one wants something that will deal with non-conforming
documents, so the "%%Page"-counting approach isn't terribly useful), but
also would like to get an estimate of toner usage (so that we can nag the
people who print a lot of nearly-all-black pages).  I got one reply, from
Adrian Ho <adrianho@barkley.berkeley.edu>.  I haven't had a chance to try
it yet (and probably won't for several weeks, at least; far too many high
priority things in the queue!), but it does sound promising:

| Ghostscript (and the PBMPLUS package) is the answer to both questions.
| I haven't actually implemented it (users here are reasonable about
| print jobs 8-), but (1) can be accomplished in Ghostscript by:
|
| (a) prepending and postpending PS code that redefines showpage to
|     increment a special counter before showing the image, and
|     returning the value to stdout at the end of the job, or
| (b) modifying the Ghostscript sources to keep an internal page counter
|     (this has the advantage of foiling any attempts to defeat page
|     counting by accessing the systemdict showpage operator directly).
|
| (2) is even easier: Preload pstoppm.ps (supplied with the GS
|     distribution), generate a 1-bit PPM file from the PS file, then
|     run ppmhist on it and estimate toner usage from the luminosity
|     histogram it spits out.
|
| Has anyone actually tried to implement these?

Mark Bartelt                                                416/978-5619
Canadian Institute for                             mark@cita.toronto.edu
Theoretical Astrophysics                           mark@cita.utoronto.ca

"Clothes not busy being worn are busy drying."  -  Dylan, on laundry day
Technical Details
Message-ID: <BruBBu.EKt@helios.physics.utoronto.ca>
Path: arc1-ca.pugleaf.net!sparky!uunet!utcsri!helios.physics.utoronto.ca!sysmark
References: <ROBERTS.92Jul15122728@dyall.admin.ists.ca> <ROBERTS.92Jul18232547@dyall.admin.ists.ca>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.postscript
Path: arc1-ca.pugleaf.net!sparky!uunet!utcsri!helios.physics.utoronto.ca!sysmark
From: sysmark@helios.physics.utoronto.ca (Mark Bartelt)
Subject: Re: Page counting software
Message-ID: <BruBBu.EKt@helios.physics.utoronto.ca>
Sender: news@helios.physics.utoronto.ca (News Administrator)
Reply-To: mark@cita.toronto.edu
Organization: University of Toronto Physics/Astronomy/CITA
References: <ROBERTS.92Jul15122728@dyall.admin.ists.ca> <ROBERTS.92Jul18232547@dyall.admin.ists.ca>
Date: Thu, 23 Jul 1992 11:45:29 GMT
Lines: 57