Thanks to everyone's help, but I've figured out the backend stuff and written my own perl script that does the accounting using mysql. It's actually really neat and incredibly easy to use. I'm in the process of refinining it a bit now and if anyone is interested in it, I'd be more than happy to send it your way. It uses snmp to query the pages from the printer so it actually determines the number of pages printer and not just how many should have printed. Chuck On Tue, 29 Mar 2005 19:46:57 -0500, Robert L Krawitz <rlk@alum.mit.edu> wrote:
Date: Tue, 29 Mar 2005 16:26:46 -0500 From: "John Stoffel" <john@stoffel.org>
Chuck> This is a question for those cups guru's out there. I'm Chuck> trying to write a custom perl script for cups that does Chuck> accounting. I have a database with users and quotas and I'm Chuck> writing a filter for cups that checks to make sure the user Chuck> has enough left on their balance before printing. I was Chuck> curious how I would go about sticking this into the cups Chuck> filtering chain. I've been reading up on the cups docs but Chuck> I'm still kinda confused on where to put it. Any help would Chuck> be much appreciated.
How are you going to count pages before you send them to the printer?
That was always the problem we had, esp when someone messed up and sent garbage to the laser printer at $0.10/page way back in the late 80s, and then came up to find a 1" thick stack waiting for them... with just one letter per page
Or are you going to pre-render, count the pages, then get the page counter on the printer, print, and read the page counter to see what actually got through?
I'd also google, since I can't imagine that you're the only one who's wanted something like this before...
I'd try the cups-devel@cups.org mailing list (you may need to subscribe).
This is actually a very hard problem if you don't have a printer that will do the accounting itself. Unless you can interpret the codes going to the printer, you can't even start to do this.
-- Robert Krawitz <rlk@alum.mit.edu>
Tall Clubs International -- http://www.tall.org/ or 1-888-IM-TALL-2 Member of the League for Programming Freedom -- mail lpf@uunet.uu.net Project lead for Gimp Print -- http://gimp-print.sourceforge.net
"Linux doesn't dictate how I work, I dictate how Linux works." --Eric Crampton
-- Chuck Haines chaines@gmail.com http://www.maxslack.com ------------------------------------------- Tau Kappa Epsilon Fraternity TKE-ZM Web Coordinator ECE Systems Administrator ------------------------------------------- AIM: CyberGrex YIM: CyberGrex_27 ICQ: 3707881 ------------------------------------------- GPG Fingerprint: 303A AB50 4EA9 70ED 2E30 2368 C9CD CCB5 4BD7 0989 GPG Key: http://www.maxslack.com/gpgkey.txt