summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--printer.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/printer.cpp b/printer.cpp
index b9f9b3363..b0caa0815 100644
--- a/printer.cpp
+++ b/printer.cpp
@@ -194,8 +194,13 @@ void Printer::print()
connect(&t, SIGNAL(progressUpdated(int)), this, SLOT(templateProgessUpdated(int)));
dpi = printerPtr->resolution();
//rendering resolution = selected paper size in inchs * printer dpi
+#if QT_VERSION >= 0x050300
+ pageSize.setHeight(printerPtr->pageLayout().paintRectPixels(dpi).height());
+ pageSize.setWidth(printerPtr->pageLayout().paintRectPixels(dpi).width());
+#else
pageSize.setHeight(printerPtr->pageRect(QPrinter::Inch).height() * dpi);
pageSize.setWidth(printerPtr->pageRect(QPrinter::Inch).width() * dpi);
+#endif
webView->page()->setViewportSize(pageSize);
webView->page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
// export border width with at least 1 pixel