开发者

Is it possible to print line-by-line on a network usb printer using Qt on windows?

开发者 https://www.devze.com 2023-04-13 00:28 出处:网络
The title says pretty much everything, I have to convert old com/serial-printer-port code to \'new flashy Qt code\' that should work with a network usb printer.

The title says pretty much everything, I have to convert old com/serial-printer-port code to 'new flashy Qt code' that should work with a network usb printer.

I have searched quite a lot and I can't find anything about how to print line-by-line (ie. when I send just one text line to the printer, it shouldn't print a whole page).

Any ideas?

Thanks!

ps. It doesn't have to be Qt (as long as I can wrap it / use it from Qt) but 开发者_JAVA技巧it must be C++ and function on a WinXP.


This page documents the Windows APIs that can be used to send raw data to a printer:

http://msdn.microsoft.com/en-us/library/windows/desktop/dd162959(v=vs.85).aspx

This might be OK if you only want to print simple text.

I don't know of a way to use the drawing capabilities of Windows to print less than a page.


It depends on the printer you have. Forget laser printers and better Ink Jet printers. Best is probably a dot matrix printer, a GDI printer should work as well.

Microsoft has a page on doing exactly what you want to do, using the Win32API: How To Print Line-by-Line to a Printer There is an example at that page.

0

精彩评论

暂无评论...
验证码 换一张
取 消