I've never dealt programmatically with what you're asking, but I do have some experience when it comes to POS systems which may help you.
What you do for printing and for the cash drawer are highly dependent on the hardware you're working with. And there is a wide variety of hardware out there.
In every POS system I've seen, there are multitudes of drivers for every conceivable receipt printer and cash drawer, so unless you're developing a full-blown system, just concentrate on the specific hardware you're going to be working with. Even then, try to factor your code well so that you maximize the benefit of the strategy pattern. If you're working with more than one type of device, you'll thank yourself later for implementing it that way.
For printing, there are 3 fundamental types of printers you may encounter:
- Receipt printer that can only print text (antiquated, but still around)
- Receipt printer that can print graphics
- A standard printer printing 8.5" x 11" full-page invoices/credit memos (easy, 'nuff said)
I believe most, if not all, modern receipt printers fall into category #2, but you could run into a legacy system using a printer from category #1.
For category #2, you should be able to use the standard .NET printing interface. The only issue may be sending a control code to activate the cutting mechanism (if equipped) at the appropriate time(s); or, the printer driver may do it automatically based on the paper length specified in the printing algorithm. Again, I've never tried this, but if you have access to a receipt printer, you should be able to figure this stuff out in a hurry.
If you're dealing with a single client who has a printer in category #1, you can make a good argument that it will be less expensive to buy a new printer in category #2 than it will be to pay you to develop a dead-end driver to print on their existing hardware.
For cash drawers, I'm less familiar than with printers, but I know of two options as far as communication and hardware arrangement:
- Attaches via LPT port through the printer. (Cable chain: computer --> printer --> cash drawer)
- Attached directly to the computer, either by a COM/LPT port or probably USB in a modern one.
The first kind operates by sending control codes to the printer port (which the printer would hopefully ignore and not spit out an entire roll of receipt paper), while for the second you'll need to do the COM port communication stuff. In either case, the control codes are hardware-dependent. Most of the time they're found in the user manual, but sometimes the technical writer was feeling particularly evil that day, and you'll have to go digging online.