This short tutorial explains the process to remove a watermark in Word using Java. It provides the details to set the IDE, a list of steps, and a sample code demonstrating how to delete watermark in Word using Java by using a few API calls. You can remove the text and image watermarks by slight variations in the code.
Steps to Remove a Watermark From a Word Document using Java
- Setup the IDE for working with Aspose.Words for Java API to remove a watermark
- Load the source Word file having a text or image watermark in it
- Check the type of the Watermark property of the document
- Call the remove() method if type is TEXT
- Save the output Word file
Here is a step-by-step procedure showing how to remove a watermark from a Word document using Java. Load the source Word file into a Document class object, check the watermark type of the loaded Word file, and call the remove() method if a watermark is present in the file. Save the output Word file after erasing the Watermark.
Code to Remove Word Watermark using Java
This code snippet demonstrates how to remove draft watermark in Word using Java. There can be two types of watermarks in a Word file i.e. IMAGE or TEXT. You can delete these watermarks by just checking the watermark type against IMAGE or TEXT and calling the same method remove() to erase it.
This article has taught us the process of removing a watermark. If you want to unprotect a Word file, refer to the article on How to unprotect Word file in Java.