Water Mark Text not showing up


I am adding water mark to a document. I am using following code. I can see the image or shape but not able to see the text of watermark. Any help will be appreciated. Following is the code.

Public Sub InsertWatermarkText(ByRef doc As Document, ByVal watermarkText As String)

    ' Create a watermark shape. This will be a WordArt shape. 
    ' You are free to try other shape types as watermarks.
    Dim watermark As New Shape(doc, ShapeType.Cube)

    ' Set up the text of the watermark.
    watermark.TextPath.Size = 100
    watermark.TextPath.Text = "Hello" 'watermarkText
    watermark.TextPath.FontFamily = "Arial"
    watermark.Width = 500
    watermark.Height = 200
    ' Text will be directed from the bottom-left to the top-right corner.
    watermark.Rotation = -40
    'watermark.BehindText = False

    ' Remove the following two lines if you need a solid black text.
    'watermark.Fill.Color = Color.Red ’ Try LightGray to get more Word-style watermark
    'watermark.StrokeColor = Color.Red ’ Try LightGray to get more Word-style watermark

    ' Place the watermark in the page center.
    watermark.RelativeHorizontalPosition = RelativeHorizontalPosition.Page
    watermark.RelativeVerticalPosition = RelativeVerticalPosition.Page
    watermark.WrapType = WrapType.None
    watermark.VerticalAlignment = VerticalAlignment.Center
    watermark.HorizontalAlignment = HorizontalAlignment.Center
    watermark.ZOrder = 2

    ' Create a new paragraph and append the watermark to this paragraph.
    Dim watermarkPara As New Paragraph(doc)

    ' Insert the watermark into all headers of each document section.
    For Each sect As Section In doc.Sections
        ' There could be up to three different headers in each section, since we want
        ' the watermark to appear on all pages, insert into all headers.
        InsertWatermarkIntoHeader(watermarkPara, sect, HeaderFooterType.HeaderPrimary)
        InsertWatermarkIntoHeader(watermarkPara, sect, HeaderFooterType.HeaderFirst)
        InsertWatermarkIntoHeader(watermarkPara, sect, HeaderFooterType.HeaderEven)
    Next sect
End Sub

Private Sub InsertWatermarkIntoHeader(ByVal watermarkPara As Paragraph, ByVal sect As Section, ByVal headerType As HeaderFooterType)
    Dim header As HeaderFooter = sect.HeadersFooters(headerType)

    If header Is Nothing Then
        ' There is no header of the specified type in the current section, create it.
        header = New HeaderFooter(sect.Document, headerType)

    End If

    ' Insert a clone of the watermark into the header.
End Sub


Thanks for your inquiry. You can not use ShapeType.Cube as watermark. The shape, i.e. used for watermarks, must be of WordArt type e.g. TextPlainText, TextStop, TextTriangle. You can find a list of WordArt object/shape types here:

If we can help you with anything else, please feel free to ask.

Best Regards,


Thanks for replying. Even with TextPlainText it is not working. I can see the image but no text. For example I am not able to see text “hello” as water mark text. I do see two lines. Even in case of cube I was seeing cube but not text. Any help?

Hi Pratyush,

Thank you for inquiry. You can use watermarks with WordArt types. Please follow up the code for TextPlainText.

Private Sub WaterMark()
    Dim doc As Document = New Document
    Dim builder As DocumentBuilder = New DocumentBuilder(doc)
    Dim shape As Aspose.Words.Drawing.Shape = New Aspose.Words.Drawing.Shape(doc, Aspose.Words.Drawing.ShapeType.TextPlainText)
    shape.Width = 400
    shape.Height = 200
    shape.TextPath.Size = 100
    shape.TextPath.Text = "Hello"
    shape.TextPath.Bold = True
    shape.WrapType = Aspose.Words.Drawing.WrapType.None
    shape.BehindText = True
    shape.RelativeHorizontalPosition = Aspose.Words.Drawing.RelativeHorizontalPosition.Page
    shape.HorizontalAlignment = Aspose.Words.Drawing.HorizontalAlignment.Center
    shape.RelativeVerticalPosition = Aspose.Words.Drawing.RelativeVerticalPosition.Page
    shape.VerticalAlignment = Aspose.Words.Drawing.VerticalAlignment.Center

End Sub

In case of any ambiguity, please let me know.