mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
Printing: fix scrolling bug by adding extra padding
This bug occurs in "table" and "flowlayout" templates, it takes place when the size of the full web view to be rendered is not divisible by the size of the view port (Page size), This issue is fixed by adding extra padding to the bottom of the body so that the total body height is divisable by the view port size. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
This commit is contained in:
parent
efe8dc9b57
commit
0ced68f15d
1 changed files with 4 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue