Skip to Content
Menu
This question has been flagged
4310 Views

 made a new report with a special format 420mm x 210mm. I try to position boxes inside my report using divs with css margins given in millimeters. Howevers, I noticed that when I specify 420mm in the css, the output in the pdf is not 420mm, but something smaller. I just made the following :

<template id="test">
    <t t-call="report.html_container">
        <t t-foreach="docs" t-as="o">
            <div class="test page">
            </div>
        </t>
    </t>
</template>

<template id="test_style" inherit_id="report.style">
    <xpath expr=".">
        <t>
                .test.page {
                        width: 420mm;
                        height: 210mm;
                        background-color: red;
                    }
        </t>
    </xpath>
</template>

The output is the following, the box does not fill the page. The page size is correct (420x210):

So my question is how can I set the position in millimeters and it would be exact for generating the pdf ?

Avatar
Discard
Author

So by searching a lot I found that using the option "--disable-smart-shrinking" in wkhtmltopdf, it removes my issue ! However, I was only able to do so by changing Odoo report module and hardcoding the option when wkhtmltopdf is invoked. Is there any more elegant way to do it without changing Odoo code ?

Related Posts Replies Views Activity
0
Oct 24
142
0
Oct 24
5
1
May 23
1462
5
May 21
9853
5
Aug 20
29863