PdfPolygonAnnotation Class
Represents a Polygon annotation.
Implements
Inherited Members
Namespace: Syncfusion.Pdf.Interactive
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfPolygonAnnotation : PdfAnnotation, IPdfWrapper, INotifyPropertyChanged
Constructors
PdfPolygonAnnotation(Int32[], String)
Initialise the new instance of the polygon annotation with bounds and text.
Declaration
public PdfPolygonAnnotation(int[] points, string text)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | points | Used to represent the poloygon points |
System.String | text | Used to represents the text of the annotation |
Properties
Border
Get or sets the border style of the square annotation.
Declaration
public LineBorder Border { get; set; }
Property Value
Type |
---|
LineBorder |
BorderEffect
Get or set the border effect of the Polygon annotation.
Declaration
public PdfBorderEffect BorderEffect { get; set; }
Property Value
Type |
---|
PdfBorderEffect |
Examples
//Creates a new PDF document.
PdfDocument document = new PdfDocument();
//Creates a new page
PdfPage page = document.Pages.Add();
document.PageSettings.SetMargins(0);
//Set the font
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 10f);
PdfBrush brush = new PdfSolidBrush(System.Drawing.Color.Black);
//Create a new polygon Line
int[] points = new int[] { 80, 420, 150, 420 };
//Create a new line annotation.
PdfPolygonAnnotation polygonannotation = new PdfPolygonAnnotation(points, "Polygon");
//Set the text and font
polygonannotation.Text = "Hello";
polygonannotation.InnerColor = new PdfColor(Color.Red);
PdfBorderEffect borderEffect = new PdfBorderEffect();
borderEffect.Intensity=2;
borderEffect.Style = PdfBorderEffectStyle.Cloudy;
polygonannotation.BorderEffect = borderEffect;
polygonannotation.Color = new PdfColor(Color.Yellow);
page.Graphics.DrawString("Polygon Annotation", font, brush, new PointF(0, 0));
//Add the annotation to the page.
page.Annotations.Add(polygonannotation);
//Save the document.
document.Save("Output.pdf");
//Close the document.
document.Close(true);
'Creates a new PDF document.
Dim document As PdfDocument = New PdfDocument()
'Creates a new page
Dim page As PdfPage = document.Pages.Add()
document.PageSettings.SetMargins(0)
'Set the font.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 10.0F)
Dim brush As PdfBrush = New PdfSolidBrush(System.Drawing.Color.Black)
Dim points() As Integer = New Integer() { 80, 420, 150, 420}
Dim polygonannotation As PdfPolygonAnnotation = New PdfPolygonAnnotation(points, "Ploycon")
'Set the text and font
polygonannotation.Text = "Hello"
polygonannotation.InnerColor = New PdfColor(Color.Red)
Dim borderEffect As PdfBorderEffect = New PdfBorderEffect()
borderEffect.Intensity=2;
borderEffect.Style = PdfBorderEffectStyle.Cloudy
polygonannotation.BorderEffect = borderEffect
polygonannotation.Color = New PdfColor(Color.Yellow)
page.Graphics.DrawString("Polygon Annotation", font, brush, New PointF(0, 0))
'Add annotation to the page.
page.Annotations.Add(polygonannotation)
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)
Comments
Gets the annotation comments
Declaration
public PdfPopupAnnotationCollection Comments { get; }
Property Value
Type |
---|
PdfPopupAnnotationCollection |
Examples
//Create a new PDF document. PdfDocument document = new PdfDocument(); //Create a new page. PdfPage page = document.Pages.Add(); //Create a new rectangle int[] points = new int[] { 80, 420, 150, 420 }; //Create a new line annotation. PdfPolygonAnnotation PolyConAnnotation = new PdfPolygonAnnotation(points, "Ploycon"); //Set the text and font PolyConAnnotation.Text = "Hello"; // set comments PdfPopupAnnotation popupComments = new PdfPopupAnnotation(); popupComments.Author = "TestAuthor"; popupComments.Text = "Test Text"; PolyConAnnotation.Comments.Add(popupComments); //Get annotation comments PdfPopupAnnotationCollection commentsCollection = PolyConAnnotation.Comments; //Saves the document to disk. document.Save("Output.pdf"); document.Close(true);
Dim document As PdfDocument = New PdfDocument
Dim page As PdfPage = document.Pages.Add
Dim points() As Integer = New Integer() { 80, 420, 150, 420}
Dim PolyConAnnotation As PdfPolygonAnnotation = New PdfPolygonAnnotation(points, "Ploycon")
'Set the text and font
PolyConAnnotation.Text = "Hello"
Dim popupComments As PdfPopupAnnotation = New PdfPopupAnnotation
popupComments.Author = "TestAuthor"
popupComments.Text = "Test Text"
PolyConAnnotation.Comments.Add(popupComments)
Dim commentsCollection As PdfPopupAnnotationCollection = PolyConAnnotation.Comments
'Saves the document to disk.
document.Save("Output.pdf")
document.Close(true)
LineExtension
Gets or sets Leading Line Extension, Default value is 0
Declaration
public int LineExtension { get; set; }
Property Value
Type |
---|
System.Int32 |
ReviewHistory
Gets the annotation reviews
Declaration
public PdfPopupAnnotationCollection ReviewHistory { get; }
Property Value
Type |
---|
PdfPopupAnnotationCollection |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page.
PdfPage page = document.Pages.Add();
//Create a new rectangle
int[] points = new int[] { 80, 420, 150, 420 };
//Create a new line annotation.
PdfPolygonAnnotation PolyConAnnotation = new PdfPolygonAnnotation(points, "Ploycon");
//Set the text and font
PolyConAnnotation.Text = "Hello";
//set review state
PdfPopupAnnotation popup = new PdfPopupAnnotation();
popup.State = PdfAnnotationState.Accepted;
popup.StateModel = PdfAnnotationStateModel.Review;
popup.Text = "Hello PDF Comments";
PolyConAnnotation.ReviewHistory.Add(popup);
//Get Review history
PdfPopupAnnotationCollection reviewCollection = PolyConAnnotation.ReviewHistory;
//Saves the document to disk.
document.Save("Output.pdf");
document.Close(true);
Dim document As PdfDocument = New PdfDocument
Dim page As PdfPage = document.Pages.Add
Dim points() As Integer = New Integer() { 80, 420, 150, 420}
Dim PolyConAnnotation As PdfPolygonAnnotation = New PdfPolygonAnnotation(points, "Ploycon")
'Set the text and font
PolyConAnnotation.Text = "Hello"
Dim popup As PdfPopupAnnotation = New PdfPopupAnnotation
popup.State = PdfAnnotationState.Accepted
popup.StateModel = PdfAnnotationStateModel.Review
popup.Text = "Hello PDF Comments"
PolyConAnnotation.ReviewHistory.Add(popup)
Dim reviewCollection As PdfPopupAnnotationCollection = PolyConAnnotation.ReviewHistory
'Saves the document to disk.
document.Save("Output.pdf")
document.Close(true)
Methods
Initialize()
Initializes annotation object.
Declaration
protected override void Initialize()
Overrides
Save()
Saves an annotation.
Declaration
protected override void Save()