Enable Dark Mode!
how-to-add-watermark-in-pdf-reports-in-odoo-17.jpg
By: Sonu S

How to Add Watermark in PDF Reports in Odoo 17

Functional

In today's fast-paced business environment, characterized by widespread digital transactions, the significance of branding and security cannot be emphasized enough. As businesses endeavor to preserve their identity and safeguard their valuable assets, the implementation of robust security measures becomes imperative. Odoo 17, a versatile business management software solution, offers a seamless approach by facilitating the incorporation of custom watermarks into PDF reports. Let's explore the invaluable nature of this feature and its potential to enhance your business operations.

Watermarks play a crucial role across various industries, transcending mere aesthetic appeal to deliver tangible benefits that align with the evolving demands of contemporary businesses. One of the primary advantages of watermarks lies in their capacity to reinforce brand identity. You establish a consistent brand presence that resonates with your audience by embedding your company's logo or name onto every page of your PDF reports. This straightforward yet impactful branding strategy amplifies brand visibility and strengthens brand recognition, fostering deeper connections with your customers. Furthermore, watermarks are a robust mechanism for safeguarding intellectual property and preserving document integrity. In an era fraught with digital piracy and unauthorized sharing, incorporating watermarks into your PDF reports acts as a potent deterrent against illicit usage. A visible watermark serves as a definitive indicator of ownership, dissuading individuals from unauthorized distribution or replication of your documents. This proactive approach not only shields your proprietary information but also bolsters your organization's reputation and credibility. 

Implementing Text-Based Watermarks:

To add a text-based watermark to your PDF reports in Odoo 17, follow these steps: Insert the following code snippet into your report template:

<div class="row" t-if="report_type == 'pdf'" style="height: 0px; width: 100%; margin-left: 10%; margin-top: 50%; z-index: -1;">
    <div class="col-6" name="watermark">
        <span style="-webkit-transform: rotate(-45deg); color: coral; font-size: 6em; text-align: center; position: absolute; opacity: 0.2;">
            Watermark
        </span>
    </div>
</div>

For use in default Odoo templates, Here is an example sale order template

<?xml version="1.0" encoding="UTF-8"?>
<odoo>
    <template id="custom_sale_order_document_demo" inherit_id="sale.report_saleorder_document">
        <xpath expr="//div[@class='page']" position="before">
            <!-- Add watermark code here -->
            <div class="row" t-if="report_type == 'pdf'" style="height:0px; width:100%; margin-left:10%; margin-top:50%;">
                <div class="col-6" name="watermark">
                    <span style="-webkit-transform:rotate(-45deg); color:coral; font-size:6em; text-align:center; position:absolute; opacity:0.2;">
                        Watermark
                    </span>
                </div>
            </div>
            <!-- End of watermark code snippet -->
        </xpath>
    </template>
</odoo>

Implementing Image-Based Watermarks:

To add an image-based watermark to your Odoo 17 PDF reports, use the following example based on the sale order template:
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
    <!-- Define custom template inheriting the default sale order document template -->
    <template id="custom_sale_order_document_demo" inherit_id="sale.report_saleorder_document">
        <!-- Insert watermark code before the page content -->
        <xpath expr="//div[@class='page']" position="before">
            <div class="watermark" t-if="report_type == 'pdf'">
                <!-- Watermark -->
                <img src="path/to/your/image.png" style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; opacity: 0.2;"/>
            </div>
        </xpath>
    </template>
</odoo>

If additional styling options are required, you can utilize CSS by creating a separate file and referencing it within the template. This example serves as a foundation, allowing for the incorporation of any necessary styles to fulfill specific requirements.
In conclusion, integrating watermarks into PDF reports in Odoo 17 is a straightforward process that offers numerous benefits to businesses. By following the steps outlined in this blog, you can effortlessly enhance brand visibility, safeguard your documents from unauthorized use, and imbue your reports with a polished, professional appearance.
To begin, ensure you have a suitable watermark image prepared, preferably in PNG or JPEG format. Next, create a custom template to inherit the default report template in Odoo 17. Within this template, insert the watermark code ensuring it appears before the main content of the page. Utilize CSS properties like position, top, left, and opacity to position the watermark precisely where desired on the page.
For added customization, consider defining additional CSS rules either inline or within an external stylesheet. This allows you to fine-tune the watermark's appearance, adjusting its opacity, size, or position to suit your preferences and branding requirements.
By implementing watermarks in PDF reports, a consistent brand presence is established, unauthorized distribution or replication of documents is deterred, and the overall professionalism of business communications is enhanced. With Odoo 17's flexibility and customization options, adding watermarks becomes a seamless and effective solution for businesses looking to elevate their document management practices.


If you need any assistance in odoo, we are online, please chat with us.



0
Comments



Leave a comment

 


whatsapp
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message