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(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.
|
getConsiderParentMargins, getHeight, getHorizontalAlignment, getMargins, getOpacity, getRotateAngle, getScaleFactor, getSizingType, getVerticalAlignment, getWidth, getX, getY, isBackground, setBackground, setConsiderParentMargins, setHeight, setHorizontalAlignment, setMargins, setOpacity, setRotateAngle, setScaleFactor, setSizingType, setVerticalAlignment, setWidth, setX, setY
public ImageWatermark(String filePath)
ImageWatermark
class with a specified file path.filePath
- The path to the image that will be used as watermark.public ImageWatermark(InputStream stream)
ImageWatermark
class with a specified stream.stream
- The stream containing the image that will be used as watermark.public final void close()
Disposes the current instance.
close
in interface Closeable
close
in interface AutoCloseable