summaryrefslogtreecommitdiffstats
path: root/printer.cpp
diff options
context:
space:
mode:
authorGravatar Gehad elrobey <gehadelrobey@gmail.com>2015-07-23 15:20:09 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2015-07-28 11:37:12 +0300
commit9fd5221666f94c9a95537b2f07a28a1c02f6bb24 (patch)
tree06efc5f6c3b8f88232e50394f2ceb3749d069cc4 /printer.cpp
parentc6116b0269c6ec8adee2832f1812d1cf8f8e6e70 (diff)
downloadsubsurface-9fd5221666f94c9a95537b2f07a28a1c02f6bb24.tar.gz
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>
Diffstat (limited to 'printer.cpp')
-rw-r--r--printer.cpp7
1 files changed, 6 insertions, 1 deletions
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);
}