ImageWatermark

Inheritance: java.lang.Object, com.groupdocs.watermark.Watermark

All Implemented Interfaces: java.io.Closeable

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();

Constructors

Constructor Description
ImageWatermark(String filePath) Initializes a new instance of the [ImageWatermark](../../com.groupdocs.watermark.watermarks/imagewatermark) class with a specified file path.
ImageWatermark(InputStream stream) Initializes a new instance of the [ImageWatermark](../../com.groupdocs.watermark.watermarks/imagewatermark) class with a specified stream.
ImageWatermark(System.IO.Stream stream)

Methods

Method Description
isImageWatermark()
isTextWatermark()
getStream()
getTransparentImageContainer()
getSize()
dispose()
deepClone()
hasSameValues(Watermark watermark)
createGeometry(ContentPartGeometry parent)
close() Disposes the current instance.

ImageWatermark(String filePath)

public ImageWatermark(String filePath)

Initializes a new instance of the [ImageWatermark](../../com.groupdocs.watermark.watermarks/imagewatermark) class with a specified file path.

Parameters:

Parameter Type Description
filePath java.lang.String The path to the image that will be used as watermark.

ImageWatermark(InputStream stream)

public ImageWatermark(InputStream stream)

Initializes a new instance of the [ImageWatermark](../../com.groupdocs.watermark.watermarks/imagewatermark) class with a specified stream.

Parameters:

Parameter Type Description
stream java.io.InputStream The stream containing the image that will be used as watermark.

ImageWatermark(System.IO.Stream stream)

public ImageWatermark(System.IO.Stream stream)

Parameters:

Parameter Type Description
stream com.aspose.ms.System.IO.Stream

isImageWatermark()

public boolean isImageWatermark()

Returns: boolean

isTextWatermark()

public boolean isTextWatermark()

Returns: boolean

getStream()

public final StreamContainer getStream()

Returns: StreamContainer

getTransparentImageContainer()

public final StreamContainer getTransparentImageContainer()

Returns: StreamContainer

getSize()

public SizeD getSize()

Returns: SizeD

dispose()

public final void dispose()

deepClone()

public Watermark deepClone()

Returns: Watermark

hasSameValues(Watermark watermark)

public boolean hasSameValues(Watermark watermark)

Parameters:

Parameter Type Description
watermark Watermark

Returns: boolean

createGeometry(ContentPartGeometry parent)

public WatermarkGeometry createGeometry(ContentPartGeometry parent)

Parameters:

Parameter Type Description
parent ContentPartGeometry

Returns: WatermarkGeometry

close()

public final void close()

Disposes the current instance.