All docs
V21.1
21.2 (EAP/Beta)
21.1
20.2
20.1
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

XRWatermark.ImageSource Property

Gets or sets the watermark picture.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v21.1.dll

Declaration

public override ImageSource ImageSource { get; set; }

Property Value

Type Description
ImageSource

The watermark picture.

Remarks

The XRWatermark control supports the following image formats:

  • BMP
  • JPG / JPEG / JPE / JFIF
  • GIF
  • TIF / TIFF
  • PNG
  • ICO
  • DIB
  • RLE
  • EMF / WMF
  • SVG

SVG Support Limitations

The XRWatermark control does not support the following SVG content:

  • Text that uses textPath
  • Animations
  • CSS styles
  • Raster images embedded into an SVG

Transparency is not supported for SVG image watermarks. The XRWatermark.ImageTransparency property’s value is ignored when you set an SVG image as a watermark.

Export (except for PDF) has the following limitations:

  • SVG images are converted to metafiles because document viewers may not support SVG format.

  • SVG images are exported as PNG in the Microsoft Azure environment.

Example

This example demonstrates how to add a watermark to a report. The SetTextWatermark method demonstrates the properties you can use to add a text watermark to a report; the SetPictureWatermark method demonstrates properties required to set a picture as the report’s watermark.

using System.Drawing;
using DevExpress.XtraPrinting;
using DevExpress.XtraPrinting.Drawing;
// ...
public void SetTextWatermark(XtraReport report) {
    Watermark textWatermark = new Watermark();
    textWatermark.Text = "CUSTOM WATERMARK TEXT";
    textWatermark.TextDirection = DirectionMode.ForwardDiagonal;
    textWatermark.Font = new Font(textWatermark.Font.FontFamily, 40);
    textWatermark.ForeColor = Color.DodgerBlue;
    textWatermark.TextTransparency = 150;
    textWatermark.ShowBehind = false;
    textWatermark.PageRange = "1,3-5";
    report.Watermark.CopyFrom(textWatermark);
}
public void SetPictureWatermark(XtraReport report) {
    Watermark pictureWatermark = new Watermark();
    pictureWatermark.ImageSource = ImageSource.FromFile("Watermark.png");
    pictureWatermark.ImageAlign = ContentAlignment.TopCenter;
    pictureWatermark.ImageTiling = false;
    pictureWatermark.ImageViewMode = ImageViewMode.Stretch;
    pictureWatermark.ImageTransparency = 150;
    pictureWatermark.ShowBehind = true;
    pictureWatermark.PageRange = "2,4";
    report.Watermark.CopyFrom(pictureWatermark);
}
See Also