Table of Contents

Class PdfWatermarkAnnotation

Namespace
Syncfusion.Pdf.Interactive
Assembly
Syncfusion.Pdf.Portable.dll

Represents the watermark annotation.

public class PdfWatermarkAnnotation : PdfAnnotation, INotifyPropertyChanged
Inheritance
PdfWatermarkAnnotation
Implements
Inherited Members

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create a new PDF watermark annotation.
RectangleF rectangle = new RectangleF(40, 60, 80, 20);
PdfWatermarkAnnotation watermarkAnnotation = new PdfWatermarkAnnotation(rectangle);
watermarkAnnotation.Opacity = 0.5f;
watermarkAnnotation.Appearance..Normal.Graphics.DrawString("Watermark", new PdfStandardFont(PdfFontFamily.TimesRoman, 12), PdfBrushes.DarkBlue, new PointF(0, 0));
page.Annotations.Add(watermarkAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//Close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page .
Dim page As PdfPage = document.Pages.Add()
'Create a new pdf watermark annotation.
Dim rectangle As New RectangleF(40, 60, 80, 20)
Dim watermarkAnnotation As New PdfWatermarkAnnotation(rectangle)
watermarkAnnotation.Opacity = 0.5f
watermarkAnnotation.Appearance.Normal.Graphics.DrawString("Watermark", new PdfStandardFont(PdfFontFamily.TimesRoman, 12), PdfBrushes.DarkBlue, new PointF(0, 0))
page.Annotations.Add(watermarkAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'Close the document
document.Close(True)

Constructors

PdfWatermarkAnnotation(RectangleF)

RectangleF structure that specifies the bounds of the annotation.
public PdfWatermarkAnnotation(RectangleF rectangle)

Parameters

rectangle RectangleF

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create a new pdf watermark annotation.
RectangleF watermarkannotationBounds = new RectangleF(40, 60, 80, 20);
PdfWatermarkAnnotation rubberstampAnnotation = new PdfWatermarkAnnotation(watermarkannotationBounds);
watermarkAnnotation.Opacity = 0.5f;
//Gets the PDF appearance.
watermarkAnnotation.Appearance.Normal.Graphics.DrawString("Watermark",new PdfStandardFont(PdfFontFamily.TimesRoman, 12), PdfBrushes.DarkBlue, new PointF(0, 0));
page.Annotations.Add(watermarkAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//Close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page .
Dim page As PdfPage = document.Pages.Add()
'Create a new pdf rubber stamp annotation.
Dim watermarkannotationBounds As New RectangleF(40, 60, 80, 20)
Dim watermarkAnnotation As New PdfRubberStampAnnotation(watermarkannotationBounds)
watermarkAnnotation.Opacity = 0.5F
'Gets the  PDF appearance.
watermarkAnnotation.Appearance.Normal.Graphics.DrawString("Watermark", new PdfStandardFont(PdfFontFamily.TimesRoman, 12), PdfBrushes.DarkBlue, new PointF(0, 0))
page.Annotations.Add(watermarkAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'Close the document
document.Close(True)

Properties

Appearance

Gets the appearance of the watermark annotation.

public PdfAppearance Appearance { get; }

Property Value

PdfAppearance

The PdfAppearance object specifies the appearance of the annotaion.

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create a new pdf watermark annotation.
RectangleF watermarkannotationBounds = new RectangleF(40, 60, 80, 20);
PdfWatermarkAnnotation rubberstampAnnotation = new PdfWatermarkAnnotation(watermarkannotationBounds);
//Gets the PDF appearance.
watermarkAnnotation.Appearance.Normal.Graphics.DrawString("Watermark",new PdfStandardFont(PdfFontFamily.TimesRoman, 12), PdfBrushes.DarkBlue, new PointF(0, 0));
page.Annotations.Add(watermarkAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//Close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page .
Dim page As PdfPage = document.Pages.Add()
'Create a new pdf rubber stamp annotation.
Dim watermarkannotationBounds As New RectangleF(40, 60, 80, 20)
Dim watermarkAnnotation As New PdfRubberStampAnnotation(watermarkannotationBounds)
'Gets the  PDF appearance.
watermarkAnnotation.Appearance.Normal.Graphics.DrawString("Watermark", new PdfStandardFont(PdfFontFamily.TimesRoman, 12), PdfBrushes.DarkBlue, new PointF(0, 0))
page.Annotations.Add(watermarkAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'Close the document
document.Close(True)

Opacity

Gets or sets the opacity of the watermark annotation.

public override float Opacity { get; set; }

Property Value

float

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page .
PdfPage page = document.Pages.Add();
//Create a new pdf watermark annotation.
RectangleF watermarkannotationBounds = new RectangleF(40, 60, 80, 20);
PdfWatermarkAnnotation rubberstampAnnotation = new PdfWatermarkAnnotation(watermarkannotationBounds);
watermarkAnnotation.Opacity = 0.5f;
//Gets the PDF appearance.
watermarkAnnotation.Appearance.Normal.Graphics.DrawString("Watermark",new PdfStandardFont(PdfFontFamily.TimesRoman, 12), PdfBrushes.DarkBlue, new PointF(0, 0));
page.Annotations.Add(watermarkAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//Close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page .
Dim page As PdfPage = document.Pages.Add()
'Create a new pdf rubber stamp annotation.
Dim watermarkannotationBounds As New RectangleF(40, 60, 80, 20)
Dim watermarkAnnotation As New PdfRubberStampAnnotation(watermarkannotationBounds)
watermarkAnnotation.Opacity = 0.5F
'Gets the  PDF appearance.
watermarkAnnotation.Appearance.Normal.Graphics.DrawString("Watermark", new PdfStandardFont(PdfFontFamily.TimesRoman, 12), PdfBrushes.DarkBlue, new PointF(0, 0))
page.Annotations.Add(watermarkAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'Close the document
document.Close(True)

Methods

Initialize()

Initializes annotation object.

protected override void Initialize()

Save()

Saves the watermark annotation.

protected override void Save()