Skip to Content
Menu
This question has been flagged
5285 Zobrazenia

 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
Zrušiť
Autor

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 Zobrazenia Aktivita
4
jan 25
44369
0
okt 24
1384
0
okt 24
5
1
máj 23
2914
5
máj 21
11434