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

Rendering a widget to a printer produces a raster image

    XMLWordPrintable

    Details

      Description

      When using QWidget::render() to render a widget to a QPrinter, a rasterized version of the widget is painted. This can clearly be seen if the printer output is saved to a PDF and opened in a PDF reader. The output looks really ugly when zoomed in.

      A workaround is to render the widget to a QSvgGenerator and then converting that output to a PDF, but it seems rather cumbersome.

      There seems to be a check in QWidget::render() which tells Qt to rasterize the output when rendering to a printer. Some helpful develpers found this commit description:

      "We have to render via a pixmap, since the printer device is not persistent in beteween QPainter::begin()/end() calls."

      It would be nice if a workaround was implemented so that rendering to a printer would not result in raster images which look ugly when zoomed in.

      Attached is a small program which produces an ugly-looking PDF.

        Attachments

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              pafcu Stefan Parviainen
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes