Add Watermark to ODP Presentation using Java

Build Java applications that insert text or image watermarks into presentation files using server-side APIs.

Add Watermark to ODP Presentation via Java

Using Aspose.Slides for Java , you can add text and image watermarks to ODP presentations. Add a watermark shape to a master slide so the watermark appears on slides that use that master.

Add Text Watermark to ODP using Java

Presentation presentation = new Presentation("presentation.odp");
try {
    IMasterSlide masterSlide = presentation.getMasters().get_Item(0);
    IAutoShape watermarkShape = masterSlide.getShapes().addAutoShape(ShapeType.Rectangle, 100, 100, 400, 120);
    ITextFrame watermarkTextFrame = watermarkShape.addTextFrame("Watermark");
    watermarkTextFrame.getParagraphs().get_Item(0).getPortions().get_Item(0).getPortionFormat().setFontHeight(48);

    presentation.save("watermark.odp", SaveFormat.Odp);
} finally {
    presentation.dispose();
}

Add Image Watermark to ODP Presentation using Java

Presentation presentation = new Presentation("presentation.odp");
try {
    byte[] imageData = Files.readAllBytes(Paths.get("watermark.png"));
    IPPImage watermarkImage = presentation.getImages().addImage(imageData);
    IMasterSlide masterSlide = presentation.getMasters().get_Item(0);
    IAutoShape watermarkShape = masterSlide.getShapes().addAutoShape(ShapeType.Rectangle, 100, 100, 300, 200);

    watermarkShape.getFillFormat().setFillType(FillType.Picture);
    watermarkShape.getFillFormat().getPictureFillFormat().getPicture().setImage(watermarkImage);
    watermarkShape.getFillFormat().getPictureFillFormat().setPictureFillMode(PictureFillMode.Stretch);

    presentation.save("image-watermark.odp", SaveFormat.Odp);
} finally {
    presentation.dispose();
}

How to Add Watermark to ODP via Java

Follow these steps to add a text or image watermark to ODP files.

  1. Load the ODP file with the Presentation class.
  2. Select a master slide through the getMasters method.
  3. Call the addAutoShape method to add a watermark shape.
  4. Call the addTextFrame method to add watermark text or use addImage for an image watermark.
  5. Save the watermarked presentation in ODP format.

Built with Aspose.Slides

Add Watermarks to ODP Online

The free Aspose.Slides Watermark app is built with Aspose.Slides for Java, the same API as the code above. Open it and see what the API can do with your own ODP files.

  • Runs in your browser, nothing to install.
  • See how Aspose.Slides adds watermarks before you write code.
  • Add a text or image watermark to your ODP file.
  • Download the watermarked file.

Other Supported Watermark Formats

Using Java, you can also add watermarks to the following formats.