Watermarks in Word documents serve as overlayed text or pictures that are typically used to indicate documents’ status, confidentiality, draft nature, etc. While they are useful in certain contexts, watermarks often become a hindrance when it comes to presenting documents. They can be distracting, obscuring the readability, and reduce the overall quality of the document. This article will show how to remove watermarks from Word documents in Python programs using Spire.Doc for Python.
Install Spire.Doc for Python
This scenario requires Spire.Doc for Python and plum-dispatch v1.7.4. They can be easily installed in your Windows through the following pip commands.
pip install Spire.Doc
If you are unsure how to install, please refer to this tutorial: How to Install Spire.Doc for Python on Windows
Remove the Watermark from a Word Document
Spire.Doc for Python provides the Document.Watermark property which allows users to deal with the watermark of a Word document. Users can assign a null value to this property to remove the watermark of Word document. The detailed steps are as follows:
- Create an object of Document class.
- Load a Word document using Document.LoadFromFile() method.
- Remove the watermark by assigning a null value to Document.Watermark property.
- Save the document using Document.SaveToFile() method.
- Python
from spire.doc import * from spire.doc.common import * # Create an object of Document class doc = Document() # Load a Word document doc.LoadFromFile("Sample.docx") # Remove the watermark doc.Watermark = None # Save the document doc.SaveToFile("output/RemoveWatermark.docx", FileFormat.Auto)
Apply for a Temporary License
If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.