From f3c5699714e43e91c8ff8f66119da454b314264d Mon Sep 17 00:00:00 2001 From: Gehad elrobey Date: Fri, 14 Aug 2015 22:24:48 +0200 Subject: Printing: remove silly white line at end of each page QPrinter::pageRect() doesn't always return the correct value of the printable area, which results in white horizontal lines of un-rendered area at the bottom of each page, Use QPrinter::pageLayout() instead which fixes the issue. QPrinter::pageLayout() is added in QT 5.3, So use pageRect for previous versions. Signed-off-by: Lubomir I. Ivanov Signed-off-by: Gehad elrobey --- printer.cpp | 5 +++++ 1 file changed, 5 insertions(+) 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 -- cgit v1.2.3-70-g09d2