コンテンツへスキップ
メニュー
この質問にフラグが付けられました
5416 ビュー

 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 ?

アバター
破棄
著作者

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 ?

関連投稿 返信 ビュー 活動
4
1月 25
44541
0
10月 24
1447
0
10月 24
5
1
5月 23
2986
5
5月 21
11505