我在ODOO 9上创建了一个新报告,该报告使用CSS样式以将文本定位在背景图像上。该图像在背景中,占据了完整的A4页面,没有任何边距。
在html中,工作正常。但是,当我将报告打印到PDF时,我的左右边距空白,文本却低于背景图像。似乎没有应用CSS规则。您是否找到任何使其在PDF中工作的解决方案?
这是我的报告:
<template id="sub_proposal">
<style type="text/css">
.container {
padding: 0mm;
}
#sponsor-ref {
position: absolute;
top: 84mm;
left: 45mm;
}
#form_image {
position: absolute;
top: 0mm;
left: 0mm;
width: 210mm;
height: 297mm;
}
#form_image img {
max-width: 100%;
max-height: 100%;
margin: auto;
}
</style>
<t t-call="report.html_container">
<t t-foreach="docs" t-as="o">
<div class="page">
<div id="form_image">
<span t-field="o.sub_proposal_form" t-field-options='{"widget": "image"}'/>
</div>
<span id="sponsor-ref" t-field="o.ref"/>
</div>
</t>
</t>
必须在<div class="page">
元素中设置style
标签和内容。
我没有任何文档,只有经验。
链接到Odoo论坛上的同一问题
这将在pdf
上打印图像<template id="account_report_id" inherit_id="account.report_invoice_document">
<p t-if="o.fiscal_position_id.note" position="after"><br/><br/>
<img t-if="o.partner_id.image" t-att-src="'data:image/png;base64,%s' % o.partner_id.image" style="float:right;max-height:40px;"/><br/><br/>
<span style="float: right;">Customer Sign</span>
</p>
</template>