public void InsertWatermark()
{
//ExStart
//ExFor:HeaderFooterType
//ExFor:DocumentBuilder.MoveToHeaderFooter
//ExFor:PageSetup.PageWidth
//ExFor:PageSetup.PageHeight
//ExFor:DocumentBuilder.InsertImage(Image)
//ExFor:WrapType
//ExFor:RelativeHorizontalPosition
//ExFor:RelativeVerticalPosition
//ExSummary:Inserts a watermark image into a document using DocumentBuilder.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// The best place for the watermark image is in the header or footer so it is shown on every page.
builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
Image image = Image.FromFile(MyDir + "Watermark.png");
// Insert a floating picture.
Shape shape = builder.InsertImage(image);
shape.WrapType = WrapType.None;
shape.BehindText = true;
shape.RelativeHorizontalPosition = RelativeHorizontalPosition.Page;
shape.RelativeVerticalPosition = RelativeVerticalPosition.Page;
// Calculate image left and top position so it appears in the centre of the page.
shape.Left = (builder.PageSetup.PageWidth - shape.Width) / 2;
shape.Top = (builder.PageSetup.PageHeight - shape.Height) / 2;
doc.Save(MyDir + @"\Artifacts\DocumentBuilder.InsertWatermark.doc");
//ExEnd
}