[Ilugc] lpr print pages accounting

  • From: vcs@xxxxxxxxxxxxxxxxxxxxx (V C Srivathsan)
  • Date: Fri, 6 Sep 2002 00:11:54 +0530 (IST)

Yes, you are right. A little bit of looking around revealed that it is
really easy to get the number of pages in a .ps file. Before each page,
there is an entry of the type:

%% Page: <visiblenumberofthispage> <totalpagecount>

grepping for this entry and taking the last entry's <totalpagecount>
basically gives the total number of pages in that ps file! A simple filter
bfore lpr would be enough for counting no of pages in .ps files.

ASCII is very tricky. One cannot know the no of pages bfore it runs thru
the lp filter. So, we have to parse the lp output, look for the number of
form feeds. A count of the form feeds in gives the no of pages. then, this
has to be redirected to the printer!

-Srivathsan

 On Thu, 5 Sep 2002, P. Sriram wrote:

On Thu, 5 Sep 2002, V C Srivathsan wrote:
I am looking around for some tools...if not available planning to write
one myself. Looks like ASCII pages can be easily accounted for..it becomes
tricky when we have to count the pages printed off .ps files. Probably we

hi,

i thought the reverse would be true. ps files will have the begin page, 
end page and show page lines and i thought a script could easily look for 
these and count out the pages...

sriram



Other related posts: