menu

WPF

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PictureWatermark - WPF API Reference | Syncfusion

    Show / Hide Table of Contents

    Class PictureWatermark

    Represents the picture that appears behind the document.

    Inheritance
    System.Object
    OwnerHolder
    XDLSSerializableBase
    Entity
    WidgetBase
    ParagraphItem
    Watermark
    PictureWatermark
    Implements
    IXDLSSerializable
    IParagraphItem
    IEntity
    IOfficeRun
    Inherited Members
    Entity.Clone()
    Entity.IsComposite
    Entity.NextSibling
    Entity.Owner
    Entity.PreviousSibling
    OwnerHolder.Document
    OwnerHolder.m_doc
    ParagraphItem.ApplyStyle(String)
    ParagraphItem.CloneRun()
    ParagraphItem.Dispose()
    ParagraphItem.IsDeleteRevision
    ParagraphItem.IsInsertRevision
    ParagraphItem.m_charFormat
    ParagraphItem.OwnerMathRunElement
    ParagraphItem.OwnerParagraph
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Watermark.CreateLayoutInfo()
    Watermark.EntityType
    Watermark.Type
    XDLSSerializableBase.IXDLSSerializable.ReadXmlAttributes(IXDLSAttributeReader)
    XDLSSerializableBase.IXDLSSerializable.ReadXmlContent(IXDLSContentReader)
    XDLSSerializableBase.IXDLSSerializable.RestoreReference(String, Int32)
    XDLSSerializableBase.IXDLSSerializable.WriteXmlAttributes(IXDLSAttributeWriter)
    XDLSSerializableBase.IXDLSSerializable.WriteXmlContent(IXDLSContentWriter)
    XDLSSerializableBase.IXDLSSerializable.XDLSHolder
    XDLSSerializableBase.ReadXmlContent(IXDLSContentReader)
    XDLSSerializableBase.RestoreReference(String, Int32)
    XDLSSerializableBase.WriteXmlContent(IXDLSContentWriter)
    XDLSSerializableBase.XDLSHolder
    Namespace: Syncfusion.DocIO.DLS
    Assembly: Syncfusion.DocIO.Base.dll
    Syntax
    public class PictureWatermark : Watermark, IXDLSSerializable, IWidget, IParagraphItem, IEntity, IOfficeRun
    Examples

    The following code snippet illustrates how to add a picture watermark to the Word document.

    private void Button1_Click(System.Object sender, System.EventArgs e)
    {
        //Create a new Word document
        WordDocument document = new WordDocument();
        //Add a section and a paragraph in the document
        document.EnsureMinimal();
        IWParagraph paragraph = document.LastParagraph;
        paragraph.AppendText("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua");
        //Create a new picture watermark
        PictureWatermark picWatermark = new PictureWatermark();
        //Set the scaling to picture
        picWatermark.Scaling = 120f;
        picWatermark.Washout = true;
        //Set the picture watermark to document
        document.Watermark = picWatermark;
        //Set the image to the picture watermark
        picWatermark.Picture = Image.FromFile("ImagesPath" + "Water lilies.jpg");
        document.Save("PictureWatermark.docx", FormatType.Docx);
        document.Close();
    }
    Private Sub button_Click(sender As Object, e As EventArgs)
        'Create a new Word document
        Dim document As New WordDocument()
        'Add a section and a paragraph in the document
        document.EnsureMinimal()
        Dim paragraph As IWParagraph = document.LastParagraph
        paragraph.AppendText("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua")
        'Create a new picture watermark
        Dim picWatermark As New PictureWatermark()
        'Set the scaling to picture
        picWatermark.Scaling = 120.0F
        picWatermark.Washout = True
        Set the picture watermark to document
        document.Watermark = picWatermark
        Set the image to the picture watermark
        picWatermark.Picture = Image.FromFile(ImagesPath + "Water lilies.jpg")
        document.Save("PictureWatermark.docx", FormatType.Docx)
        document.Close()
    End Sub

    Constructors

    PictureWatermark()

    Initializes a new instance of the PictureWatermark class.

    Declaration
    public PictureWatermark()

    PictureWatermark(Image, Boolean)

    Initializes a new instance of the PictureWatermark class with the specified System.Drawing.Image and Washout effect.

    Declaration
    public PictureWatermark(Image image, bool washout)
    Parameters
    Type Name Description
    System.Drawing.Image image

    Image that appear behind the document

    System.Boolean washout

    Washout property to set light shading effect to picture.

    Remarks

    This constructor is not supported in Silverlight, WinRT, Windows Phone, Universal, Universal Windows Platform, MVC6 and Xamarin application.

    Examples

    The following code snippet illustrates how to add a picture watermark to the Word document.

    private void Button1_Click(System.Object sender, System.EventArgs e)
    {
        //Load an existing Word document into DocIO instance
        WordDocument document = new WordDocument("Template.docx");
        //Create a new picture watermark
        PictureWatermark picWatermark = new PictureWatermark(Image.FromFile("ImagesPath" + "Water lilies.jpg"), false);
        //Set the picture watermark to document
        document.Watermark = picWatermark;
        document.Save("PictureWatermark.docx", FormatType.Docx);
        document.Close();
    }
    Private Sub button_Click(sender As Object, e As EventArgs)
        'Load an existing Word document into DocIO instance
        Dim document As New WordDocument("Template.docx")
        'Create a new picture watermark
        Dim picWatermark As New PictureWatermark(Image.FromFile(ImagesPath + "Water lilies.jpg"), False)
        'Set the picture watermark to document
        document.Watermark = picWatermark
        document.Save("PictureWatermark.docx", FormatType.Docx)
        document.Close()
    End Sub

    Properties

    Picture

    Gets or sets the picture for picture watermark.

    Declaration
    public Image Picture { get; set; }
    Property Value
    Type Description
    System.Drawing.Image

    The System.Drawing.Image that represents the picture.

    Remarks

    This property is not supported in Silverlight, WinRT, Windows Phone, Universal, Universal Windows Platform, MVC6 and Xamarin application.

    Scaling

    Gets or sets the picture scaling value in percents.

    Declaration
    public float Scaling { get; set; }
    Property Value
    Type Description
    System.Single

    The float that specifies the picture scaling value.

    Washout

    Gets or sets a value indicating whether the washout property is enabled for the picture watermark. The default value is true.

    Declaration
    public bool Washout { get; set; }
    Property Value
    Type Description
    System.Boolean

    True if to have light shading effect to picture; otherwise, false.

    Methods

    CloneImpl()

    Clones itself.

    Declaration
    protected override object CloneImpl()
    Returns
    Type Description
    System.Object

    Returns cloned object.

    Overrides
    ParagraphItem.CloneImpl()

    InitXDLSHolder()

    Registers child objects in XDSL holder.

    Declaration
    protected override void InitXDLSHolder()
    Overrides
    XDLSSerializableBase.InitXDLSHolder()

    ReadXmlAttributes(IXDLSAttributeReader)

    Reads object data from xml attributes.

    Declaration
    protected override void ReadXmlAttributes(IXDLSAttributeReader reader)
    Parameters
    Type Name Description
    IXDLSAttributeReader reader

    The IXDLSAttributeReader object.

    Overrides
    Watermark.ReadXmlAttributes(IXDLSAttributeReader)

    WriteXmlAttributes(IXDLSAttributeWriter)

    Writes object data as xml attributes.

    Declaration
    protected override void WriteXmlAttributes(IXDLSAttributeWriter writer)
    Parameters
    Type Name Description
    IXDLSAttributeWriter writer

    The IXDLSAttributeWriter object.

    Overrides
    Watermark.WriteXmlAttributes(IXDLSAttributeWriter)

    Implements

    IXDLSSerializable
    IParagraphItem
    IEntity
    IOfficeRun

    See Also

    Watermark
    TextWatermark
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved