Word Watermark opacity control?

I’d like to confirm if it’s possible to control the opacity of the watermark in Word. I don’t see such functionality exposed in your Word API (it is on the PDF API).

@VFX_Pro,

The standard ways of inserting watermarks in Word document are listed in the following article:

The following code of Aspose.Imaging for .NET API creates a blank canvas of type PNG with transparency and draws another image over it while specifying the desired opacity (ColorMatrix.Matrix33). Please note, 0.6f means 60% so you may set it to any desired value.

using (Aspose.Imaging.FileFormats.Png.PngImage pngImage =
                new Aspose.Imaging.FileFormats.Png.PngImage(1500, 1500,
                Aspose.Imaging.FileFormats.Png.PngColorType.TruecolorWithAlpha))
{
    Aspose.Imaging.ColorMatrix cmxPic = new Aspose.Imaging.ColorMatrix();
    cmxPic.Matrix33 = 0.6f;
    Aspose.Imaging.ImageAttributes iaPic = new Aspose.Imaging.ImageAttributes();
    iaPic.SetColorMatrix(cmxPic, Aspose.Imaging.ColorMatrixFlag.Default, Aspose.Imaging.ColorAdjustType.Bitmap);

    using (Aspose.Imaging.Image loaded = Aspose.Imaging.Image.Load("C:\\Temp\\image.png"))
    {
        Aspose.Imaging.Graphics gr = new Aspose.Imaging.Graphics(pngImage);
        gr.DrawImage(loaded, loaded.Bounds, Aspose.Imaging.GraphicsUnit.Pixel, iaPic);
    }
    pngImage.Save("C:\\Temp\\output image.png");
}

After that your Image is processed, you will then be able to insert image inside Word document and set its different parameters:

Document doc = new Document("C:\\Temp\\in.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToDocumentEnd();
Shape shape = builder.InsertImage("C:\\Temp\\output image.png");
shape.Fill.Opacity = 0.7;
shape.Stroke.On = true;
shape.Stroke.Color = doc.Theme.Colors.Accent1;
shape.Stroke.Weight = 5;
shape.Stroke.Opacity = 0.7;
doc.Save("C:\\Temp\\21.1.docx");