Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-68965

QPrinter and WebEngine bites each other

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.10.1, 5.11.0
    • GUI: Printing, WebEngine
    • None

    Description

      Hi all,

      I discovered a bug related to QtWebEnginePage / QtWebEngineView and QPrinter.

      In times where Qt had QtWebView with the WebKit this combination worked very well.

      Nowadays QPrinter with HighResolution will pixelate the whole PDF.

      I used this minimalistic HTML:

      <html><body><table><tr><th>Month</th><th>Savings</th></tr></table></body></html>
      

       

      With this CPP:

      void Test::Test( QObject *parent ) : QObject( parent )
      {
      
        QString cHtml = "<html><body><table><tr><th>Month</th><th>Savings</th></tr></table></body></html>";
      
        vPrinter = new QPrinter;
        vPrinter->setResolution(QPrinter::HighResolution);
        vPrinter->setPageSize(QPrinter::A4);
        vPrinter->setOutputFormat(QPrinter::PdfFormat);
        vPrinter->setOutputFileName("D:\\test.pdf");
      
        page = new QWebEnginePage;
        connect( page, SIGNAL(loadFinished(bool)), this, SLOT(loaded(bool)));
        page->setHtml( cHtml );
      }
      
      void Test::loaded( bool state )
      {
        page->print(vPrinter, [=](bool state){
          emit pdfGenerated(state);
        });
      }

      Best regards,
      Mike

       

      Attachments

        1. Pixelate_Printer_WebEngine.PNG
          7 kB
          Mike
        2. test.pdf
          2 kB
          Mike
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            davidsz Szabolcs David
            lachrymology Mike
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes