I'm looking at designing an application to run on POS terminals in addition to the software already installed. I'd like it to receive POS printer commands and then on some of them intercept and modify them. So for example when a receipt is printed, we'd like to add a custom reference number in the middle of it without having to modify the third party POS applications.
I'd love to hear peoples suggestions on the best way to approach this as reading through the POS specs, it doesn't seem trivial.
I think the solution will be to do this outside of the POS app, but communicate on a level that it understands, print. A solution that looks like a printer to capture the data, reformat, and then send on would do the trick or something that interfaces with the OS (let's say Windows) at a printer port level.
In Windows we use a custom port monitor we created to caputre and route this data, it's something we use internally so I wouldn't suggest it for you as it has some bugs. A similar solution is RedMon. This could provide the solution or provide you ideas on how to accomplish it. Once the data is captured you launch a process against it.
An alternative is to it's over the network you can always setup something that montiors 9100 (RAW) or 515 (LPR) to intercept the data.
Lastly, if it's Windows and you don't want to create something as low-level as RedMon you can always use named pipes. You'd run a service application that would be montioring a named pipe. Your printer from the POS would have it's port set to 'local' and the port would be \.\pipe\. The would allow the application to driectly communicate with your service and thus launch a process.
You could have multiple named pipe/Redmon/network ports setup each with a unique assocated output to direct to the correct device on the other side.