Reputation: 10189
In Odoo 15, I am modifying the PDF reports in order to show some info in the header at the first page, and other different info at the left pages.
To do that, I use a existing OCA module, very popular, named report_qweb_element_page_visibility. Once installed, if you set to elements classes like first-page
or not-first-page
, it applies the style display: none;
to them depending on the page they are.
The problem is that display: none;
does not hide the elements fully. They still occupy space, for example, if I have a div
with a long text which has a height of 5 cm, I see 5 cm of blank space, which obviously looks awful:
<div class="row">
<div class="col-6">
<div class="first-page" name="left_block">
FIRST PAGE LEFT
</div>
</div>
<div class="col-6" name="right_block">
<div class="first-page">
FIRST PAGE RIGHT
</div>
<div class="not-first-page">
OTHER PAGE RIGHT
</div>
</div>
</div>
In the previous example, at the very first page, FIRST PAGE RIGHT has a blank space below it. And at the left pages, OTHER PAGE RIGHT has the blank space above it. In this example is only a line, but the more info you add, the bigger the blank space is.
Does anybody experience this? Could anybody give me a solution?
Upvotes: 0
Views: 168
Reputation: 10189
The problem was the Wkhtmltopdf
library version. With the right one, the elements with display: none;
do not leave blank spaces.
Upvotes: 0