I have an issue where I need to, in real-time, detect print jobs over a certain size. The reason is that we have a virtual printer that passes a document to a processing program that takes the document and emails/faxes it to customers. Occasionally a user messes up, uses the wrong parameters to generate the report document that goes to this virtual printer. Needless to say, it confuses the customer when they receive an invoice that is almost 3 years old.
However, I know I can proactively stop this, or atleast the worst offenses, if I can find a way to detect jobs over about 256KB, pause those jobs, and then alert me of the paused job. As most jobs are under 100KB, I figure 256KB is a safe limit. However, I need it to be flexible in case this is actually too low.
I don't care if I have to do a custom script to do this or buy software. I just want it to that when a job is accepted into queue, it will auto-pause if over the size restriction. The job is relayed from a CUPS server, and I have already written a script that an do this, but since it relies on polling the server, there is still a reasonable chance the "too large" job gets thru between pollings.
Any guidance is much appreciated.