@Deprecated public abstract class WatermarkableImage extends DocumentPart
Represents an image inside a document.
This example demonstrates how to add watermark to all images inside a document of any supported type.
Document document = Document.load("D:\\input.doc"); // Initialize text or image watermark. TextWatermark watermark = new TextWatermark("DRAFT", new Font("Arial", 19)); // Find all images in the document. WatermarkableImageCollection images = document.findImages(); // Add watermark. for (WatermarkableImage watermarkableImage : images) { watermarkableImage.addWatermark(watermark); } // Save changes. document.save("D:\\output.doc"); document.close();
Modifier and Type | Method and Description |
---|---|
void |
addWatermark(Watermark watermark)
Deprecated.
Adds a watermark to this
WatermarkableImage . |
byte[] |
getBytes()
Deprecated.
Gets the image as byte array.
|
int |
getHeight()
Deprecated.
Gets the height of this
WatermarkableImage in pixels. |
int |
getWidth()
Deprecated.
Gets the width of this
WatermarkableImage in pixels. |
findImages, findImages, findWatermarks, findWatermarks
public final int getHeight()
Gets the height of this WatermarkableImage
in pixels.
WatermarkableImage
in pixels.public final int getWidth()
Gets the width of this WatermarkableImage
in pixels.
WatermarkableImage
in pixels.public void addWatermark(Watermark watermark)
Adds a watermark to this WatermarkableImage
.
This method assumes that watermark offset and size are measured in pixels (if they are assigned).
addWatermark
in class DocumentPart
watermark
- The watermark to add to the image.public final byte[] getBytes()
Gets the image as byte array.