CUPS wrong orientation at custom size

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": "<</PageSize[70 43]/ImagingBBox null>>setpagedevice"

...

*PageRegion w70h43/0.97x0.59": "<</PageSize[70 43]/ImagingBBox null>>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 0

into this:

*ParamCustomPageSize Orientation: 5 int 1 1

The 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(

            "<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\">"

            " <tr><td align=\"center\" valign=\"middle\" style=\"%1\">H:%2 F:%3</td></tr>"

            " <tr><td align=\"center\" valign=\"middle\" style=\"%4\">%5</td></tr>"

            " <tr><td align=\"center\" valign=\"middle\" style=\"%6\">%7</td></tr>"

            "</table>"

            )

            .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