Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. QWebEnginePage's print preview (PrintPreviewDialog) is fuzzy
Forum Updated to NodeBB v4.3 + New Features

QWebEnginePage's print preview (PrintPreviewDialog) is fuzzy

Scheduled Pinned Locked Moved Unsolved QtWebEngine
5 Posts 4 Posters 795 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.
  • H Offline
    H Offline
    haibianren
    wrote on last edited by
    #1

    I'm working on a project using QWebEnginePage to print web page.

    When showing print preview by PrintPreviewDialog,the page content is fuzzy (zoom 100%),while if we use QTextEdit instead of QWebEnginePage to render the page content, the page preview in PrintPreviewDialog is clear, Could you give any suggestions to this issue.

    1 Reply Last reply
    1
    • H Offline
      H Offline
      haibianren
      wrote on last edited by
      #2

      Here is my code:

      paintRequested signal is connected to paint function:

      connect(&previewDialog, &QPrintPreviewDialog::paintRequested, this, &PrintHandler::paint);
      

      paint function

      void PrintHandler::paint(QPrinter *printer)
      {
          QEventLoop loop;
          bool result;
          auto cb = [&](bool success) {
              result = success;
              loop.quit();
          };
          m_webEngineView.page()->print(printer, std::move(cb)); // render the page content
          loop.exec();
          if (!result) {
             ...
          }
      }
      
      1 Reply Last reply
      0
      • H Offline
        H Offline
        HiMa
        wrote on last edited by
        #3

        Meet the same issue under Ubuntu 20.04 with Qt 5.15.2

        If we do not use PrintPreviewDialog, but print QWebEnginePage as PDF document directly, the resolution is correct as what we set in QPrinter.

        Ref: https://bugreports.qt.io/browse/QTBUG-78161

        JonBJ 1 Reply Last reply
        0
        • H HiMa

          Meet the same issue under Ubuntu 20.04 with Qt 5.15.2

          If we do not use PrintPreviewDialog, but print QWebEnginePage as PDF document directly, the resolution is correct as what we set in QPrinter.

          Ref: https://bugreports.qt.io/browse/QTBUG-78161

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @HiMa
          I note that the bug ref you give was fixed as of 5.14.0 RC1, yet you say you see this in 5.15.2? I don't know how that relates to the OP's version. Are you saying the issue has not been resolved after all?

          1 Reply Last reply
          0
          • X Offline
            X Offline
            xiaoyifang
            wrote on last edited by
            #5

            this is still problem in qt5.15.2 .
            has not been fixed completely.

            1 Reply Last reply
            1

            • Login

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