summaryrefslogtreecommitdiffstats
path: root/printer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'printer.cpp')
-rw-r--r--printer.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/printer.cpp b/printer.cpp
index bce42c30d..635778042 100644
--- a/printer.cpp
+++ b/printer.cpp
@@ -168,6 +168,10 @@ 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);
Pages = ceil(webView->page()->mainFrame()->contentsSize().height() / (float)pageSize.height());
} else {
Pages = ceil(getTotalWork(printOptions) / (float)divesPerPage);