Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem on setting up page size on Zebra printer using CUPS on QT5 on Raspberry pi 4
Forum Updated to NodeBB v4.3 + New Features

Problem on setting up page size on Zebra printer using CUPS on QT5 on Raspberry pi 4

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 275 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GARUCHIRAZUMAN
    wrote on 12 Apr 2022, 20:37 last edited by
    #1

    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
    
    }
    
    1 Reply Last reply
    0
    • G Offline
      G Offline
      GARUCHIRAZUMAN
      wrote on 13 Apr 2022, 21:01 last edited by
      #2

      Solved by just reintalling Zebra drivers. Thank you !

      1 Reply Last reply
      0

      1/2

      12 Apr 2022, 20:37

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved