public class TextWatermarkOptions
Constructor Summary |
---|
Property Getters/Setters Summary | ||
---|---|---|
java.awt.Color | getColor() | |
void | setColor(java.awt.Colorvalue) | |
Gets or sets font color. The default value is Color.Silver. | ||
java.lang.String | getFontFamily() | |
void | setFontFamily(java.lang.Stringvalue) | |
Gets or sets font family name. The default value is "Calibri". | ||
float | getFontSize() | |
void | setFontSize(floatvalue) | |
Gets or sets a font size. The default value is 0 - auto. | ||
boolean | isSemitrasparent() | |
void | isSemitrasparent(booleanvalue) | |
Gets or sets a boolean value which is responsible for opacity of the watermark. The default value is True. | ||
int | getLayout() | |
void | setLayout(intvalue) | |
Gets or sets layout of the watermark. The default value is |
public java.awt.Color getColor() / public void setColor(java.awt.Color value)
Example:
Shows how to create a text watermark.Document doc = new Document(); // Add a plain text watermark. doc.getWatermark().setText("Aspose Watermark"); // If we wish to edit the text formatting using it as a watermark, // we can do so by passing a TextWatermarkOptions object when creating the watermark. TextWatermarkOptions textWatermarkOptions = new TextWatermarkOptions(); textWatermarkOptions.setFontFamily("Arial"); textWatermarkOptions.setFontSize(36f); textWatermarkOptions.setColor(Color.BLACK); textWatermarkOptions.setLayout(WatermarkLayout.DIAGONAL); textWatermarkOptions.isSemitrasparent(false); doc.getWatermark().setText("Aspose Watermark", textWatermarkOptions); doc.save(getArtifactsDir() + "Document.TextWatermark.docx"); // We can remove a watermark from a document like this. if (doc.getWatermark().getType() == WatermarkType.TEXT) doc.getWatermark().remove();
public java.lang.String getFontFamily() / public void setFontFamily(java.lang.String value)
Example:
Shows how to create a text watermark.Document doc = new Document(); // Add a plain text watermark. doc.getWatermark().setText("Aspose Watermark"); // If we wish to edit the text formatting using it as a watermark, // we can do so by passing a TextWatermarkOptions object when creating the watermark. TextWatermarkOptions textWatermarkOptions = new TextWatermarkOptions(); textWatermarkOptions.setFontFamily("Arial"); textWatermarkOptions.setFontSize(36f); textWatermarkOptions.setColor(Color.BLACK); textWatermarkOptions.setLayout(WatermarkLayout.DIAGONAL); textWatermarkOptions.isSemitrasparent(false); doc.getWatermark().setText("Aspose Watermark", textWatermarkOptions); doc.save(getArtifactsDir() + "Document.TextWatermark.docx"); // We can remove a watermark from a document like this. if (doc.getWatermark().getType() == WatermarkType.TEXT) doc.getWatermark().remove();
public float getFontSize() / public void setFontSize(float value)
Valid values range from 0 to 65.5 inclusive.
Auto font size means that the watermark will be scaled to its max width and max height relative to the page margins.
Example:
Shows how to create a text watermark.Document doc = new Document(); // Add a plain text watermark. doc.getWatermark().setText("Aspose Watermark"); // If we wish to edit the text formatting using it as a watermark, // we can do so by passing a TextWatermarkOptions object when creating the watermark. TextWatermarkOptions textWatermarkOptions = new TextWatermarkOptions(); textWatermarkOptions.setFontFamily("Arial"); textWatermarkOptions.setFontSize(36f); textWatermarkOptions.setColor(Color.BLACK); textWatermarkOptions.setLayout(WatermarkLayout.DIAGONAL); textWatermarkOptions.isSemitrasparent(false); doc.getWatermark().setText("Aspose Watermark", textWatermarkOptions); doc.save(getArtifactsDir() + "Document.TextWatermark.docx"); // We can remove a watermark from a document like this. if (doc.getWatermark().getType() == WatermarkType.TEXT) doc.getWatermark().remove();
public boolean isSemitrasparent() / public void isSemitrasparent(boolean value)
Example:
Shows how to create a text watermark.Document doc = new Document(); // Add a plain text watermark. doc.getWatermark().setText("Aspose Watermark"); // If we wish to edit the text formatting using it as a watermark, // we can do so by passing a TextWatermarkOptions object when creating the watermark. TextWatermarkOptions textWatermarkOptions = new TextWatermarkOptions(); textWatermarkOptions.setFontFamily("Arial"); textWatermarkOptions.setFontSize(36f); textWatermarkOptions.setColor(Color.BLACK); textWatermarkOptions.setLayout(WatermarkLayout.DIAGONAL); textWatermarkOptions.isSemitrasparent(false); doc.getWatermark().setText("Aspose Watermark", textWatermarkOptions); doc.save(getArtifactsDir() + "Document.TextWatermark.docx"); // We can remove a watermark from a document like this. if (doc.getWatermark().getType() == WatermarkType.TEXT) doc.getWatermark().remove();
public int getLayout() / public void setLayout(int value)
Example:
Shows how to create a text watermark.Document doc = new Document(); // Add a plain text watermark. doc.getWatermark().setText("Aspose Watermark"); // If we wish to edit the text formatting using it as a watermark, // we can do so by passing a TextWatermarkOptions object when creating the watermark. TextWatermarkOptions textWatermarkOptions = new TextWatermarkOptions(); textWatermarkOptions.setFontFamily("Arial"); textWatermarkOptions.setFontSize(36f); textWatermarkOptions.setColor(Color.BLACK); textWatermarkOptions.setLayout(WatermarkLayout.DIAGONAL); textWatermarkOptions.isSemitrasparent(false); doc.getWatermark().setText("Aspose Watermark", textWatermarkOptions); doc.save(getArtifactsDir() + "Document.TextWatermark.docx"); // We can remove a watermark from a document like this. if (doc.getWatermark().getType() == WatermarkType.TEXT) doc.getWatermark().remove();