public abstract class WatermarkableImage extends ContentPart
Learn more:
The following example demonstrates how to add watermark to all images inside a document of any supported type.
Watermarker watermarker = new Watermarker("D:\\input.doc"); // Initialize text or image watermark. TextWatermark watermark = new TextWatermark("DRAFT", new Font("Arial", 19)); // Find all images in the content. WatermarkableImageCollection images = watermarker.getImages(); // Add watermark. for (WatermarkableImage watermarkableImage : images) { watermarkableImage.add(watermark); } // Save changes. watermarker.save("D:\\output.doc"); watermarker.close();
| Constructor and Description |
|---|
WatermarkableImage(Content content) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(Watermark watermark)
Adds a watermark to this
. |
byte[] |
getBytes()
Gets the image as byte array.
|
int |
getHeight()
Gets the height of this
in pixels. |
int |
getWidth()
Gets the width of this
in pixels. |
void |
updateDocumentReference(Content parentContent) |
addWatermark, afterWatermarkAdding, checkWatermarkingLicenseRestrictions, findImages, findImages, getParts, getSearchWatermarksInParts, getStrategyManager, getTopParent, search, search, setParts, tryGetWatermarkerSettingspublic WatermarkableImage(Content content)
public final void add(Watermark watermark)
WatermarkableImage.
This method assumes that watermark offset and size are measured in pixels (if they are assigned).
watermark - The watermark to add to the image.public final byte[] getBytes()
Gets the image as byte array.
public final int getHeight()
WatermarkableImage in pixels.WatermarkableImage in pixels.public final int getWidth()
WatermarkableImage in pixels.WatermarkableImage in pixels.public final void updateDocumentReference(Content parentContent)
Copyright © 2026. All rights reserved.