summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSzabolcs David <davidsz@inf.u-szeged.hu>2021-04-19 22:03:39 +0200
committerSzabolcs David <davidsz@inf.u-szeged.hu>2021-04-21 16:09:55 +0200
commitb7511264954d0e81f980195f3a9c4e5e18da9d41 (patch)
treeec4aff3b581d17d5de44df77e532c33be8e0f87e
parent0b7510efcde8220e55b0cef5fefc1db76a3bd99a (diff)
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 <allan.jensen@qt.io>
-rw-r--r--examples/webenginewidgets/printme/printhandler.cpp1
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp4
2 files changed, 5 insertions, 0 deletions
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<const QByteArray&> &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<bool> &resultCallback)