mardi 14 juin 2022

Print out each content in a separate page use QTextdocument in Qt C++

I am a newbie in Qt c++. I use QTextdocment to print PDF format. My QTextdocment (doc) is quite long, it consists of separate content. So how can I print out each content in a separate page.

QPrinter printer(QPrinter::HighResolution);
    printer.setOutputFormat(QPrinter::PdfFormat);
    printer.setPaperSize(QPrinter::A4);
    printer.setOrientation(QPrinter::Landscape);
    printer.setOutputFileName(ui->lE_Save->text()+ ".pdf");
    doc.setDocumentMargin(0);
    doc.setTextWidth(0.5);
    doc.print(&printer);

Thank you.

Aucun commentaire:

Enregistrer un commentaire