We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to bring watermark (as shape) on top of image

Image hides the watermark (shape object), while adding a watermark to a word document using aspose shape class. Below mentioned is the code used. Also, I have attached the sample file containing watermark.

private static void InsertWaterMarkTextToWord(Aspose.Words.Document doc, string watermarkText)
// Create a watermark shape. This will be a WordArt shape.
// You are free to try other shape types as watermarks.
Shape watermark = new Shape(doc, ShapeType.TextPlainText);

// Set up the text of the watermark.
watermark.TextPath.Text = watermarkText;
watermark.TextPath.FontFamily = "Arial";
watermark.Width = 500;
watermark.Height = 80; //100

// Text will be directed from the bottom-left to the top-right corner.
watermark.Rotation = -40;
// Remove the following two lines if you need a solid black text.
watermark.Fill.Color = System.Drawing.Color.Gray; // Try LightGray to get more Word-style watermark
watermark.StrokeColor = System.Drawing.Color.Gray; // 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 = Aspose.Words.Drawing.VerticalAlignment.Center;
watermark.HorizontalAlignment = Aspose.Words.Drawing.HorizontalAlignment.Center;

// Create a new paragraph and append the watermark to this paragraph.
Paragraph watermarkPara = new Paragraph(doc);

// Insert the watermark into all headers of each document section.
foreach (Section sect 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);

Please help.

Hi Bhaskar,

Thanks for your inquiry.

The problem occurs because watermark shape resides inside header footer story. If you insert a watermark image using Microsoft Word 2013 in output
document, you will observe the same behaviour. However, you can overcome
this problem by manually inserting watermarks in each Page. You can
achieve this by moving the cursor to the first Paragraph in each Page of
your document and then making those Paragraphs as an anchor points for
your waternarks. Here is how you can achieve this:

public static void InsertWatermarkTextAtEachPage(Document doc, string


DocumentBuilder builder = new DocumentBuilder(doc);

PageSetup ps = builder.PageSetup;

NodeCollection paragraphs = doc.GetChildNodes(NodeType.Paragraph, true);

LayoutCollector collector = new LayoutCollector(doc);

Paragraph anchorPara = null;

int pageIndex = 0;

foreach (Paragraph para in paragraphs)


if (collector.GetStartPageIndex(para) == pageIndex)


anchorPara = para;

Shape watermark = new Shape(doc, Aspose.Words.Drawing.ShapeType.TextPlainText);

watermark.TextPath.Text = watermarkText;

watermark.TextPath.FontFamily = "Arial";

watermark.Width = 300;

watermark.Height = 70;

watermark.Left = 100;

watermark.Top = 100;

watermark.Rotation = -40;

watermark.Fill.Color = Color.Gray;

watermark.StrokeColor = Color.Gray;

watermark.Name = string.Format("WaterMark_{0}", Guid.NewGuid());

watermark.WrapType = WrapType.None;






Hope this helps you. Please let us know if you have any more queries.

Thanks for your reply.

In which version LayoutCollector is available.

Hi Bhaskar,

Thanks for your inquiry. The Aspose.Words.Layout API introduced Aspose.Words 13.1.0. I suggest you please use the latest version of Aspose.Words for .NET 14.7.0.

Please let us know if you have any more queries.