PDA

View Full Version : serial port printer sending commands, how?



triperzonak
4th April 2009, 02:21
hi guys,

i have a serial port printer and i want to print on it. Im using QPrinter and QTextDocument.print to print (it prints) but however the printer have some necessary commands for example autocut that need to be inputed e.g("\x1D\x56\x01"). What class should i use to send the command? and also until now im printing the file as a whole, how can i print it line by line so that i can change the font size of some line or bold some words.

thanks in advance..

wysota
4th April 2009, 10:05
If you use QTextDocument then you should perform all the changes in the document and not while printing.

If you want to print line by line, you have to open the serial port and act as the printer driver sending raw commands through the serial.

triperzonak
6th April 2009, 13:33
how can i open the port? what class should i use and how do i send commands on it?

wysota
6th April 2009, 14:51
Either use QExtSerialPort which you can download from web or use native API. With so fine grained control requirement that might be the best option.