PDA

View Full Version : Dot Matrix Printer



estanisgeyer
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;
prt->setPrinterName(ui.comboBox_Printers->currentText());
qDebug() << "Printer: " << prt->printerName(); // Ok, dot printer

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

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


What may be happening?

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

You print outside your page boundaries.

estanisgeyer
17th December 2009, 15:54
Hi,

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.

estanisgeyer
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.