Class PictureWatermark
Represents the picture that appears behind the document.
Inheritance
System.Object
PictureWatermark
Inherited Members
Namespace: Syncfusion.DocIO.DLS
Assembly: Syncfusion.DocIO.Portable.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()
Properties
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
InitXDLSHolder()
Registers child objects in XDSL holder.
Declaration
protected override void InitXDLSHolder()
Overrides
LoadPicture(Byte[])
Load watermark image
Declaration
public void LoadPicture(byte[] bytes)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | bytes |
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
WriteXmlAttributes(IXDLSAttributeWriter)
Writes object data as xml attributes.
Declaration
protected override void WriteXmlAttributes(IXDLSAttributeWriter writer)
Parameters
Type | Name | Description |
---|---|---|
IXDLSAttributeWriter | writer | The IXDLSAttributeWriter object. |