PDA

View Full Version : Is it possible to send RAW data to a printer?



N3wb
28th September 2012, 22:05
I need to send RAW data to a printer (i.e. unrendered text, I just want all the bytes sent as they appear in my file) and am wondering if there is a way to do this in Qt? I've briefly looked at the QPrinter class, but I'm not sure if it can send RAW data because of this post: http://stackoverflow.com/questions/5558248/qt-print-raw-text

Does anyone know of a way to do this with Qt/C++?

ChrisW67
1st October 2012, 02:28
QPrinter is a QPainter abstraction for the printer sitting on top of the operating system driver. You want to completely bypass the QPainter abstraction and operating system print driver processing (if any) and go straight to the hardware. You can do that any way your operating system and printer driver will allow using C++.

Assuming Windows: you want the OpenPrinter, ClosePrinter, StartDocPrinter, StartPagePrinter, WritePrinter, EndPagePrinter, EndDocPrinter, ClosePrinter Windows API calls (probably in close to that order). http://support.microsoft.com/kb/138594