Feed paper on POS Printer C#
Asked Answered
M

4

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?

Modicum answered 16/10, 2008 at 4:30 Comment(2)
I did too but now I realize he means Point Of Sale.Roll
You can download the TM-T88III series specification, which lists some of the ESC/POS commands. jarltech.com/ger_new/new/support/cd/TM-T88III_spc_e.pdfUnger
U
3

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: https://web.archive.org/web/20111229102746/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

Ulmaceous answered 16/10, 2008 at 6:24 Comment(0)
N
0

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.

Necrophilism answered 16/10, 2008 at 5:27 Comment(0)
E
0

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.

Eichmann answered 16/10, 2008 at 6:55 Comment(2)
Please read the FAQ for ESC/POS, the correct command is Line Feed (hex 0A, decimal 10).Ulmaceous
I see your point, alexandrul. I took the original poster to be asking for a form feed, whereas he just says, "feed."Necrophilism
P
0

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.

Postexilian answered 17/10, 2008 at 10:48 Comment(4)
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.Ulmaceous
In the Epson EScPOS dcoumentation there is GS V command that will feed and cut the paper at the correct point.Postexilian
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.Ulmaceous
You are correct about the lack of cutter on U220D - my mistakePostexilian

© 2022 - 2024 — McMap. All rights reserved.