Add Watermark to Word DOCX Java

Watermarks are added to the Word documents for various purposes such as preventing illegal usage, defining the ownership, displaying the document’s status, etc. In this article, you will learn how to add a watermark to Word documents using Java. The article will demonstrate the insertion of text and image watermarks into a Word document separately.

Java API to Add Watermark in Word Documents

In order to add watermarks to the Word documents, we will use Aspose.Words for Java. It is a feature-rich API that lets you create word processing documents from scratch. Also, it allows you to manipulate the existing Word documents quite easily. You can either download the API or install it using the following Maven configurations.

<repository>
    <id>AsposeJavaAPI</id>
    <name>Aspose Java API</name>
    <url>https://repository.aspose.com/repo/</url>
</repository>
<dependency>
    <groupId>com.aspose</groupId>
    <artifactId>aspose-words</artifactId>
    <version>21.7</version>
    <type>pom</type>
</dependency>

Add Text Watermark to a Word Document in Java

The following are the steps to insert a text watermark into a Word document using Java.

The following code sample shows how to add a text watermark to a Word document.

The following is the screenshot of a Word document after adding the text watermark.

Add text watermark to Word in Java

Add Image Watermark to a Word Document

The following are the steps to add an image watermark to a Word document using Java.

The following code sample shows how to add an image watermark to the Word document.

The following is the screenshot of a Word document after adding the image watermark.

Add image watermark to Word in Java

Get a Free API License

You can get a temporary license in order to use the API without evaluation limitations.

Conclusion

In this article, you have learned how to add a watermark to Word documents using Java. The steps and code samples have demonstrated how to insert a text or image watermark into a Word document. You can learn more about the Java word processing API using the documentation. In case you would have any questions, feel free to let us know via our forum.

See Also