Cutting labels on a label printer to the correct size in Qt/C++? <p>I have a Brother QL700 label printer. I want to print a BarCode on this printer. I have successfully generated a barcode in code 39 format in <code>QString</code> and display this barcode on a <code>QLabel-&gt;setText(QString)</code>. Now I want to print this barcode on a label printer. I am doing the following things but it does not give me the desired result.</p> <pre><code>QList&lt;QPrinterInfo&gt; printerList = QPrinterInfo::availablePrinters() ; for(int r=0; r&lt;printerList.size();++r) { if(printerList[r].printerName() == "Brother_QL_700") { QPageSize pageSize(QSizeF(45.0,70.0),QPageSize::Millimeter,"",QPageSize::ExactMatch); QPrinter PRINTER(printerList[r],QPrinter::PrinterResolution); PRINTER.setOrientation(QPrinter::Portrait); PRINTER.setPageSize(pageSize); PRINTER.setFullPage(true); PRINTER.setOutputFormat(QPrinter::NativeFormat); int id = QFontDatabase::addApplicationFont("/Applications/untitledfolder/free3of9.ttf"); QFontDatabase::applicationFontFamilies(id).at(0); QFont barcodefont; barcodefont.setFamily("New"); barcodefont.setWeight(QFont::Normal); barcodefont.setPointSize(10); QFontMetrics fntm(barcodefont); QPainter painter2; if(!painter2.begin(&amp;PRINTER)) return; int x1 = printer1.paperRect().x() + printer1.width()/2 - fntm.width(m_pDeviceInfoWgt-&gt;label-&gt;text())/2; int y1 = printer1.paperRect().y(); int w1 = fntm.width(m_pDeviceInfoWgt-&gt;label-&gt;text()); int h1 = fntm.height(); QRect rect10 = QRect(x1,y1,w1,h1); painter2.setFont(barcodefont); painter2.drawText(rect10,Qt::AlignCenter,"Sample_Text"); painter2.end(); break; } } </code></pre> <p>This code will print the barcode on the label printer, but does not cut the paper after 45 mm. It cuts the paper at 297mm (i.e. in A4 size of 210x297mm).</p> <p>That means the printer assumes that the size of paper is <code>QPrinter::A4</code> but I have given it a custom size. It should be printed using the size I specified, but it's not happening.</p> <p>How can I properly tell the label printer to use the specified paper size so that it will cut the printed labels correctly?</p>