Printing receipts on EPSON POS (USB)

Hi there,

I need to print receipts on an EPSON TM-T88V (POS printer), connected to USB.
The printer is defined in macOS and has a valid driver.
I can print using classic printing Xojo functions (pinter setup, graphics, drawtext …) but a receipt with 5 text lines takes about 4 sec to print. Looks like it’s printing in graphic mode.
It’s way too long.
With another POS software the receipt is printed sub-second, same system, same printer, same driver…

I’m wondering if using Epson ESC/POS commands would improve that, but how can I do that ?
Sending ESC commands using graphics.drawtext doesn’t seems to work.

Does anyone have an idea or a solution for this ?

MBS solution is fine.

Thanks !

you should send ESC commands using the serial.write command.
after selecting the right serial port of course.

Hi Jean-Yves,

Thanks.
But the printer is not a serial printer with a serial to usb adapter, the printer is connected with USB only.
There is a serial port on the printer, but it’s not used.
How do I get the serial port ?

Is there a way to print to the URI ?

This is the printer config (french):

EPSON TM-T88V :

  État :	Inactif
  Serveur d’impression :	Local
  Version du gestionnaire :	1.2
  Par défaut :	Non
  Partage d’imprimantes système :	Oui
  Partagé :	Non
  URI :	usb://EPSON/TM-T88V?serial=405139460116160000
  PPD :	EPSON TM-T88V
  Version du fichier PPD :	1.2
  Version PostScript :	(3010.000) 0
  Version CUPS :	2.3.1 (cups-483.8)
  Assistance numérisation :	Non
  Commandes de l’imprimante :	none 

We have a CUPSMBS module in our plugins, which can send esc data to printer directly. I used it for an usb bon Printer. See CUPS functions.

If the printer has a serial port, maybe you can buy a Serial To USB and send the commands with the SerialController in Xojo.

Hi Christian,

Thanks.

It seems the easiest way to go.
Just need to learn ESC commands and CUPS options now.

As most of the time, the solution comes from MBS…

Regards,

Olivier

1 Like

Hi Ivan,

Thanks. I have other devices using usb/serial adapters (weight scales), and I know it works, but I can’t force my customers to buy adapters as their actual POS software prints easily on this printer.

I’ll try the MBS CUPS route.

Thanks anyway.

Olivier

Good point :sweat_smile: For windows there is a code here in the forum to send the RAW data using declares.

We also made WindowsAddPrintJobMBS for MBS Xojo Win Plugin.

Shout if you get stuck with that. I used to love messing about with these.
At heart, and ESC command is
chrb(27) followed by one or more other characters

If all you want is text, you will probably get away with

reset
Line feed
Set text to 12cpi or 17 cpi

But graphics are possible too.

here is a good summary:
http://www.lprng.com/RESOURCES/EPSON/epson.htm

Hi Jeff,

Thanks.
I can now print all kind of texts, set alignments, character sizes, etc. But I’m stuck trying to print picture files (png/jpeg) using ESC/POS.
See my other post https://forum.xojo.com/t/printing-png-file-using-epson-esc-pos/67476 in General forum.

Hope you have an idea :wink:

Regards,

Straight in at the deep end. :slight_smile:

Doing that in ESC commands means essentially creating your own graphics printer driver.
The printer will work in either 9 pin or 24 pin emulation: probably 9 pin
In 9 pin mode,you can print columns of 8 pixels as a stream of bytes.
The pixels are represented as bits in the bytes.
So if you are familiar with bits, a letter A looks like this:

000XX000
00X00X00
00X00X00
00XXXX00
00X00X00
00X00X00
00X00X00
00000000

and you print that by sending the bytes that represent the first column, then the next then the next

Your original picture will be in color.
The printer is likely to be black and white only.
The small size means a huge loss of detail too.

So unless you fancy using some library to reduce the image to black and white dithered, at a tiny size, you are really better off going back to using a ‘normal’ printer driver already written for you, and living with the speed.

You did start by suggesting you only needed simple text and wondering why it was slow.

but a receipt with 5 text lines takes about 4 sec to print. Looks like it’s printing in graphic mode. It’s way too long.

A picture isnt ‘5 text lines’ :slight_smile:
Simple text is fast because the printer uses font shapes already in memory- it doesnt need you to send the bitmaps to it.

Hi Jeff,

Thanks for this long answer.
I understand what you say but I think (hope) there’s an easier way.
My customer has a POS software running on macOS where they can just select any kind of picture (png, jpeg), select scale to fit or real size, and this image is printed on the receipt. Real, I mean real fast, about a sec.

When I print everything (but the picture) using ESC/POS commands, my ticket is printed in less than a second.

I found functions here and here in C# converting a bitmap file to ESC data, I’ll see if I can convert it to Xojo.

Hello Jeff, by any chance do you have a small example on printing any graphics using ESC/POS ?

Thanks

Offhand, no… the last time I wrote code to do this was about 30 years ago.
If I was doing this myself today, I’d start with this information: