From 9fd5221666f94c9a95537b2f07a28a1c02f6bb24 Mon Sep 17 00:00:00 2001 From: Gehad elrobey Date: Thu, 23 Jul 2015 15:20:09 +0200 Subject: Printing: get the number of pages from the full resolution When we calculate the number of pages to print we need to check if the template doesn't define the number of dives per one page, then render as much dives as we can fit in one page. A dive can be broken into many pages. Signed-off-by: Gehad elrobey Signed-off-by: Lubomir I. Ivanov --- printer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/printer.cpp b/printer.cpp index 5b1995501..10942865a 100644 --- a/printer.cpp +++ b/printer.cpp @@ -160,7 +160,12 @@ void Printer::print() divesPerPage = 1; // print each dive in a single page if the attribute is missing or malformed //TODO: show warning } - int Pages = ceil(getTotalWork(printOptions) / (float)divesPerPage); + int Pages; + if (divesPerPage == 0) { + Pages = ceil(webView->page()->mainFrame()->contentsSize().height() / (float)pageSize.height()); + } else { + Pages = ceil(getTotalWork(printOptions) / (float)divesPerPage); + } render(Pages); } -- cgit v1.2.3-70-g09d2