Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1.     QPrinter printer(QPrinter::HighResolution);
  2.     printer.setOrientation(QPrinter::Landscape);
  3.     QPrintDialog printDialog(&printer,this);
  4.     printDialog.setWindowTitle("Print Document");
  5.     if (printDialog.exec() == QDialog::Accepted)
  6.     {
  7.         QTextDocument doc;
  8.         const QString html = "<html>"\
  9.                 "<body>"\
  10.                 "<h1>My First Heading</h1>  "\
  11.                 "<p>My first paragraph.</p> "\
  12.                 "</body>"\
  13.                 "</html>";
  14.         doc.setHtml(html);
  15.         doc.print(&printer);
  16.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement