How to add a watermark image to Qweb Reports in al

2019-05-25 07:31发布

I am creating qweb report and I want to add a image to the background in all pages but I am getting watermark in only the first page. What I have tried:

<div style="position:absolute;text-align:center;z-index:-1;border:0;opacity:0.1;padding-top:50px;">
    <img t-att-src="'data:image/png;base64,%s' %o.employee_id.company_id.watermark_img"/>
</div>

2条回答
Deceive 欺骗
2楼-- · 2019-05-25 08:06

Please try this code:

<div 
style="position:absolute;opacity:0.25;z-index:1000;transform:rotate(300deg);-webkit-transform:rotate(300deg);width:150%;">
<p style="font-size:50px;">WATERMARK TEXT</p>
</div>
查看更多
We Are One
3楼-- · 2019-05-25 08:26

I have found the solution here

Add this code for watermark in header of external layout. Its external id is report.external_layout_header:

<style>
    .watermark {
        position: absolute;
        opacity: 0.25;
        z-index: 1000;
        transform: rotate(300deg);
        -webkit-transform: rotate(300deg);
        width: 150%;
    }
</style>

<div class="watermark">
    <p>WATERMARK</p>
    <img t-att-src="'/module_name/static/src/img/image_name.png'" />
</div>

I have added a image stored as a file. If you are going to use a static image I think this is the most appropiate way

查看更多
登录 后发表回答