Class PdfPolygonAnnotation
- Namespace
- Syncfusion.Pdf.Interactive
- Assembly
- Syncfusion.Pdf.Portable.dll
Represents a Polygon annotation.
public class PdfPolygonAnnotation : PdfAnnotation, INotifyPropertyChanged
- Inheritance
-
PdfPolygonAnnotation
- Implements
- Inherited Members
Constructors
PdfPolygonAnnotation(int[], string)
Initialise the new instance of the polygon annotation with bounds and text.
public PdfPolygonAnnotation(int[] points, string text)
Parameters
points
int[]Used to represent the poloygon points
text
stringUsed to represents the text of the annotation
Properties
Border
Get or sets the border style of the square annotation.
public LineBorder Border { get; set; }
Property Value
BorderEffect
Get or set the border effect of the Polygon annotation.
public PdfBorderEffect BorderEffect { get; set; }
Property Value
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
public PdfPopupAnnotationCollection Comments { get; }
Property Value
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
public int LineExtension { get; set; }
Property Value
ReviewHistory
Gets the annotation reviews
public PdfPopupAnnotationCollection ReviewHistory { get; }
Property Value
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.
protected override void Initialize()
Save()
Saves an annotation.
protected override void Save()