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

REG: Webkit printing graphics incorrectly to pdf

    XMLWordPrintable

Details

    • f2e6570e4f31cbf565aa2849ccc12692c6201bd5

    Description

      Webkit is not printing page correctly anymore in Qt 5.2.1. Probably regression from Qt 5.2.0 (customer says). At least Qt 5.1.1 prints page graph correctly. Open attached printer pdf file and see grey border around graph lines. Can be easily tested with example below:

      main.cpp
      #include <QApplication>
      #include <QWebView>
      #include <QWebFrame>
      #include <QPrinter>
      #include <QBuffer>
      
      class WebView : public QWebView
      {
      public:
          WebView()
              : QWebView(0)
          {
              load(QUrl("http://www.highcharts.com/demo/"));
          }
          void mousePressEvent(QMouseEvent *)
          {
              QWebFrame *const mainFrame = page()->mainFrame();
              QBuffer device;
              QByteArray m_Buffer;
              device.setBuffer(&m_Buffer);
              device.open(QIODevice::WriteOnly);
              QPrinter printer;
              printer.setOutputFormat(QPrinter::PdfFormat);
              printer.setPageSize(QPrinter::A4);
              QString filename;
              filename = "webpage.pdf";
              printer.setOutputFileName(filename);
              mainFrame->print(&printer);
          }
      };
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          WebView w;
          w.show();
          return a.exec();
      }
      

      Attachments

        1. print.pdf
          57 kB
        2. webpage_with_fix.pdf
          52 kB
        3. webpage.pdf
          46 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            allan.jensen Allan Sandfeld Jensen
            qtcomsupport Qt Support
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes