How to add an image watermark in a standard Print Format using the "Print" button?

Hi everyone,

I’m working on an ERPNext standard Print Format (Sales Invoice) and would like to add a background image (watermark) that appears when users click the standard Print button.

Currently, I’m using the following HTML:

<img src="{{ frappe.utils.get_url('/files/watermark.png') }}" class="print-watermark">

or

.print-watermark {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0.1;
    z-index: -1;
}

However, the watermark image does not appear in the generated PDF/print preview when using the standard Print button.

My questions are:

  1. Is there a supported way to add a full-page background image or watermark in a standard ERPNext Print Format?

  2. Does wkhtmltopdf support background images or fixed-position watermark images?

  3. Is there a recommended approach (CSS, HTML, Letter Head, or another method) to display a watermark on every printed page?

  4. If anyone has implemented this successfully, could you please share an example?

I’m using:

  • ERPNext v15

  • Frappe Framework v15

Any guidance or best practices would be appreciated. Thank you!