The other day I was working on some sample code using Pos .Net to print to a receipt printer. Try as I might, I could not get the code to print my text regardless of whether I used my Epson TM-T88IV or my TPG printer. My production code worked fine, but not the sample and I was stumped as to why.
Reading the Pos .Net SDK documentation I noticed it had several references to the way carriage return and line feed characters are processed and that sending one or the other would cause all previously buffered data to be printed. Nowhere did it say, however, that you must send one of the characters to get your text to print even though it turns out that including a \r\n on the end of my print data solved my problem.
I would have thought that if neither character was supplied the service object would print any buffered data when the PrintNormal method returned (except in Transactional printing mode), or at the very least when the Release() method was called. Since you can’t possibly print anything else after that without another call to the Claim method, it seems pretty obvious you’d want any previously buffered data printed before you finished with the printer. Flushing the buffer when Release is called would be good and expected behaviour, at least to my way of thinking. But apparently not.
So, the moral of the store is that if you’re printing with Pos .Net, but nothing is coming out of the printer and you’re not getting any errors, make sure you have a line feed somewhere in your print string (presumably at the end).
Something else that concerned me in the documentation for the Print Normal method was the part that talks about using the ValidateData method to determine if and how carriage return characters are processed. You just can’t take anything for granted.