com.aspose.words

Class ImageWatermarkOptions

  • java.lang.Object
    • com.aspose.words.ImageWatermarkOptions
public class ImageWatermarkOptions 
extends java.lang.Object

Contains options that can be specified when adding a watermark with image.

Constructor Summary
 
Property Getters/Setters Summary
booleanisWashout()
void
isWashout(booleanvalue)
           Gets or sets a boolean value which is responsible for washout effect of the watermark. The default value is True.
doublegetScale()
void
setScale(doublevalue)
           Gets or sets the scale factor expressed as a fraction of the image. The default value is 0 - auto.
 

    • Constructor Detail

      • ImageWatermarkOptions

        public ImageWatermarkOptions()
    • Property Getters/Setters Detail

      • isWashout/isWashout

        public boolean isWashout() / public void isWashout(boolean value)
        
        Gets or sets a boolean value which is responsible for washout effect of the watermark. The default value is True.

        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();
      • getScale/setScale

        public double getScale() / public void setScale(double value)
        
        Gets or sets the scale factor expressed as a fraction of the image. The default value is 0 - auto.

        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.

        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();