Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Printing a QWebPage to PDF
Forum Update on Monday, May 27th 2025

Printing a QWebPage to PDF

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 476 Views
  • 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.
  • U Offline
    U Offline
    ughwhy
    wrote on last edited by
    #1

    Is it possible to print a web page (via QPrinter) as one long PDF (i.e. without pagination)? I don't see a way to do this currently. I've tried setting different page sizes and even custom paper sizes and nothing seems to work. Here's what I'm currently trying (where mPage is a QWebPage):

    @ QPrinter printer(QPrinter::HighResolution);
    printer.setPaperSize(QSizeF(750, 100000), QPrinter::DevicePixel);
    printer.setOutputFormat(QPrinter::PdfFormat);
    printer.setFullPage(true);
    printer.setOutputFileName(mFilename);

    mPage.mainFrame()->print(&printer);@

    Any ideas?

    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