Skip to main content
.NET Framework 4.5.2+

PdfGraphics.DrawBeziers(Pen, PointF[]) Method

Draws a series of Bezier curves by points from the specified array.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Pdf.v22.2.Drawing.dll

NuGet Package: DevExpress.Pdf.Drawing

Declaration

public void DrawBeziers(
    Pen pen,
    PointF[] points
)

Parameters

Name Type Description
pen Pen

A Pen object that specifies the color, width, and style of the curve.

points PointF[]

An array of PointF structures that specifies points (in world coordinate system) by which you can draw a series of Bezier curves.

Remarks

The first Bezier curve starts from the first point and ends at the fourth point. The second and third points are control points that specify the shape of the curve. Each next curve starts from the previous curve’s end point and uses three more points (two control points and an end point). To draw a series of Bezier curves, generate an array of points whose item number is a multiple of 3 plus 1, such as 4, 7, or 10. Assign the array to the points parameter. Pass the points and pen parameters to the DrawBeziers method.

To draw a shape on the PDF page, use one of the following methods:

PdfGraphics.AddToPageForeground, PdfGraphics.AddToPageBackground
These methods allow you to draw content on an existing page.
PdfDocumentProcessor.RenderNewPage
Draws content on a new page.

The code sample below draws a series of Bezier curves using seven points.

Draw a Series of Bezier Curves

using DevExpress.Pdf;
using System.Drawing;
//...

using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
    processor.CreateEmptyDocument();
    PdfPage page = processor.AddNewPage(PdfPaperSize.A4);
        using (PdfGraphics graphics = processor.CreateGraphics())
        {
            // Create a point array.
            PointF[] points = new PointF[] 
            { 
              new PointF(100, 100), 
              new PointF(200, 10), 
              new PointF(350, 50), 
              new PointF(500, 100), 
              new PointF(600, 150), 
              new PointF(550, 250), 
              new PointF(500, 300) 
            };

            // Draw a series of Bezier curves.
            using (var pen = new Pen(Color.Red, 5))
                graphics.DrawBeziers(pen, points);

            // Add graphics content to the document page.
            graphics.AddToPageForeground(page, 72, 72);
        }
    processor.SaveDocument("out2.pdf");
}
Process.Start("out.pdf");
See Also