Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- QPrinter printer(QPrinter::HighResolution);
- printer.setOrientation(QPrinter::Landscape);
- QPrintDialog printDialog(&printer,this);
- printDialog.setWindowTitle("Print Document");
- if (printDialog.exec() == QDialog::Accepted)
- {
- QTextDocument doc;
- const QString html = "<html>"\
- "<body>"\
- "<h1>My First Heading</h1> "\
- "<p>My first paragraph.</p> "\
- "</body>"\
- "</html>";
- doc.setHtml(html);
- doc.print(&printer);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement