Skip to Content
Menú
This question has been flagged
5245 Vistes

 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
Descartar
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 Respostes Vistes Activitat
4
de gen. 25
44301
0
d’oct. 24
1361
0
d’oct. 24
5
1
de maig 23
2889
5
de maig 21
11382