Document doc = new Document(MyDir + "Test.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
Shape watermark = new Shape(doc, ShapeType.Image);
watermark.ImageData.SetImage(MyDir + "school.JPG");
// setting image width and height
watermark.Width = 500;
watermark.Height = 100;
// Image will be directed from the bottom-left to the top-right corner.
watermark.Rotation = -40;
// Image will be placed center of page
watermark.RelativeHorizontalPosition = RelativeHorizontalPosition.Page;
watermark.RelativeVerticalPosition = RelativeVerticalPosition.Page;
watermark.WrapType = WrapType.None;
watermark.VerticalAlignment = VerticalAlignment.Top;
watermark.HorizontalAlignment = HorizontalAlignment.Left;
watermark.BehindText = false;
builder.InsertNode(watermark);
builder.Document.Save(MyDir + "test Out.docx");
It is a good sample for my needs, but I have some residual questions:
1) How can I set a margin? For example, from the top of the page in the above example?
2) How can I put the watermark on a desired page (the code above inserts the image on first page)?
3) Can I set the opacity for the image?
Regards!