Skip to main content

PdfGraphics.DrawEllipse(Pen, RectangleF) Method

Draws an ellipse in the specified page rectangle.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Pdf.v24.1.Drawing.dll

NuGet Package: DevExpress.Pdf.Drawing

Declaration

public void DrawEllipse(
    Pen pen,
    RectangleF rect
)

Parameters

Name Type Description
pen Pen

A Pen structure that specifies the color, width, and style of the ellipse.

rect RectangleF

A RectangleF structure that specifies a page area (in world coordinate system) where you can draw an ellipse.

Remarks

Use this method to draw an ellipse in the page area specified by the rect parameter.

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 an ellipse in the specified area of the document page.

Draw an Ellipse

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

using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
    processor.CreateEmptyDocument();
    PdfPage page = processor.AddNewPage(PdfPaperSize.A4);
        using (PdfGraphics graphics = processor.CreateGraphics())
        {
            // Draw an ellipse.
            using (var pen = new Pen(Color.Red, 5))
                graphics.DrawEllipse(pen, new RectangleF(50, 50, 500, 300));

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