PDA

View Full Version : Print on dot matrix printer - very low performace



porterneon
17th October 2012, 09:35
Hi
I'm writing application that will print a lot of documents. To reduce print costs all documents will be printed on dot matrix printer. I have made few tests and print quality (on dot matrix printer) is very poor. If I set high resolution on printer (system printer settings) print quality is good but speed is very slow. On laser printer everything works fine.

I think (please correct me if I'm wrong) QPrinter class is sending data to printer as a image. I tried with different output formats: NativeFormat and PdfFormat - the same issue. When I set PostScriptFormat then printer is printing postscript text with all postscript commands.

This is my code:


QTextEdit editor;
QPrinter printer(QPrinter::HighResolution);
printer.setOutputFormat(QPrinter::NativeFormat);
printer.setDuplex(QPrinter::DuplexAuto);
printer.setColorMode(QPrinter::GrayScale);

QString htmlFile("<!DOCTYPE HTML><html><head><meta http-equiv='Content-Type...............");

editor.setHtml(htmlFile);

editor.print(&printer);

My question is how to print formatted text on dot matrix printer (for example html text) using qt?

PS: I have made tests on Oki microline 3320 (9-pin), panasonic kx-p1150 (9-pin), panasonic (24-pin) printer. I even tested few drivers but result is the same.

Lesiok
17th October 2012, 10:33
In the general case there is one answer: no graphical mode is impossible. A document can contain multiple size and typeface and printer in text mode has one typeface and 3 or 4 basic sizes.
In the case of simple texts You have to use the mechanisms of the system (except for Qt) send all the data to the same printer, including control codes. On Windows read about OpenPrinter, StartDocPrinter and so on.

porterneon
18th October 2012, 12:37
Do you know any c++ lib for linux that can solve this issue?

Lesiok
18th October 2012, 13:24
Sorry I don't know

ChrisW67
18th October 2012, 23:51
You should just be able to open the raw printer device and write to it on Linux.
Some quick command line tests here: http://clemrasul.blogspot.com.au/2008/12/raw-printing-in-linux.html