[mod.computers.vax] Page Accounting for Postscript devices

cel@CITHEX.CALTECH.EDU (Chuck Lane) (01/22/87)

>From:       AB Stine  <ABSTINE%CLVMS.BITNET@WISCVM.WISC.EDU>
>
>I am in the process of adding a QMS PS800+ to our system. I want to be
>able to do accurate page accounting and the # of Postscript records sent
>to the printer has very little bearing on how much output will be delivered.
>
I will assume that your QMS engine is similar to an Apple Laserwriter
PostScript engine.  There are a couple of things that could be different
and still be standard PostScript (which I'll note).

The symbiont or device driver should be catching messages coming back from
the laserprinter which are normally in a standard form (this is for Apple
laserwriters, but I suspect other PS engines are similar):

%%[key1: value1; key2: value2 ... keyn: valuen]%%

If you put the following definition in the PostScript power-on file (I'll
put the skeleton of such a file...the exact means of escaping save/restore
contexts is device dependent)


serverdict begin    % use serverdict dictionary
00000000            % default password
exitserver          % escape save/restore context (make global changes)

\PrintPageCount {
save                                  % save current context
serverdict begin pagecount end        % get total pages printed by printer
10 10 string cvrs                     % make # into a string
(%%[PageCount: ) print print          % print out pagecount message
(]%%\n) print flush                   % finish it off
restore                               % restore context
} def                                 % make it a definition


% other setup, loading fonts, etc.

^D   %eof

Okay, the stuff to escape save/restore context (allows global definitions)
is Apple specific, as are "serverdict" and "pagecount".  I'm pretty sure
that "serverdict" and "pagecount" will work on your QMS too,  and
maybe the header will too.  The rest is standard PostScript.

Before printing anything send a command:

    PrintPageCount
    ^D

which will give the # of pages printed at initialization (pagecount is
a `lifetime total' kept in EEROM) and then put a PrintPageCount on the
end of each file, or better yet:

users file .... lots of stuff...
^D
PrintPageCount
^D

which keeps it completely separate from the file being printed.  Your
symbiont will have to keep track of the messages coming back and take
differences of pagecounts to arrive at page accounting figures.

There are other ways of extracting page counts from the files, but since
PostScript is a programming language it's possible to make the paging
logic very convoluted, and it sometimes gets that way.  The pagecount
kept in the printer however isn't user alterable (except by printing a
page :-) ) and not subject to such problems.

            --Chuck Lane
                cel@cithex.hepnet  .span  .bitnet  .Caltech.Edu
                cel@cit-hex.arpa