[Qt-interest] Printing to POS printers

Zeljko zeljko at holobit.net
Fri Jul 15 08:16:01 CEST 2011


Oluwafemi A wrote:

> Hello, I'm trying to generate POS receipts from an application I'm
> developing............are there are any specific ways to go about this using
> the Qt print-related classes (QTextDoc, QPainter etc). Thanks

You don't need QPainter & QTextDoc if you send Esc/Pos commands to POS printer.
eg. I've created an set of pos drivers for various printers (manufacturers) ... 
eg Samsung, IBM, Epson etc ... (each have it's own differences, doesn't speak 
standard EP lang ...) so:
1.Each driver have it's own set of commands for eg. small letters, bold letters, 
cut paper etc...
2.Collect commands and data to be printed into QStringList
3.Save complete QStringList into temp file
4.Call command which sends that to choosed pos printer. eg under linux/MacOSX 
 "lpr -PMYPosPrinter TempFileWhereISavedWhatTobePrinted.txt"  ,
  under win32 you have to use Raw printer to send data to printer, but it also 
work. Under linux/Mac such printer should be installed as "Raw printer queue", 
so no filters etc ... printer is completely under your control.

Also, some POS printers supports postscript so you can use QPrinter and friends, 
but some not , so if you need unique support Esc/Pos way to go.

zeljko




More information about the Qt-interest-old mailing list