I need to apply some modifications (mostly replace some text a la s/foo/bar/
) to everything that gets printed from a specific Windows application. My guess is that most of the building blocks that can be used for this are already available somewhere. My idea is to proceed as follows:
- A (fake) network printer is advertized (e.g. from a Linux host)
- Instead of printing, the communication (in PostScript, say) gets intercepted
- Things like compression get undone, the result is fed to ...
- ... a script I write that performs the needed text substitutions
- The resulting postscript is transmitted to the real printer
Is my idea feasible? And am I right that everything except step 4 should be available from basic tools? If so, could someone shed some lights on how I could really do this? I know too little about the internals of Windows/Linux network printing, CUPS and Samba and whatnot to feel confident how to proceed ...