CUPS wrong orientation at custom size

H Huseyin Kozan 3 years 6 months ago
251 1 0

Hi,

I am developing a graphical user interface using Qt toolkit at Ubuntu 16.04 LTS. I had installed the GC420t driver at CUPS web page which connected over USB. And worked fine with custom label (25x15mm) until a few days before. Then, it started to print at wrong orientation. Like this issue : Printouts with ZPL driver resist rotation · Issue #5284 · apple/cups · GitHub

Then I tried to add a custom size to PPD file, like:

...*PageSize w70h43/0.97x0.59": "setpagedevice"...*PageRegion w70h43/0.97x0.59": "setpagedevice"...*ImageableArea w70h43/0.97x0.59": "0 0 70 43"...*PaperDimension w70h43/0.97x0.59": "70 43"...
It printed right orientation, but got only half of the size at the output (one line of third lines). Today, Ubuntu gets an update and PPD file resetted which will be bad at end user use case.

Then, I tried to change this line :
*ParamCustomPageSize Orientation: 5 int 0 0into this:
*ParamCustomPageSize Orientation: 5 int 1 1The result was same; right oriented one line with custom sized at CUPS options.

Here the codes to print at Qt:
QPrinter printer(printerInfo, QPrinter::PrinterResolution);QPageSize psz = printerInfo.defaultPageSize();QSizeF sz = psz.size(QPageSize::Millimeter);printer.setPageSize(psz);printer.setFullPage(true);printer.setPageMargins(QMarginsF(0, 0, 0, 0));QString html = QString(            ""            " H:%2 F:%3"            " %5"            " %7"            ""            )            .arg(versionCss).arg(hw).arg(fw)            .arg(addressCss).arg(address)            .arg(dateCss).arg(date);QTextDocument doc;doc.setHtml(html);doc.setDocumentMargin(0);QPainter painter;painter.begin(&printer);painter.scale(            printer.pageRect().width()  / doc.size().width(),            printer.pageRect().height() / doc.size().height()            );doc.setTextWidth(printer.pageRect().width());doc.drawContents(&painter);painter.end();
Any help appreciated

CONTACT
Can’t find what you’re looking for?