views:

4763

answers:

6

I've been trying to programatically feed the paper on a pos printer (Epson TM-U220D). The problem I have is that the last line of the document don't get printed, instead, it is printed as the first line of the next document printed. I tried POS for .NET sending the "ESC|flF" command, also tried to send the raw esc/pos command using the serial port, but it doesn't work. Any ideas?

A: 

If the printer is on LPT1, shell out to DOS and give to CMD.EXE or COMMAND.COM whatever the C# equivalent is of this BASIC expression:

"ECHO " & Chr(12) & ">LPT1"

Either that or append a Chr(12) to the output text.

boost
+3  A: 

You will need sooner or later the full ESC/POS Application Programming Guide. I did obtained a copy from my EPSON dealer some years ago. In the meantime, I have found with Google a link to the FAQ for ESC/POS here: http://postechgroup.com/updata/support/drivers/EPSON/FAQ_ESCPOS.pdf

In your case, the LF control command prints the data in the print buffer and feeds one line based on the current line spacing.

ASCII: LF

Hex: 0A

Decimal: 10

alexandrul
A: 

As boost says, you need to get a form-feed / FF / ascii 12 to the printer port. In C or C++, if you opened your printer as a file, this would be

fprintf(printerfile,"%c",12);

The issue sometimes arises on these printers that the output buffer is not actually processed / flushed until a carriage return is written. You might also manually flush the stream. So you would then use

fprintf(printerfile,"%c%c",12,13);
fflush(printerfile);

An easy mistake to make when outputting to devices such as serial printers is that the communications and printing happen asynchronously to your main application. Thus it is important not to close the printer port immediately after you finish printing as this can cause loss or corruption of the final output buffer.

(Sorry this is C rather than .NET, I'm one of those C++ old-timers that hasn't moved over)

Edit: Reading alexandruls comments on my post, I my well have got this wrong. It sounds as if you might be getting an unwanted form feed becuase you have set the page length incorrectly, or the default is incorrect. Check the ESC C n group of Epson commmands to overcome this.

Shane MacLaughlin
Please read the FAQ for ESC/POS, the correct command is Line Feed (hex 0A, decimal 10).
alexandrul
I see your point, alexandrul. I took the original poster to be asking for a form feed, whereas he just says, "feed."
boost
A: 

Are you cutting the paper? If you are cutting the paper the position of the cutter is higher than the print head. You therefore need to feed a number of lines before the cut command is sent. You should just be able to format a string with say 5 line feeds (LF -> Chr(10)), send them, and then send the cut command.

In the Epson EScPOS dcoumentation there is GS V command that will feed and cut the paper at the correct point.

JDibble
In this case it would be more than one line missing from the receipt, since it is very unusual to leave 4 empty lines before the last line.
alexandrul
In the Epson EScPOS dcoumentation there is GS V command that will feed and cut the paper at the correct point.
JDibble
You are correct, but the original question didn't mention any space between last line of the receipt and the content of the next receipt. Also, the TM-U220D model doesn't have a cutter.
alexandrul
You are correct about the lack of cutter on U220D - my mistake
JDibble
A: 

Hi evargas,

I'm stuck with the Epson POS tm-u220 printer and I cannot even print a single line on the printer. Can you please send me some of your C# codes to print the values on the printer. this POS printer giving me a headache.

I really appreciate if you have the code to open the cashdrawer also. it is connected with RJ11 cable to the printer. and my printer is on USB port.

Thanks in advance. Geeshan.

A: 

Hi,

I seem to have a similar problem with my printer as it is not recognized at all. it is connected by as serial cable to a serial port. I am a total newbie as far as this goes thus would appreciate if someone could help me get this set up and running. the model says: olivetti PR4RI S/N: 02260020 P/L: 0502442 but i haven't been able to find this model or its drivers anywhere . all help is appreciated. thanks in advance.

centaur31