Skip to main content
All docs
V23.2

PdfGraphics.DrawBeziers(DXPen, PointF[]) Method

Draws a Bezier curve specified by four points (in the world coordinate system).

Namespace: DevExpress.Pdf

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

NuGet Package: DevExpress.Pdf.Drawing

Declaration

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

Parameters

Name Type Description
pen DXPen

A DXPen 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 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. To draw a Bezier curve, pass the pen parameter and point parameters (pt1, pt2, pt3, pt4) 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 Bezier curve using the four specified points.

Draw a Bezier Curve

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

using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
    processor.CreateEmptyDocument();
    PdfPage page = processor.AddNewPage(PdfPaperSize.A4);
        using (PdfGraphics graphics = processor.CreateGraphics())
        {
            // Draw a Bezier curve.
            using (var pen = new DXPen(Color.Red, 5))
            graphics.DrawBezier(pen, new PointF(100, 750), 
                new PointF(170, 100), new PointF(300, 500), 
                new PointF(400, 100));

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