public class ImageWatermarkOptions
extends java.lang.Object
To learn more, visit the Working with Watermark documentation article.
Examples:
Shows how to create a watermark from an image in the local file system.
Document doc = new Document();
// Modify the image watermark's appearance with an ImageWatermarkOptions object,
// then pass it while creating a watermark from an image file.
ImageWatermarkOptions imageWatermarkOptions = new ImageWatermarkOptions();
imageWatermarkOptions.setScale(5.0);
imageWatermarkOptions.isWashout(false);
// We have a different options to insert image:
doc.getWatermark().setImage(ImageIO.read(new File(getImageDir() + "Logo.jpg")), imageWatermarkOptions);
doc.getWatermark().setImage(ImageIO.read(new File(getImageDir() + "Logo.jpg")));
doc.getWatermark().setImage(getImageDir() + "Logo.jpg", imageWatermarkOptions);
doc.save(getArtifactsDir() + "Document.ImageWatermark.docx");
| Modifier and Type | Method and Description |
|---|---|
double |
getScale()
Gets the scale factor expressed as a fraction of the image.
|
boolean |
isWashout()
Gets a boolean value which is responsible for washout effect of the watermark.
|
void |
isWashout(boolean value)
Sets a boolean value which is responsible for washout effect of the watermark.
|
void |
setScale(double value)
Sets the scale factor expressed as a fraction of the image.
|
public double getScale()
java.lang.IllegalArgumentException - Throws when argument was out of the range of valid values.
Remarks:
Valid values range from 0 to 65.5 inclusive.
Auto scale means that the watermark will be scaled to its max width and max height relative to the page margins.
Examples:
Shows how to create a watermark from an image in the local file system.
Document doc = new Document();
// Modify the image watermark's appearance with an ImageWatermarkOptions object,
// then pass it while creating a watermark from an image file.
ImageWatermarkOptions imageWatermarkOptions = new ImageWatermarkOptions();
imageWatermarkOptions.setScale(5.0);
imageWatermarkOptions.isWashout(false);
// We have a different options to insert image:
doc.getWatermark().setImage(ImageIO.read(new File(getImageDir() + "Logo.jpg")), imageWatermarkOptions);
doc.getWatermark().setImage(ImageIO.read(new File(getImageDir() + "Logo.jpg")));
doc.getWatermark().setImage(getImageDir() + "Logo.jpg", imageWatermarkOptions);
doc.save(getArtifactsDir() + "Document.ImageWatermark.docx");
public void setScale(double value)
value - The scale factor expressed as a fraction of the image.java.lang.IllegalArgumentException - Throws when argument was out of the range of valid values.
Remarks:
Valid values range from 0 to 65.5 inclusive.
Auto scale means that the watermark will be scaled to its max width and max height relative to the page margins.
Examples:
Shows how to create a watermark from an image in the local file system.
Document doc = new Document();
// Modify the image watermark's appearance with an ImageWatermarkOptions object,
// then pass it while creating a watermark from an image file.
ImageWatermarkOptions imageWatermarkOptions = new ImageWatermarkOptions();
imageWatermarkOptions.setScale(5.0);
imageWatermarkOptions.isWashout(false);
// We have a different options to insert image:
doc.getWatermark().setImage(ImageIO.read(new File(getImageDir() + "Logo.jpg")), imageWatermarkOptions);
doc.getWatermark().setImage(ImageIO.read(new File(getImageDir() + "Logo.jpg")));
doc.getWatermark().setImage(getImageDir() + "Logo.jpg", imageWatermarkOptions);
doc.save(getArtifactsDir() + "Document.ImageWatermark.docx");
public boolean isWashout()
true.
Examples:
Shows how to create a watermark from an image in the local file system.
Document doc = new Document();
// Modify the image watermark's appearance with an ImageWatermarkOptions object,
// then pass it while creating a watermark from an image file.
ImageWatermarkOptions imageWatermarkOptions = new ImageWatermarkOptions();
imageWatermarkOptions.setScale(5.0);
imageWatermarkOptions.isWashout(false);
// We have a different options to insert image:
doc.getWatermark().setImage(ImageIO.read(new File(getImageDir() + "Logo.jpg")), imageWatermarkOptions);
doc.getWatermark().setImage(ImageIO.read(new File(getImageDir() + "Logo.jpg")));
doc.getWatermark().setImage(getImageDir() + "Logo.jpg", imageWatermarkOptions);
doc.save(getArtifactsDir() + "Document.ImageWatermark.docx");
public void isWashout(boolean value)
true.
Examples:
Shows how to create a watermark from an image in the local file system.
Document doc = new Document();
// Modify the image watermark's appearance with an ImageWatermarkOptions object,
// then pass it while creating a watermark from an image file.
ImageWatermarkOptions imageWatermarkOptions = new ImageWatermarkOptions();
imageWatermarkOptions.setScale(5.0);
imageWatermarkOptions.isWashout(false);
// We have a different options to insert image:
doc.getWatermark().setImage(ImageIO.read(new File(getImageDir() + "Logo.jpg")), imageWatermarkOptions);
doc.getWatermark().setImage(ImageIO.read(new File(getImageDir() + "Logo.jpg")));
doc.getWatermark().setImage(getImageDir() + "Logo.jpg", imageWatermarkOptions);
doc.save(getArtifactsDir() + "Document.ImageWatermark.docx");
value - A boolean value which is responsible for washout effect of the watermark.