Tile watermarks in docx are not visible under images / tables / sometimes text

Hey, another issue that I’ve noticed is that tile watermarks in DOCX files are not visible in case they are under images / tables or even text (which is most crucial case for me).

I understand that it’s probably due to the implementation of the watermarks in DOCX, but the question is do you consider any of the cases a bug and do you have any workarounds / plans for fixing this and display watermark as a top layer?

Attaching screenshots of the cases:
Screenshot 2025-01-10 at 15.26.46.png (180.3 KB) - not visible under table
Screenshot 2025-01-10 at 15.28.14.jpg (74.6 KB) - not visible under image
Screenshot 2025-01-10 at 15.29.45.jpg (162.2 KB) - not visible under both image and text

Attaching also both input files from the code screenshots above:
input.docx (108.7 KB)
input2.docx (778.9 KB)

I’m using regular code from documentation for tile watermarking with latest version of python library (24.9.1).

Thanks for your response in advance :pray:

@artempenteskul

We are investigating this issue. Your investigation ticket ID is WATERMARKPYTHON-1. You’ll be notified in case of any update.

hi @artempenteskul,
Thank you for your question.

By default, if no specific pages are specified, it means the watermark should be applied to all pages in the document. In such cases, we create the watermark in the Header section, and Word automatically applies the header section to all pages. Since header text is typically placed above the document’s body content (including text and tables), the watermark is usually visible.

In your samples, however, the watermark is not visible because the input.docx file contains a table with white shading, and the input2.docx file uses white shading for the text as well. The Shading option effectively creates a “background” for the content, which prevents the header watermark from being visible on top. See screens (for opening Reveal Formatting panel in the Word need to select specific text and click shift + f1)
table_shadding.png (33.6 KB)

text_shadding.png (244.5 KB)

There is an option to create watermarks not in the header section, but directly in the document body. We typically use this approach when specific pages are configured through the PagesSetup option. In this case, watermark shapes are added to the selected pages and appear above other objects, even if they use shading colors.

To implement this, you would need to update the code as follows:

pages_setup = gww.PagesSetup()
pages_setup.pages = [1, 2, 3, 4]  
watermark.pages_setup = pages_setup
watermark.is_background = False

Currently, pages_setup.pages = [1, 2, 3, 4] requires you to specify all the document pages. If this approach works for you, we can plan to add an additional setting in the future that allows you to select the section (header or body) where the word watermark shape should be created, so that you won’t need to use PagesSetup when watermarking all pages.

Let us know if this approach works for your use case or if you need further assistance.