views:

290

answers:

2

Hi,

I need to print a receipt from my web based apps using dot matrix printer epson tm-u220d (pos printer).

I need to know, should I generate the receipt in html or in plain text ?

I ever saw some commands for dot matrix printer to change the font size, line feed etc .. but I don't remember that commands. if I have to use plain text I need to use that commands. anyone knows where i can get the references ?

Thanks

+2  A: 

There is a very good chance that these printers support Esc/P2 which was the Escape codes required to do some formatting on the printer...Here's a link to the RawPrinterHelper...

How are you connected to the printer? Parallel, USB, You may need to add a generic text print driver to allow the means of writing raw escape code sequences to be sent to the printer...for an example, here's an example code that needs to be sent to the printer, depending on how you implement this, to give additional flexibility, the class could parse for simple html codes and re-interpret them as Esc/P2 codes

This will be printed in bold
            |
            V
0x1b0x69This will be printed in bold0x1b0x70

0x1b is Escape, 0x69 is E (Turns on Bold) 0x1b ' " , 0x70 is F (Turns off Bold)

tommieb75
+1  A: 

it appears this print has a windows driver: http://www.posguys.com/12_12/Epson-TM-U220_502/

if that is the case, then you can try to print via html. if that doesn't work and you have the ability to create pdf's, you can print the pdf to the windows driver and you should be set. most pdf generation libraries permit changing the size of the paper, so with some experimentation you can probably make it work. I actually have a web app that does this ... it generates a pdf sized for the printer and the user prints to a label printer from acrobat.

best regards, don

Don Dickinson