java.lang.Object
com.aspose.words.Watermark
public class Watermark
| Property Getters/Setters Summary | ||
|---|---|---|
int | getType() | |
| Gets the watermark type. The value of the property is WatermarkType integer constant. | ||
| Method Summary | ||
|---|---|---|
void | remove() | |
| Removes the watermark. | ||
void | setImage(java.awt.image.BufferedImage image) | |
| Adds Image watermark into the document. | ||
void | setImage(java.awt.image.BufferedImage image, ImageWatermarkOptions options) | |
| Adds Image watermark into the document. | ||
void | setText(java.lang.String text) | |
| Adds Text watermark into the document. | ||
void | setText(java.lang.String text, TextWatermarkOptions options) | |
| Adds Text watermark into the document. | ||
| Property Getters/Setters Detail |
|---|
getType | |
public int getType() | |
| Method Detail |
|---|
remove | |
public void remove() | |
Example:
Shows how to create and remove watermarks in the document.
Document doc = new Document();
doc.getWatermark().setText("Aspose Watermark");
TextWatermarkOptions textWatermarkOptions = new TextWatermarkOptions();
textWatermarkOptions.setFontFamily("Arial");
textWatermarkOptions.setFontSize(36f);
textWatermarkOptions.setColor(Color.BLACK);
textWatermarkOptions.setLayout(WatermarkLayout.HORIZONTAL);
textWatermarkOptions.isSemitrasparent(false);
doc.getWatermark().setText("Aspose Watermark", textWatermarkOptions);
ImageWatermarkOptions imageWatermarkOptions = new ImageWatermarkOptions();
imageWatermarkOptions.setScale(5.0);
imageWatermarkOptions.isWashout(false);
doc.getWatermark().setImage(ImageIO.read(new File(getImageDir() + "Logo.jpg")), imageWatermarkOptions);
if (doc.getWatermark().getType() == WatermarkType.TEXT)
doc.getWatermark().remove();setImage | |
public void setImage(java.awt.image.BufferedImage image)
throws java.lang.Exception | |
image - Image that is displayed as a watermark.setImage | |
public void setImage(java.awt.image.BufferedImage image, ImageWatermarkOptions options) throws java.lang.Exception | |
image - Image that is displayed as a watermark.options - Defines additional options for the image watermark.Example:
Shows how to create and remove watermarks in the document.
Document doc = new Document();
doc.getWatermark().setText("Aspose Watermark");
TextWatermarkOptions textWatermarkOptions = new TextWatermarkOptions();
textWatermarkOptions.setFontFamily("Arial");
textWatermarkOptions.setFontSize(36f);
textWatermarkOptions.setColor(Color.BLACK);
textWatermarkOptions.setLayout(WatermarkLayout.HORIZONTAL);
textWatermarkOptions.isSemitrasparent(false);
doc.getWatermark().setText("Aspose Watermark", textWatermarkOptions);
ImageWatermarkOptions imageWatermarkOptions = new ImageWatermarkOptions();
imageWatermarkOptions.setScale(5.0);
imageWatermarkOptions.isWashout(false);
doc.getWatermark().setImage(ImageIO.read(new File(getImageDir() + "Logo.jpg")), imageWatermarkOptions);
if (doc.getWatermark().getType() == WatermarkType.TEXT)
doc.getWatermark().remove();setText | |
public void setText(java.lang.String text) | |
text - Text that is displayed as a watermark.Example:
Shows how to create and remove watermarks in the document.
Document doc = new Document();
doc.getWatermark().setText("Aspose Watermark");
TextWatermarkOptions textWatermarkOptions = new TextWatermarkOptions();
textWatermarkOptions.setFontFamily("Arial");
textWatermarkOptions.setFontSize(36f);
textWatermarkOptions.setColor(Color.BLACK);
textWatermarkOptions.setLayout(WatermarkLayout.HORIZONTAL);
textWatermarkOptions.isSemitrasparent(false);
doc.getWatermark().setText("Aspose Watermark", textWatermarkOptions);
ImageWatermarkOptions imageWatermarkOptions = new ImageWatermarkOptions();
imageWatermarkOptions.setScale(5.0);
imageWatermarkOptions.isWashout(false);
doc.getWatermark().setImage(ImageIO.read(new File(getImageDir() + "Logo.jpg")), imageWatermarkOptions);
if (doc.getWatermark().getType() == WatermarkType.TEXT)
doc.getWatermark().remove();setText | |
public void setText(java.lang.String text, TextWatermarkOptions options) | |
text - Text that is displayed as a watermark.options - Defines additional options for the text watermark.Example:
Shows how to create and remove watermarks in the document.
Document doc = new Document();
doc.getWatermark().setText("Aspose Watermark");
TextWatermarkOptions textWatermarkOptions = new TextWatermarkOptions();
textWatermarkOptions.setFontFamily("Arial");
textWatermarkOptions.setFontSize(36f);
textWatermarkOptions.setColor(Color.BLACK);
textWatermarkOptions.setLayout(WatermarkLayout.HORIZONTAL);
textWatermarkOptions.isSemitrasparent(false);
doc.getWatermark().setText("Aspose Watermark", textWatermarkOptions);
ImageWatermarkOptions imageWatermarkOptions = new ImageWatermarkOptions();
imageWatermarkOptions.setScale(5.0);
imageWatermarkOptions.isWashout(false);
doc.getWatermark().setImage(ImageIO.read(new File(getImageDir() + "Logo.jpg")), imageWatermarkOptions);
if (doc.getWatermark().getType() == WatermarkType.TEXT)
doc.getWatermark().remove();