Class PdfWatermarkAnnotation
Represents the watermark annotation.
Implements
System.ComponentModel.INotifyPropertyChanged
Inherited Members
Namespace: Syncfusion.Pdf.Interactive
Assembly: Syncfusion.Pdf.Portable.dll
Syntax
public class PdfWatermarkAnnotation : PdfAnnotation, IPdfWrapper, INotifyPropertyChanged
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.
Declaration
public PdfWatermarkAnnotation(RectangleF rectangle)
Parameters
Type | Name | Description |
---|---|---|
RectangleF | rectangle |
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.
Declaration
public PdfAppearance Appearance { get; }
Property Value
Type | Description |
---|---|
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.
Declaration
public override float Opacity { get; set; }
Property Value
Type |
---|
System.Single |
Overrides
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.
Declaration
protected override void Initialize()
Overrides
Save()
Saves the watermark annotation.
Declaration
protected override void Save()
Overrides
Implements
System.ComponentModel.INotifyPropertyChanged