How to Add Image Watermark in Presentation using Java

In this quick tutorial, you will learn how to add image watermark in presentation using Java. It will help you to protect presentation by adding image watermark in Java such that the desired image is loaded from the disc and added at different positions and angles in selected or all slides. In the final step, this updated presentation will be saved as PPTX however it can be saved in any file format supported by MS PowerPoint.

Steps to Add Image Watermark in Presentation using Java

  1. Install Aspose.Slides from the Maven repository to add watermark in presentation
  2. Load the PPTX file into the Presentation class object for adding an image watermark
  3. Load the image to be added as a watermark in the presentation
  4. Add this image to the presentation images collection
  5. Iterate through the master slides in the presentation
  6. Add a picture frame with the watermark image to the shapes collection in each slide
  7. Set the position and rotation angle of the picture frame
  8. Save the updated presentation having an image watermark on each slide

In these steps, first the presentation and the image to be added as watermark are loaded. This image is added to the images collection of the presentation that is later used by the shape picture frame for displaying it. You can set the shape position and rotation angle before saving the modified presentation having the watermark.

Code to Insert Image Watermark in Presentation using Java

In this code sample, we set the picture frame position and rotation angle however, you can also set the shape locks to avoid modification in the watermark.

This code snippet can be used to add image watermark in presentation in Java. If you want to perform other operations like converting the presentation to some other format like XPS, refer to the article on how to convert PPTX to XPS using Java.

 English