diff options
-rw-r--r-- | printer.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/printer.cpp b/printer.cpp index d0a165dcb..624de3a42 100644 --- a/printer.cpp +++ b/printer.cpp @@ -59,6 +59,11 @@ void Printer::putProfileImage(QRect profilePlaceholder, QRect viewPort, QPainter void Printer::flowRender() { + // add extra padding at the bottom to pages with height not divisible by view port + int paddingBottom = pageSize.height() - (webView->page()->mainFrame()->contentsSize().height() % pageSize.height()); + QString styleString = QString::fromUtf8("padding-bottom: ") + QString::number(paddingBottom) + "px;"; + webView->page()->mainFrame()->findFirstElement("body").setAttribute("style", styleString); + // render the Qwebview QPainter painter; QRect viewPort(0, 0, 0, 0); @@ -187,6 +192,7 @@ void Printer::print() return; } + QPrinter *printerPtr; printerPtr = static_cast<QPrinter*>(paintDevice); @@ -218,10 +224,6 @@ void Printer::print() } int Pages; if (divesPerPage == 0) { - // add extra padding at the bottom to pages with height not divisible by view port - int paddingBottom = pageSize.height() - (webView->page()->mainFrame()->contentsSize().height() % pageSize.height()); - QString styleString = QString::fromUtf8("padding-bottom: ") + QString::number(paddingBottom) + "px;"; - webView->page()->mainFrame()->findFirstElement("body").setAttribute("style", styleString); flowRender(); } else { Pages = ceil(getTotalWork(printOptions) / (float)divesPerPage); |