Problem on setting up page size on Zebra printer using CUPS on QT5 on Raspberry pi 4
Solved
General and Desktop
-
Hello.
Im trying to adjust or set zebra label printer GK420t model page size to its current label size which is 2.00 inch length by 4.00 inch wide. So tried many variations on QT code and on CUPS drivers (currently only driver that works is ZPL. Problem is that when I sent to print some information, label only gets printed up to 50% of its size. Remaining 50% is just blank. So I used X and Y coordinates on my painter to adjust the correct position of my data, but still same result, it only covers 50% of the page (wide) Here is my code so you can see if there is any problem/ suggestion to adjust, Im using barcode fonts by the way using a raspberry pi 4:QStringList printers = QPrinterInfo::availablePrinterNames(); QPrinterInfo printerInfo = QPrinterInfo::printerInfo(printers.at(0)); QPrinter *printer = new QPrinter(printerInfo,QPrinter::HighResolution); printer->setPrinterName("default printer"); printer->setNumCopies(numcopies); printer->setPaperSize(QSizeF(2, 4), QPrinter::Inch); // Current label size 2 inch length by 4.00 inch wide. printer->setPageMargins(QMarginsF(0,0,0,0)); QPainter painter(this); //instruction to paint this object called painter painter.begin(printer); //initialize painter object //barcode font setup and for text font setup and size QFont fonto39 =QFont("IDAHC39M Code 39 Barcode",6,QFont::Normal); //original size in 8 QFont fonto128 =QFont("Code 128",8,QFont::Light); QFont carlito =QFont("Carlito",9,QFont::Black); //original is 13 QFont carlito2 =QFont("Carlito",13,QFont::Black); //original is 13 //fonto128.setLetterSpacing(QFont::AbsoluteSpacing,5.0); //separadito // setup fpr code39 (barcode) size and margins (X, Y) values X close to 0 moves to left Y closes to 0 moves upwards QString myaxterix = ("*"); QString numpartecode = ui->lineEdit->text(); QString concatenado = (myaxterix + numpartecode + myaxterix); painter.setFont(fonto39); painter.drawText(5000,1500, concatenado ); //best is 1800,500 //setup for text alignment on label using same (X,Y) values to properly adjust as desired QString mybarcode = (ui->lineEdit->text()); painter.setFont(carlito); painter.drawText(6000,1000, mybarcode ); //280,380 (best is 25,380) (3000, 380 previous) //setup for text alignment on label using same (X,Y) values to properly adjust as desired QString mybarcode2 = (ui->lineEdit->text()); painter.setFont(carlito2); painter.drawText(4500,800, mybarcode2 ); //280,380 (best is 25,380) (previous 2000, 25) painter.end(); //close painter }
-
Solved by just reintalling Zebra drivers. Thank you !