How do I print long widgets continuously without cutoff?



  • At QT(5.12), I made the ui with QWidget. And I want to print the ui with my printer. But, The ui is too long to print on one page.(height is greater than the A4 size) I want continuous prints without newPage() function.

    I use QPrinter and QPainter. But, The result I received was a cropped widget image. Is there any option or code that prints automatically on the next page like MS Word?

    QPrinter printer;
    QPainter painter;
    printer.setPaperSize(QPrinter::A4);
    printer.setFullPage(true);
    
    QPrintDialog printDialog(&printer);
    if (printDialog.exec() == QDialog::Accepted) {
        painter.begin(&printer);
        ui->scrollArea->widget()->render(&painter);
    }
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.