Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. Generating PDF with QWebPahe
Forum Updated to NodeBB v4.3 + New Features

Generating PDF with QWebPahe

Scheduled Pinned Locked Moved Qt WebKit
1 Posts 1 Posters 634 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    qtmatti
    wrote on last edited by
    #1

    Hi,

    I'm using a QWebPage that loads the HTML content and then I'm trying to generate a PDF from it:
    @
    QPrinter printer(QPrinter::HighResolution);
    printer.setOutputFormat(QPrinter::PdfFormat);
    printer.setOutputFileName(m_fileName);
    printer.setPaperSize(QPrinter::A4);

     QPainter painter(&printer);
     painter.setRenderHint(QPainter::Antialiasing, true);
     painter.setRenderHint(QPainter::TextAntialiasing, true);
     painter.setRenderHint(QPainter::SmoothPixmapTransform, true);
     m_page.mainFrame()->documentElement().render(&painter);
     painter.end();
    

    @

    Unfortunately the HTML content only fills up a very small part of the generated HTML page. What is the correct way to zoom the content so that it completely fills up the printing area (here in this example it's A4 without margins)?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved