问题
Using below code It is just view on the first page. I want to show watermark on all pages.
<div class="watermark_report">
<img t-att-src="'data:image/png;base64,'+ doc.company_id.report_header_logo"/>
</div>
回答1:
You already have the answer 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 appropriate way
Note: Instead of using the css attribute opacity
you can use a png image with opacity and transparent backgroud. That´s what I had to do
Note 2: 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
来源:https://stackoverflow.com/questions/49426352/how-to-add-watermarks-in-all-pages-of-odoo-reports