How to add a watermark image to Qweb Reports in all PDF pages in Odoo?

别等时光非礼了梦想. 提交于 2019-12-06 06:10:09

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

Note: I am afraid this does not work in Odoo v11

Update

This solution only is valid if you want to add the same image to all the reports.

There is a module developed by the OCA to add watermarks to the reports. A field appears in all reports where an images (with A4 size) can be added. The module name is report_qweb_pdf_watermark

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>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!