public final class ImageWatermark extends Watermark implements Closeable
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 and Description |
|---|
ImageWatermark(InputStream stream)
Initializes a new instance of the
class with a specified stream. |
ImageWatermark(com.aspose.ms.System.IO.Stream stream) |
ImageWatermark(String filePath)
Initializes a new instance of the
class with a specified file path. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Disposes the current instance.
|
WatermarkGeometry |
createGeometry(ContentPartGeometry parent) |
Watermark |
deepClone() |
void |
dispose() |
SizeD |
getSize() |
StreamContainer |
getStream() |
StreamContainer |
getTransparentImageContainer() |
boolean |
hasSameValues(Watermark watermark) |
boolean |
isImageWatermark() |
boolean |
isTextWatermark() |
copyPropertiesValues, getConsiderParentMargins, getHeight, getHorizontalAlignment, getMargins, getOpacity, getPagesSetup, getRotateAngle, getScaleFactor, getSizingType, getTileOptions, getTransparency, getVerticalAlignment, getWidth, getX, getY, isBackground, setBackground, setConsiderParentMargins, setHeight, setHorizontalAlignment, setMargins, setOpacity, setPagesSetup, setRotateAngle, setScaleFactor, setSizingType, setTileOptions, setVerticalAlignment, setWidth, setX, setYpublic ImageWatermark(InputStream stream)
ImageWatermark class with a specified stream.stream - The stream containing the image that will be used as watermark.public ImageWatermark(com.aspose.ms.System.IO.Stream stream)
public ImageWatermark(String filePath)
ImageWatermark class with a specified file path.filePath - The path to the image that will be used as watermark.public final void close()
Disposes the current instance.
close in interface Closeableclose in interface AutoCloseablepublic WatermarkGeometry createGeometry(ContentPartGeometry parent)
createGeometry in class Watermarkpublic final void dispose()
public final StreamContainer getStream()
public final StreamContainer getTransparentImageContainer()
public boolean hasSameValues(Watermark watermark)
hasSameValues in class Watermarkpublic boolean isImageWatermark()
isImageWatermark in class Watermarkpublic boolean isTextWatermark()
isTextWatermark in class WatermarkCopyright © 2026. All rights reserved.