Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
5006 Lượt xem

 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 ?

Ảnh đại diện
Huỷ bỏ
Tác giả

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 ?

Bài viết liên quan Trả lời Lượt xem Hoạt động
4
thg 1 25
43631
0
thg 10 24
1031
0
thg 10 24
5
1
thg 5 23
2547
5
thg 5 21
11026