View Full Version : Dot Matrix Printer

16th December 2009, 19:41
Hi guys,

I'm trying to print to a dot matrix printer, but when printing, the printer advances a few pages to print. The following code:

QPrinter *prt = new QPrinter;
qDebug() << "Printer: " << prt->printerName(); // Ok, dot printer

prt->setPaperSize(QSizeF(191, 93), QPrinter::Millimeter);

QPainter painter(prt);
painter.drawText(10, 10, 200, 100, Qt::AlignLeft | Qt::AlignTop, QString("Test printer"));

What may be happening?

16th December 2009, 20:28
What may be happening?

You print outside your page boundaries.

17th December 2009, 15:54

There seems to be the problem. Moved to setFullPage(false) and the configuration of the cups, I changed the page size to custom, did not help. I tried also to change A3 and are now advanced a few pages, compared with the previous test.

I'm using an Epson LX-300, tried with the driver Epson Dot Matrix Foomatic/eps9high and Generic IBM-Compatible dot matrix printer.

18th December 2009, 19:30
Well, I have not found a solution using the cups. The solution was to send directly to the device.

QFile pr("/dev/usblp0"); // Device need 0666 permission to work.

if (pr.open(QFile::WriteOnly))
QTextStream o(&pr);
o << r;

This is me looking like a bug.