com.groupdocs.watermark.watermarks

Class ImageWatermark

  • All Implemented Interfaces:
    Closeable, AutoCloseable


    public final class ImageWatermark
    extends Watermark
    implements Closeable
    Represents an image watermark.

    Learn more:

    The following example demonstrates how to add image watermark to a document of any supported type.

    Watermarker watermarker = new Watermarker("C:\\test.some_ext");
       ImageWatermark watermark = new ImageWatermark("C:\\watermark.png");
    
       watermark.setHorizontalAlignment(HorizontalAlignment.Center);
       watermark.setVerticalAlignment(VerticalAlignment.Center);
       watermarker.add(watermark);
    
       watermarker.save("C:\\modified_test.some_ext");
       watermark.close();
       watermarker.close();
     
    • Constructor Detail

      • ImageWatermark

        public ImageWatermark(String filePath)
        Initializes a new instance of the ImageWatermark class with a specified file path.
        Parameters:
        filePath - The path to the image that will be used as watermark.
      • ImageWatermark

        public ImageWatermark(InputStream stream)
        Initializes a new instance of the ImageWatermark class with a specified stream.
        Parameters:
        stream - The stream containing the image that will be used as watermark.
    • Method Detail

      • close

        public final void close()

        Disposes the current instance.

        Specified by:
        close in interface Closeable
        Specified by:
        close in interface AutoCloseable