Run command before and after printing with CUPS? [closed]
Solution 1:
My suggestion is to use tea4cups.
tea4cups serves as a generic wrapper around any standard CUPS backend. It allows you to configure any command to run before and after sending the job off via the real backend.
tea4cups specifically allows (any number of) commands to be run before the job is sent off: prehooks
. A prehook command which exits -1
can cancel the job.
tea4cups also allows (any number of) commands to be run after the job is sent off: posthooks
(unless a prehook with exit -1 cancelled the job).
Prehooks can send data to the posthooks through pipes.
tea4cups can also run filters
(which may modify the print data before sending them off to the real printer through the real backend).
From now on, only your own creativity is a limit to what you can do with this framework.