Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aspose-com-gists/bfe6353776cd117151b439827d919697 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/bfe6353776cd117151b439827d919697 to your computer and use it in GitHub Desktop.
How to Insert Watermark in Word Document using Python
# Load a Word document
doc = aw.Document("Document.docx");
# Specify watermark options for image
options = aw.ImageWatermarkOptions()
options.scale = 3
options.is_washout = False
# Provide the image path
doc.watermark.set_image("logo.png", options);
# Save the document
doc.save("AddImageWatermark_out.docx");
# Load a Word document
doc = aw.Document("Document.docx")
# Specify watermark options for text
options = aw.TextWatermarkOptions()
options.font_family = "Arial"
options.font_size = 72
options.color = drawing.Color.black
options.layout = aw.WatermarkLayout.DIAGONAL
options.is_semitrasparent = True
# Specify the text to show as a watermark
doc.watermark.set_text("CONFIDENTIAL", options);
# Save the document
doc.save("AddTextWatermark_out.docx");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment