Watermarks in word processing document
Leave feedback
On this page
When adding a watermark in Microsoft Word, a shape with appropriate content is placed in section headers. GroupDocs.Watermark uses the same approach. When calling add
on Watermarker
, a shape is added to the document.
This sample sets additional shape watermark properties such as name and alternative text when inserting it.
Set additional options like name
and alternative_text
when adding a shape watermark.
import groupdocs.watermark as gw
import groupdocs.watermark.watermarks as gww
import groupdocs.watermark.options.wordprocessing as gwo_wp
import groupdocs.watermark.common as gwc
load_options = gw.WordProcessingLoadOptions()
with gw.Watermarker("document.docx", load_options) as watermarker:
watermark = gww.TextWatermark("Test watermark", gww.Font("Arial", 19.0))
watermark.vertical_alignment = gwc.VerticalAlignment.CENTER
watermark.horizontal_alignment = gwc.HorizontalAlignment.CENTER
watermark.rotate_angle = 25.0
watermark.foreground_color = gww.Color.red
watermark.opacity = 1.0
options = gwo_wp.WordProcessingWatermarkSectionOptions()
options.name = "Shape 1"
options.alternative_text = "Test watermark"
watermarker.add(watermark, options)
watermarker.save("document.docx")
This sample enables and configures line and outline effects for text-based shape watermarks.
Apply text effects to shape watermarks.
import groupdocs.watermark as gw
import groupdocs.watermark.watermarks as gww
import groupdocs.watermark.options.wordprocessing as gwo_wp
import groupdocs.watermark.common as gwc
load_options = gw.WordProcessingLoadOptions()
with gw.Watermarker("document.docx", load_options) as watermarker:
watermark = gww.TextWatermark("Test watermark", gww.Font("Arial", 19.0))
effects = gwo_wp.WordProcessingTextEffects()
effects.line_format.enabled = True
effects.line_format.color = gww.Color.red
effects.line_format.dash_style = gwc.OfficeDashStyle.DASH_DOT_DOT
effects.line_format.line_style = gwc.OfficeLineStyle.TRIPLE
effects.line_format.weight = 1
options = gwo_wp.WordProcessingWatermarkSectionOptions()
options.effects = effects
watermarker.add(watermark, options)
watermarker.save("document.docx")
This sample applies image effects (brightness, contrast, chroma key, border) to image-based shape watermarks.
Apply image effects to image-based shape watermarks.
import groupdocs.watermark as gw
import groupdocs.watermark.watermarks as gww
import groupdocs.watermark.options.wordprocessing as gwo_wp
load_options = gw.WordProcessingLoadOptions()
with gw.Watermarker("document.docx", load_options) as watermarker:
with gww.ImageWatermark("logo.png") as watermark:
effects = gwo_wp.WordProcessingImageEffects()
effects.brightness = 0.7
effects.contrast = 0.6
effects.chroma_key = gww.Color.red
effects.border_line_format.enabled = True
effects.border_line_format.weight = 1
options = gwo_wp.WordProcessingWatermarkSectionOptions()
options.effects = effects
watermarker.add(watermark, options)
watermarker.save("document.docx")
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.