【发布时间】:2017-06-01 13:18:57
【问题描述】:
我正在创建一个关于 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>
【问题讨论】:
标签: report odoo wkhtmltopdf odoo-9 qweb