Skip to main content
All docs
V25.1
  • PdfPageFacade.AddPolygonAnnotation(PdfPoint[]) Method

    Creates a polygon annotation by the specified vertices.

    Namespace: DevExpress.Pdf

    Assembly: DevExpress.Pdf.v25.1.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