officefileapi-devexpress-dot-pdf-dot-pdfpagefacade-dot-addpolygonannotation-x28-devexpress-dot-pdf-dot-pdfpoint-x29.md
Creates a polygon annotation by the specified vertices.
Namespace : DevExpress.Pdf
Assembly : DevExpress.Pdf.v25.2.Core.dll
NuGet Package : DevExpress.Pdf.Core
public PdfPolygonAnnotationFacade AddPolygonAnnotation(
params PdfPoint[] points
)
Public Function AddPolygonAnnotation(
ParamArray points As PdfPoint()
) As PdfPolygonAnnotationFacade
| Name | Type | Description |
|---|---|---|
| points | PdfPoint[] |
An array of points that is the polygon vertices.
|
| Type | Description |
|---|---|
| PdfPolygonAnnotationFacade |
An object that contains polygon annotation properties.
|
The code sample below creates a hexagon:
using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
// Load a document
processor.LoadDocument("..\\..\\Document.pdf");
// Access the firs page properties
PdfPageFacade pageFacade = processor.DocumentFacade.Pages[0];
// Define hexagon vertices
PdfPoint point1 = new PdfPoint(150, 150);
PdfPoint point2 = new PdfPoint(140, 160);
PdfPoint point3 = new PdfPoint(150, 170);
PdfPoint point4 = new PdfPoint(160, 170);
PdfPoint point5 = new PdfPoint(170, 160);
PdfPoint point6 = new PdfPoint(160, 150);
PdfPoint[] points = new PdfPoint[] { point1, point2, point3, point4, point5, point6 };
// Create a hexagon annotation
PdfPolygonAnnotationFacade hexagon = pageFacade.AddPolygonAnnotation(points);
hexagon.Author = "Cardle Anita W";
// Save the result
processor.SaveDocument("..\\..\\Result.pdf");
}
Using processor As New PdfDocumentProcessor()
' Load a document
processor.LoadDocument("..\..\Document.pdf")
' Access the first page properties
Dim pageFacade As PdfPageFacade = processor.DocumentFacade.Pages(0)
' Define hexagon vertices
Dim point1 As New PdfPoint(150, 150)
Dim point2 As New PdfPoint(140, 160)
Dim point3 As New PdfPoint(150, 170)
Dim point4 As New PdfPoint(160, 170)
Dim point5 As New PdfPoint(170, 160)
Dim point6 As New PdfPoint(160, 150)
Dim points() As PdfPoint = { point1, point2, point3, point4, point5, point6 }
' Create a hexagon
Dim hexagon As PdfPolygonAnnotationFacade = pageFacade.AddPolygonAnnotation(points)
hexagon.Author = "Cardle Anita W"
' Save the result
processor.SaveDocument("..\..\Result.pdf")
End Using
See Also