WaterMark must be on top

I am using aspose words I need to add watermark and that should be on top of all elements, remaining all elements should be under it I tried with shape class with zorder property but failed

Hi Pavan,


Thanks for your inquiry. In your case, I suggest you please insert 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 watermarks. Use the following code example to achieve your requirements.


public static void InsertWatermarkTextAtEachPage(Document doc, string
watermarkText)

{

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;

anchorPara.AppendChild(watermark);

pageIndex++;

}

}

}



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