Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

PdfPageFacade.AddPolygonAnnotation(PdfPoint[]) Method

Creates a polygon annotation by the specified vertices.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Pdf.v24.2.Core.dll

NuGet Package: DevExpress.Pdf.Core

#Declaration

public PdfPolygonAnnotationFacade AddPolygonAnnotation(
    params PdfPoint[] points
)

#Parameters

Name Type Description
points PdfPoint[]

An array of points that is the polygon vertices.

#Returns

Type Description
PdfPolygonAnnotationFacade

An object that contains polygon annotation properties.

#Example

The code sample below creates a hexagon:

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");
}
See Also