Automated accounting of pages printed to PostScript printers

Automated accounting of pages printed to PostScript printers

Post by Carl Krasn » Sat, 21 Nov 1992 03:41:46



As many followers of this group have asked for before, we require software
to automatically perform accounting of pages printed to a PostScript
printer. It could be as simple as a running tally of pages printed for
each user ID on a system.

Does anyone know of such a product, preferrably a solid, commercial-quality
product? I realize there may be a hardware requirement as well such as a
bi-directional printer interface to allow reading the printer's page count.

This is an important requirement for many sites. Please note that there is
a significant market for such a product if it is effective and robust.

--
===============================================================================
Carl Krasnor, Communications Research Lab, McMaster U., Hamilton, Ont. CANADA

===============================================================================

 
 
 

Automated accounting of pages printed to PostScript printers

Post by Merl » Sat, 21 Nov 1992 05:26:48


I have a Sun SPARCstation.
NIS works on it but DNS does not.
Any names which are in my /etc/hosts table are resolved properly, unfortunately
any names not in the table cannot be found by my system.

I'm tired of using IP addresses - please help me to get DNS working.
When I use nslookup, the correct server is identified and an IP
address is returned (non-authoritatively) for any host name I type.

I do have the resolv.conf file set up to the correct server.

A second problem I have is that I can ftp out of my system but I cannot
ftp into my system from another host.  I get a 'user access denied' after
I (or anyone else) types in the correct login.

Ftp used to work but not any more!

Can anyone help.
Much gratitude...

 
 
 

Automated accounting of pages printed to PostScript printers

Post by Dave Broo » Sun, 22 Nov 1992 03:00:40


|> A second problem I have is that I can ftp out of my system but I cannot
|> ftp into my system from another host.  I get a 'user access denied' after
|> I (or anyone else) types in the correct login.

Don't know too much about your first problem (DNS), but if your shell is ksh
you need an /etc/shells on the host you are trying to ftp to that has the
location of where ksh is (/usr/bin/ksh or whatever).  ftp can find sh and
csh but doesn't even attempt to look for ksh.

See SunSolve Symptoms and Resolutions DB ID #2088 for full details.

If you are not using ksh, then I don't know...

Dave Brooks

 
 
 

Automated accounting of pages printed to PostScript printers

Post by Philippe Gouja » Tue, 24 Nov 1992 08:14:38


: As many followers of this group have asked for before, we require software
: to automatically perform accounting of pages printed to a PostScript
: printer. It could be as simple as a running tally of pages printed for
: each user ID on a system.
:

My notion of postscript may be a little bit rusty but if I remember
correctly only the "showpage" command in postscript actually prints a page.
You can send 500kb of graphic information but only when receiving the
showpage your page will be printed (and if the printer receives an
end-of-job (Ctrl D) before the showpage all the work is discarded).

So, working on that assumption can a simple "grep showpage | wc -l" sort of
script do the trick?

--

       Infocom : Public Usenet access in the UK - (0734) 34 00 55

 
 
 

Automated accounting of pages printed to PostScript printers

Post by Tim Pier » Tue, 24 Nov 1992 11:28:47




>: As many followers of this group have asked for before, we require software
>: to automatically perform accounting of pages printed to a PostScript
>: printer. It could be as simple as a running tally of pages printed for
>: each user ID on a system.

>... can a simple "grep showpage | wc -l" sort of
>script do the trick?

No; a PostScript document can have several "showpage" commands on a
line.  At the very least, you'd need some script to break the document
up into tokens, but even then, you wouldn't get around sneaky users
who might plug a "/foobar { showpage } def" into the beginning of
their document and then use "foobar" instead of "showpage."

I think almost certainly you'd want something much more low-level
than this.

--
____ Tim Pierce                /


 
 
 

Automated accounting of pages printed to PostScript printers

Post by Ade Bark » Tue, 24 Nov 1992 15:56:43



:
: >
: >: As many followers of this group have asked for before, we require software
: >: to automatically perform accounting of pages printed to a PostScript
: >: printer. It could be as simple as a running tally of pages printed for
: >: each user ID on a system.
: >
: >... can a simple "grep showpage | wc -l" sort of
: >script do the trick?
:
: No; a PostScript document can have several "showpage" commands on a
: line.  At the very least, you'd need some script to break the document
: up into tokens, but even then, you wouldn't get around sneaky users
: who might plug a "/foobar { showpage } def" into the beginning of
: their document and then use "foobar" instead of "showpage."

Another problem in using this method for accounting (as I understand
the original poster wanted to do) is when the user cancels the job
after submitting it. The above method calculates how many pages
are _supposed_ to be printed, not how many pages are actually printed.

Like the previous poster pointed out, the answer may be more lower-
level. It might also very much depend on the printer, physical
printer interface, and what current LP Print Service is being used.
Perhaps the original poster could be more specific re: his/her
equipment ?

-Ade.
--

CompuServe: 74160,3404

 
 
 

Automated accounting of pages printed to PostScript printers

Post by Carl Krasn » Wed, 25 Nov 1992 23:47:21


Most PostScript output seems to have lots of macro definitions and 'showpage'
is usually in one. Furthermore the page count setting can vary the number of
pages which a showpage prints. It seems that the only way to reliably count
printed pages from the PostScript code alone is to use a full PostScript
interpreter!

However, the robust way to implement printer accounting is to utilize the
printer's internal page counter. With bi-directional communication, it is
practical to query the printer's page counter before and after each job and
get a bulletproof count of pages ejected during the job. I believe there are
commercial (or equivalent quality PD) packages which can perform this function
with properly capable printers.

I understand that some sites have implemented magnetic card systems for
printing but I consider this to be a highly undesireable solution. It should
not be necessary for a user to be authorized further after sucessfully
completing a login and when the network printer is not right beside the user,
the card access can be impractical. Why not just have the system tally
printed pages by user ID?

So what I would like to locate is a ready-to-use implementation of such a
system.

--
===============================================================================
Carl Krasnor, Communications Research Lab, McMaster U., Hamilton, Ont. CANADA

===============================================================================

 
 
 

Automated accounting of pages printed to PostScript printers

Post by Gordon Wats » Wed, 25 Nov 1992 18:11:47



>: As many followers of this group have asked for before, we require software
>: to automatically perform accounting of pages printed to a PostScript
>: printer. It could be as simple as a running tally of pages printed for
>: each user ID on a system.

>... can a simple "grep showpage | wc -l" sort of
>script do the trick?

The proper way to do it is to get the PostScript interpreter in the
printer to tell you the answer. The PostScript command "pagecount"
returns the number of pages that the printer has ever printed. So,
write a filter that uses this command both before and after the job,
subtract the two numbers and you have a reliable result. That's what
we do.

--
Gordon Watson
 UNIX Systems Manager
  Department of Computer Science
   University of Exeter

 
 
 

Automated accounting of pages printed to PostScript printers

Post by Roland Y » Thu, 26 Nov 1992 14:13:20


:
:
:
: I have a Sun SPARCstation.
: NIS works on it but DNS does not.
: Any names which are in my /etc/hosts table are resolved properly, unfortunately
: any names not in the table cannot be found by my system.
:
: I'm tired of using IP addresses - please help me to get DNS working.
: When I use nslookup, the correct server is identified and an IP
: address is returned (non-authoritatively) for any host name I type.
:
: I do have the resolv.conf file set up to the correct server.
:
: A second problem I have is that I can ftp out of my system but I cannot
: ftp into my system from another host.  I get a 'user access denied' after
: I (or anyone else) types in the correct login.
:
: Ftp used to work but not any more!
:
: Can anyone help.
: Much gratitude...

I was facing the same problem, when I came across this faq.

roland

Last Updated: 22th October 1992
------------------------------------------------------------------
DNS-no-NIS : How to get most SunOS commands to use DNS without NIS
------------------------------------------------------------------

This recipe is based on a version by Greg Earle, dated 25 Apr 90
Thanks to Steinar Haug for pointing out some bugs.

Background blurb:
-----------------
The Sun supported way of using DNS is through NIS. Please refer to the
System & Network Administration manual if you want to use NIS. This FAQ
offers no help in that respect.

However, many people want to use resolver-based lookups without having to
run NIS. A simple way to do this is by using a version of the libc.so
shared C library with the gethostbyname()/gethostbyaddr() routines replaced
by the equivalent functions from the BIND nameserver distribution's resolver
library.

For SunOS 4.0.x Sun created 'libc_resolv.so' versions. These were made
available via anonymous FTP. Try anonymous ftp to 'ftp.uu.net' and look
in directory '/systems/sun/sun-fixes'.

For SunOS 4.1.x you'll have to build custom shared libraries. To be able
to do this you need the Shlib Custom option installed. This software
will be installed in the '/usr/lib/shlib.etc' directory. You'll find a
README file containing instructions in this directory. You may want to
read it...

Fortunately, the /usr/lib/libresolv.a library has been compiled with
the '-pic' option, producing position-independant code. Thus you can
use this library when you create your DNS-version of 'libc.so'.

You may want to use an alternative implementation of the resolver
library there is one written by Bill Wisner (at present visiting

It's archived at a number of sites, use archie to find a host in
your area. The package is usually stored as `resolv+-2.0.tar.Z'.
There's a preliminary release of version 2.1 around as well.

You'll find more information about position-indipendant code and shared
libraries in the Programming Utilities and Libraries manual. You should,
however, be able to create the 'libc.so' library without reading manuals.

Note that you'll have to substitute a few file names if you're making a
system 5 libc.

Note that installing a new shared library will not alter the way
statically linked commands work. Try 'mount' and you'll see what
I mean. Don't ask me for a patch. Look in the Programming Utilities
and Libraries manual for a list of all the statically linked commands.

And, finally, no - I haven't tested this procedure using all combinations
of patches and SunOS 4.1.x versions. It should work on vanilla 4.1.1 and
4.1.2. The patch-minded person would maybe look at the following patches:

        100170-09 : jumbo patch to fix various ld problems
        100257-04 : jumbo patch for ld.so, ldd and ldconfig
        100266-08 : libc replacement - Domestic Version (US)    (4.1.1)
        100267-08 : libc replacement - International Version    (4.1.1)
        100465-01 : patch for libresolv.a - DNS res_send() bug  (4.1.1;?)
        100531-02 : libc jumbo patch - Domestic Version (US)    (4.1.2)
        100532-02 : libc jumbo patch - International Version    (4.1.2)

(Note - this is not a complete list, and I've only considered 4.1.1 and 4.1.2)


---------------------------------------------------------------------------

0. You must be root to do this.

1. Make a temporary directory if not present, and cd to it
        % mkdir /usr/lib/shlib.etc/tmp
        % cd /usr/lib/shlib.etc/tmp

2. Extract the pic .o from 'libc_pic.a' and '/usr/lib/libresolv.a'.
   Remove the file __.SYMDEF.
   You need to do the 3 'mv' commands bacause 'ar' truncates filenames
   over 16 characters. (Note that the last 'mv' may not be documented in
   your '/usr/lib/shlib.etc/README'. It's a patch.)
        % ar x ../libc_pic.a
        % ar x /usr/lib/libresolv.a
        % rm __.SYMDEF
        % mv rpc_dtablesize. rpc_dtablesize.o
        % mv rpc_commondata. rpc_commondata.o
        % mv xccs.multibyte. xccs.multibyte.o

3. Remove the old routine to do the hostname/addr resolution:
        % rm gethostent.o

4. Remove the libresolv module that contains `strncasecmp' (which is now
    in the main C library, so it is redundant):
        % rm strcasecmp.o

5. You've finished the work in the 'tmp' directory...
        % cd ..

6. The file 'lorder-sparc' in the '/usr/lib/shlib.etc' directory must
   be edited to reflect the changes. Remove the reference to `gethostent.o'
   and add the references to the resolver library routines by applying
   this patch:

        % diff -rc2 lorder-sparc.orig lorder-sparc
        *** lorder-sparc.orig   Thu Jul 30 12:38:58 1992
        --- lorder-sparc        Thu Jul 30 12:41:25 1992
        ***************
        *** 150,154 ****
          getwd.o
          getnetgrent.o
        ! gethostent.o
          ypxdr.o
          ttyname.o
        --- 150,161 ----
          getwd.o
          getnetgrent.o
        ! gethostnamadr.o
        ! sethostent.o
        ! res_query.o
        ! res_mkquery.o
        ! res_send.o
        ! res_debug.o
        ! res_comp.o
        ! res_init.o
          ypxdr.o
          ttyname.o

7. You're SunOS may have this patched, but should check the 'Makefile' for
   the following problem:
        There should be a '-ldl' option in the 'ld' command lines.

8. Now you can make the new shared libary.
        % make libc.so

9. Now you should have some libc.so.x.y.z built in the current directory.
   It is recommended that you tested out this library at this point
   before installing it. You can do so by setting the environment
   LD_LIBRARY_PATH  to the current directory for example:
        % setenv LD_LIBRARY_PATH `pwd`
        % your_favorite_test_cmd
   Once you are satisfied that the new library worked, you can proceed
   to install it with the following commands:
        % cp libc.so.x.y.z /usr/lib
        % unsetenv LD_LIBRARY_PATH
        % cd ..
        % ldconfig

10. You are now running with the new library. You can verify this by
    doing a trace command of let's say "date".
        % trace date
    The output should inform you that the new library is being used.

-------------------------------------------------------------------------
Disclaimer: Neither I nor my employer will take any responsibility if
            this recipe doesn't work.

--
----------------------------------------------------------------
Roland Yeo  Computer Centre Operations Team
Nanyang Technological University  Nanyang Avenue  Singapore 2263

 
 
 

Automated accounting of pages printed to PostScript printers

Post by Yedidya Isra » Wed, 25 Nov 1992 23:46:12





>:

>: >
>: >: As many followers of this group have asked for before, we require software
>: >: to automatically perform accounting of pages printed to a PostScript
>: >: printer. It could be as simple as a running tally of pages printed for
>: >: each user ID on a system.
>: >
>: >... can a simple "grep showpage | wc -l" sort of
>: >script do the trick?
>:
>: No; a PostScript document can have several "showpage" commands on a
>: line.  At the very least, you'd need some script to break the document
>: up into tokens, but even then, you wouldn't get around sneaky users
>: who might plug a "/foobar { showpage } def" into the beginning of
>: their document and then use "foobar" instead of "showpage."

No no, postscript can define macros that will do showpage (as well as
other things) one definition and many calls and grep will count only
one.

Quote:>Another problem in using this method for accounting (as I understand
>the original poster wanted to do) is when the user cancels the job
>after submitting it. The above method calculates how many pages
>are _supposed_ to be printed, not how many pages are actually printed.

>Like the previous poster pointed out, the answer may be more lower-
>level. It might also very much depend on the printer, physical
>printer interface, and what current LP Print Service is being used.
>Perhaps the original poster could be more specific re: his/her
>equipment ?

Indeed.

#include "lprps/README"

This is lprps version 2.3.

lprps is a collection of programs for using lpr with a PostScript
printer connected by a bidirectional serial channel.  It has been
tested mainly with Suns running various versions of SunOS (4.0.3, 4.1
and 4.1.1).  It should be easy to port to other 4.3 BSD based systems.
It is not intended for use with System V.

It contains the following programs:

lprps   handles communication with the printer
psif    allows separate filters to be used for text and PostScript
textps  simple text to PostScript filter
psrev   PostScript page reversal filter
psof    banner filter

The file lpr.diff contains some changes to the version of lpr in the
second Berkeley networking release; lprps does not require these
changes, but will work slightly better with them.

Some features are:

* Deals intelligently with output generated by the printer: printer
  errors (such as ``out of paper'') are logged using syslog; other
  errors and output generated by the user's job are mailed back to the
  user.  Updates status file (displayed by lpq) with printer's current
  status.

* Performs printer accounting.

* Ensures that the printer is ready to receive the job.

* Determines whether file is PostScript or text (by looking at the
  first 2 bytes), and uses the appropriate filter; this is done in
  such a way that you can easily use your favourite text-to-PostScript
  filter.

* Can automatically perform page reversal for the benefit of printers
  that stack face-up.

* Can easily add your own output filters for TeX, troff or any of the
  other formats supported by lpr.

* Page reversal filter supports version 3.0 of Document Structuring
  Conventions.

* Text to PostScript filter supports ISO Latin-1.

* Supports banner printing.

There is no copyright on lprps.

See the file INSTALL for installation information.

Please report any bugs to me.

James Clark

$Id: README,v 1.12 1992/08/14 16:34:21 jjc Exp $

/* end of included file */
--
Israel Yedidya,         Phone:  972-3-5318682 or 972-3-5318407/8
System Administrator,   Fax:    972-3-5353325


Ramat-Gan, ISRAEL.      Uucp:   ...!uunet!pucc.princeton.edu!bimacs!yedidya
If someone proves there is no God, I'll stop being religious!

 
 
 

Automated accounting of pages printed to PostScript printers

Post by Paul Richar » Sat, 28 Nov 1992 03:50:51


|: I have a Sun SPARCstation.
|: NIS works on it but DNS does not.
|: Any names which are in my /etc/hosts table are resolved properly, unfortunately
|: any names not in the table cannot be found by my system.
|:
|: I do have the resolv.conf file set up to the correct server.
|:

Don't know if this is your problem but have you set the -b option in
the NIS makefile:

# Set the following variable to "-b" to have NIS servers use the domain
name
# resolver for hosts not in the current domain.
B=-b
DIR =/var/yp/sources

--
  Paul Richards at Cardiff university, UK.



+++

 
 
 

1. Automated page-counting PostScript printer accounting (again!)

Some weeks ago I posted a request for recommendations on products and
procedures for automated page-oriented printer accounting. The responses I
received were helpful but covered such a scope I realized I had not defined our
needs clearly enough. I am using net resources to deal with this issue again
because many other sysadmins have a similar and unsatisfied requirement.

We have several PostScript printers distributed throughout our building which
are fed from print queues on a Sun IPC which we use as a print server. We
want automated accounting software to keep track of printing by each user
with the following features:

   - Software runs on the IPC and logs to disk the number of pages printed
       by each user on each queue.
   - Page counting must be performed by a robust method such as querying the
       printer's page counter before and after each job.
   - It's OK if the system requires a serial line to the printer for polling
       the page counter but it cannot be required that the print data be sent
       by serial line (too slow!)
   - System must not require magnetic cards or similar ID item. People here
       print from their desks should continue to do so. Besides, they have
       to identify themselves to log in so they are already known to the
       system.
   - The purpose of this product is to bill users for printing services at
       intervals chosen by the system administrator with a minimum of
       additional processing of the information.
   - Product must be a fully professional quality, debugged product.

Any suggestions, product recommendations or commercial contacts would be
greatly appreciated. But please, no more e-mail suggesting that we do a
grep showpage on the PostScript files!! No simple parsing of a PostScript
program will tell you what its output will be any more that you could tell
what a C program will do with a one line grep command!

--
===============================================================================
Carl Krasnor, Communications Research Lab, McMaster U., Hamilton, Ont. CANADA

===============================================================================

2. Unable to tell XF86 which video card to use

3. Printing a pdf file duplex and 4 pages per page to a postscript printer

4. <none>

5. printer printing some blank pages during postscript printing ?

6. How do I change the number of initial rows/columns of an X-term?

7. Help! Printing man page to PostScript printer

8. XServer at StartUp

9. How to print "cat" man pages to postscript printer ?

10. PRINTING POSTSCRIPT TO NON-POSTSCRIPT PRINTER - help...

11. print postscript file to non-postscript printer

12. printing pages account in a remote printer

13. Printing Postscript files on a NON-postscript printer