From b7511264954d0e81f980195f3a9c4e5e18da9d41 Mon Sep 17 00:00:00 2001 From: Szabolcs David Date: Mon, 19 Apr 2021 22:03:39 +0200 Subject: Docs: Suggest to use higher DPI for printing When printing with the default resolution of QPrinter, rasterized images of pages are just too small to produce sharp result. Documentation of QPrinter also mentions that the default ScreenResolution should only be used for drafts. Change-Id: I5fe93f7985d16b1126cf2bbcb9b4a4ddbdfd21f2 Task-number: QTBUG-92185 Reviewed-by: Allan Sandfeld Jensen --- examples/webenginewidgets/printme/printhandler.cpp | 1 + src/webenginewidgets/api/qwebenginepage.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/examples/webenginewidgets/printme/printhandler.cpp b/examples/webenginewidgets/printme/printhandler.cpp index d8c4fc177..b1eb037e6 100644 --- a/examples/webenginewidgets/printme/printhandler.cpp +++ b/examples/webenginewidgets/printme/printhandler.cpp @@ -107,6 +107,7 @@ void PrintHandler::printPreview() return; m_inPrintPreview = true; QPrinter printer; + printer.setResolution(300); QPrintPreviewDialog preview(&printer, m_page->view()); connect(&preview, &QPrintPreviewDialog::paintRequested, this, &PrintHandler::printDocument); diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 57aa413b9..e08afed44 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -2526,6 +2526,10 @@ void QWebEnginePage::printToPdf(const QWebEngineCallback &res during page destruction. When QWebEnginePage is deleted, the callback is triggered with an invalid value and it is not safe to use the corresponding QWebEnginePage or QWebEngineView instance inside it. + \note This function rasterizes the result when rendering onto \a printer. Please consider raising + the default resolution of \a printer to at least 300 DPI or using printToPdf() to produce + PDF file output more effectively. + \since 5.8 */ void QWebEnginePage::print(QPrinter *printer, const QWebEngineCallback &resultCallback) -- cgit v1.2.3