com.groupdocs.watermark

Interfaces

Classes

Exceptions

com.groupdocs.watermark

Class TextWatermark



  • public class TextWatermark
    extends Watermark

    Represents a text watermark.

    This example demonstrates how to add text watermark to a document of any supported format.

    Document document = Document.load("D:\\input.doc");
      
      // Create TextWatermark instance.
      TextWatermark watermark = new TextWatermark("Test watermark", new Font("Arial", 42));
      
      // Add watermark to the document.
      document.addWatermark(watermark);
      
      document.save("D:\\output.doc");
      document.close();
      
    • Constructor Detail

      • TextWatermark

        public TextWatermark(String text,
                     Font font)

        Initializes a new instance of the TextWatermark class.

        Parameters:
        text - The text to be used as watermark.
        font - The font of the text.
    • Method Detail

      • getText

        public final String getText()

        Gets the text to be used as watermark.

        Returns:
        The string representing watermark text.
      • setText

        public final void setText(String value)

        Sets the text to be used as watermark.

        Parameters:
        value - The string representing watermark text.
      • getFont

        public final Font getFont()

        Gets the font of the text.

        Returns:
        The font of the text.
      • setFont

        public final void setFont(Font value)

        Sets the font of the text.

        Parameters:
        value - The font of the text.
      • getForegroundColor

        public final Color getForegroundColor()

        Gets the foreground color of the text.

        Returns:
        The foreground color of the text.
      • setForegroundColor

        public final void setForegroundColor(Color value)

        Sets the foreground color of the text.

        Parameters:
        value - The foreground color of the text.
      • getBackgroundColor

        public final Color getBackgroundColor()

        Gets the background color of the text.

        Returns:
        The background color of the text.
      • setBackgroundColor

        public final void setBackgroundColor(Color value)

        Sets the background color of the text.

        Parameters:
        value - The background color of the text.
      • getTextAlignment

        public final int getTextAlignment()

        Gets the watermark text alignment.

        Returns:
        The watermark text alignment. Default value is F:TextAlignment.Left.
      • setTextAlignment

        public final void setTextAlignment(int value)

        Sets the watermark text alignment.

        Parameters:
        value - The watermark text alignment. Default value is F:TextAlignment.Left.