Back to Devexpress

PdfPageFacade.AddPolyLineAnnotation(PdfPoint[]) Method

officefileapi-devexpress-dot-pdf-dot-pdfpagefacade-dot-addpolylineannotation-x28-devexpress-dot-pdf-dot-pdfpoint-x29.md

latest3.6 KB
Original Source

PdfPageFacade.AddPolyLineAnnotation(PdfPoint[]) Method

Creates a polyline annotation by the specified vertices.

Namespace : DevExpress.Pdf

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

NuGet Package : DevExpress.Pdf.Core

Declaration

csharp
public PdfPolyLineAnnotationFacade AddPolyLineAnnotation(
    params PdfPoint[] points
)
vb
Public Function AddPolyLineAnnotation(
    ParamArray points As PdfPoint()
) As PdfPolyLineAnnotationFacade

Parameters

NameTypeDescription
pointsPdfPoint[]

An array of polyline vertices.

|

Returns

TypeDescription
PdfPolyLineAnnotationFacade

An object that contains polyline annotation properties.

|

Example

The code sample below creates a polyline annotation:

csharp
using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
    // Load a document
    processor.LoadDocument("..\\..\\Document.pdf");

    // Access the first page properties
    PdfPageFacade pageFacade = processor.DocumentFacade.Pages[0];

    // Define polyline vertices
    PdfPoint point1 = new PdfPoint(100, 100);
    PdfPoint point2 = new PdfPoint(110, 110);
    PdfPoint point3 = new PdfPoint(120, 100);
    PdfPoint point4 = new PdfPoint(130, 110);
    PdfPoint point5 = new PdfPoint(140, 100);
    PdfPoint[] points = new PdfPoint[] { point1, point2, point3, point4, point5 };

    // Create an annotation
    PdfPolyLineAnnotationFacade polylineAnnotation = pageFacade.AddPolyLineAnnotation(points);

    // Specify annotation parameters
    polylineAnnotation.Author = "Rayn Anita W";
    polylineAnnotation.Contents = "Made in PDF Document API";
    polylineAnnotation.BorderWidth = 6;
    polylineAnnotation.Color = new PdfRGBColor(0.8, 0.2, 0.1);

    // Save the result
    processor.SaveDocument("..\\..\\Result.pdf");
}
vb
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 polyline vertices
    Dim point1 As New PdfPoint(100, 100)
    Dim point2 As New PdfPoint(110, 110)
    Dim point3 As New PdfPoint(120, 100)
    Dim point4 As New PdfPoint(130, 110)
    Dim point5 As New PdfPoint(140, 100)
    Dim points() As PdfPoint = { point1, point2, point3, point4, point5 }

    ' Create an annotation
    Dim polylineAnnotation As PdfPolyLineAnnotationFacade = pageFacade.AddPolyLineAnnotation(points)

    ' Specify annotation parameters
    polylineAnnotation.Author = "Rayn Anita W"
    polylineAnnotation.Contents = "Made in PDF Document API"
    polylineAnnotation.BorderWidth = 6
    polylineAnnotation.Color = New PdfRGBColor(0.8, 0.2, 0.1)

    ' Save the result
    processor.SaveDocument("..\..\Result.pdf")
End Using

See Also

PdfPageFacade Class

PdfPageFacade Members

DevExpress.Pdf Namespace