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 <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
Gehad elrobey 2015-07-23 15:20:09 +02:00 committed by Lubomir I. Ivanov
parent c6116b0269
commit 9fd5221666

View file

@ -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);
}