com.aspose.words

Class WatermarkType

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

Utility class containing constants. Specifies the watermark type.

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

Field Summary
static final intTEXT = 0
Indicates that the text will be used as a watermark.

Such a watermark corresponds to a WordArt object.

static final intIMAGE = 1
Indicates that the image will be used as a watermark.

Such a watermark corresponds to a shape with image.

static final intNONE = 2
Indicates watermark is no set.
 

    • Field Detail

      • TEXT = 0

        public static final int TEXT
        Indicates that the text will be used as a watermark.

        Such a watermark corresponds to a WordArt object.

      • IMAGE = 1

        public static final int IMAGE
        Indicates that the image will be used as a watermark.

        Such a watermark corresponds to a shape with image.

      • NONE = 2

        public static final int NONE
        Indicates watermark is no set.