Class PdfRectangle
Represents a simple rectangle that could be drawn and/or filled.
Inheritance
Inherited Members
Namespace: Syncfusion.Pdf.Graphics
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfRectangle : PdfRectangleArea
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
PdfPage page = document.Pages.Add();
//Create new PdfRectangle instance.
PdfRectangle rect = new PdfRectangle(200, 100);
//Draw the rectangle to PDF page.
rect.Draw(page, PointF.Empty);
//Save the PDF docment.
document.Save("output.pdf");
//Close the PDF document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a new PDF page.
Dim page As PdfPage = document.Pages.Add()
'Create new PdfRectangle instance.
Dim rect As New PdfRectangle(200, 100)
'Draw the rectangle to PDF page.
rect.Draw(page, PointF.Empty)
'Save the PDF docment.
document.Save("output.pdf")
Close the PDF document.
document.Close(True)
Constructors
PdfRectangle(PdfBrush, RectangleF)
Initializes a new instance of the PdfRectangle class.
Declaration
public PdfRectangle(PdfBrush brush, RectangleF rectangle)
Parameters
| Type | Name | Description |
|---|---|---|
| PdfBrush | brush | The brush. |
| System.Drawing.RectangleF | rectangle | The rectangle. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
PdfPage page = document.Pages.Add();
//Create new PDF solid brush.
PdfBrush brush = new PdfSolidBrush(Color.Green);
//Create new PdfRectangle instance.
PdfRectangle rect = new PdfRectangle(brush, new RectangleF(0, 0, 200, 100));
//Draw the rectangle to PDF page.
rect.Draw(page, PointF.Empty);
//Save the PDF docment.
document.Save("output.pdf");
//Close the PDF document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a new PDF page.
Dim page As PdfPage = document.Pages.Add()
'Create new PDF solid brush.
Dim brush As PdfBrush = New PdfSolidBrush(Color.Green)
'Create new PdfRectangle instance.
Dim rect As New PdfRectangle(brush, New RectangleF(0, 0, 200, 100))
'Draw the rectangle to PDF page.
rect.Draw(page, PointF.Empty)
'Save the PDF docment.
document.Save("output.pdf")
Close the PDF document.
document.Close(True)
PdfRectangle(PdfBrush, Single, Single)
Initializes a new instance of the PdfRectangle class.
Declaration
public PdfRectangle(PdfBrush brush, float width, float height)
Parameters
| Type | Name | Description |
|---|---|---|
| PdfBrush | brush | The brush. |
| System.Single | width | The width of the rectangle. |
| System.Single | height | The height of the rectangle. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
PdfPage page = document.Pages.Add();
//Create new PDF solid brush.
PdfBrush brush = new PdfSolidBrush(Color.Green);
//Create new PdfRectangle instance.
PdfRectangle rect = new PdfRectangle(brush, 200, 100);
//Draw the rectangle to PDF page.
rect.Draw(page, PointF.Empty);
//Save the PDF docment.
document.Save("output.pdf");
//Close the PDF document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a new PDF page.
Dim page As PdfPage = document.Pages.Add()
'Create new PDF solid brush.
Dim brush As PdfBrush = New PdfSolidBrush(Color.Green)
'Create new PdfRectangle instance.
Dim rect As New PdfRectangle(brush, 200, 100)
'Draw the rectangle to PDF page.
rect.Draw(page, PointF.Empty)
'Save the PDF docment.
document.Save("output.pdf")
Close the PDF document.
document.Close(True)
PdfRectangle(PdfBrush, Single, Single, Single, Single)
Initializes a new instance of the PdfRectangle class.
Declaration
public PdfRectangle(PdfBrush brush, float x, float y, float width, float height)
Parameters
| Type | Name | Description |
|---|---|---|
| PdfBrush | brush | The brush. |
| System.Single | x | The x-coordinate of the upper-left corner of this Rectangle. |
| System.Single | y | The y-coordinate of the upper-left corner of this Rectangle. |
| System.Single | width | The width of the rectangle. |
| System.Single | height | The height of the rectangle. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
PdfPage page = document.Pages.Add();
//Create new PDF solid brush.
PdfBrush brush = new PdfSolidBrush(Color.Green);
//Create new PdfRectangle instance.
PdfRectangle rect = new PdfRectangle(brush, 0, 0, 200, 100);
//Draw the rectangle to PDF page.
rect.Draw(page, PointF.Empty);
//Save the PDF docment.
document.Save("output.pdf");
//Close the PDF document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a new PDF page.
Dim page As PdfPage = document.Pages.Add()
'Create new PDF solid brush.
Dim brush As PdfBrush = New PdfSolidBrush(Color.Green)
'Create new PdfRectangle instance.
Dim rect As New PdfRectangle(brush, 0, 0, 200, 100)
'Draw the rectangle to PDF page.
rect.Draw(page, PointF.Empty)
'Save the PDF docment.
document.Save("output.pdf")
Close the PDF document.
document.Close(True)
PdfRectangle(PdfPen, PdfBrush, RectangleF)
Initializes a new instance of the PdfRectangle class.
Declaration
public PdfRectangle(PdfPen pen, PdfBrush brush, RectangleF rectangle)
Parameters
| Type | Name | Description |
|---|---|---|
| PdfPen | pen | The pen. |
| PdfBrush | brush | The brush. |
| System.Drawing.RectangleF | rectangle | The rectangle. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
PdfPage page = document.Pages.Add();
//Create new PDF pen.
PdfPen pen = new PdfPen(Color.Red);
//Create new PDF solid brush.
PdfBrush brush = new PdfSolidBrush(Color.Green);
//Create new PdfRectangle instance.
PdfRectangle rect = new PdfRectangle(pen, brush, new RectangleF(0, 0, 200, 100));
//Draw the rectangle to PDF page.
rect.Draw(page, PointF.Empty);
//Save the PDF docment.
document.Save("output.pdf");
//Close the PDF document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a new PDF page.
Dim page As PdfPage = document.Pages.Add()
'Create new PDF pen.
Dim pen As New PdfPen(Color.Red)
'Create new PDF solid brush.
Dim brush As PdfBrush = New PdfSolidBrush(Color.Green)
'Create new PdfRectangle instance.
Dim rect As New PdfRectangle(pen, brush, New RectangleF(0, 0, 200, 100))
'Draw the rectangle to PDF page.
rect.Draw(page, PointF.Empty)
'Save the PDF docment.
document.Save("output.pdf")
Close the PDF document.
document.Close(True)
PdfRectangle(PdfPen, PdfBrush, Single, Single)
Initializes a new instance of the PdfRectangle class.
Declaration
public PdfRectangle(PdfPen pen, PdfBrush brush, float width, float height)
Parameters
| Type | Name | Description |
|---|---|---|
| PdfPen | pen | The pen. |
| PdfBrush | brush | The brush. |
| System.Single | width | The width of the rectangle. |
| System.Single | height | The height of the rectangle. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
PdfPage page = document.Pages.Add();
//Create new PDF pen.
PdfPen pen = new PdfPen(Color.Red);
//Create new PDF solid brush.
PdfBrush brush = new PdfSolidBrush(Color.Green);
//Create new PdfRectangle instance.
PdfRectangle rect = new PdfRectangle(pen, brush, 200, 100);
//Draw the rectangle to PDF page.
rect.Draw(page, PointF.Empty);
//Save the PDF docment.
document.Save("output.pdf");
//Close the PDF document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a new PDF page.
Dim page As PdfPage = document.Pages.Add()
'Create new PDF pen.
Dim pen As New PdfPen(Color.Red)
'Create new PDF solid brush.
Dim brush As PdfBrush = New PdfSolidBrush(Color.Green)
'Create new PdfRectangle instance.
Dim rect As New PdfRectangle(pen, brush, 200, 100)
'Draw the rectangle to PDF page.
rect.Draw(page, PointF.Empty)
'Save the PDF docment.
document.Save("output.pdf")
Close the PDF document.
document.Close(True)
PdfRectangle(PdfPen, PdfBrush, Single, Single, Single, Single)
Initializes a new instance of the PdfRectangle class.
Declaration
public PdfRectangle(PdfPen pen, PdfBrush brush, float x, float y, float width, float height)
Parameters
| Type | Name | Description |
|---|---|---|
| PdfPen | pen | The pen. |
| PdfBrush | brush | The brush. |
| System.Single | x | The x-coordinate of the upper-left corner of this Rectangle. |
| System.Single | y | The y-coordinate of the upper-left corner of this Rectangle. |
| System.Single | width | The width of the rectangle. |
| System.Single | height | The height of the rectangle. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
PdfPage page = document.Pages.Add();
//Create new PDF pen.
PdfPen pen = new PdfPen(Color.Red);
//Create new PDF solid brush.
PdfBrush brush = new PdfSolidBrush(Color.Green);
//Create new PdfRectangle instance.
PdfRectangle rect = new PdfRectangle(pen, brush, 0, 0, 200, 100);
//Draw the rectangle to PDF page.
rect.Draw(page, PointF.Empty);
//Save the PDF docment.
document.Save("output.pdf");
//Close the PDF document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a new PDF page.
Dim page As PdfPage = document.Pages.Add()
'Create new PDF pen.
Dim pen As New PdfPen(Color.Red)
'Create new PDF solid brush.
Dim brush As PdfBrush = New PdfSolidBrush(Color.Green)
'Create new PdfRectangle instance.
Dim rect As New PdfRectangle(pen, brush, 0, 0, 200, 100)
'Draw the rectangle to PDF page.
rect.Draw(page, PointF.Empty)
'Save the PDF docment.
document.Save("output.pdf")
Close the PDF document.
document.Close(True)
PdfRectangle(PdfPen, RectangleF)
Initializes a new instance of the PdfRectangle class.
Declaration
public PdfRectangle(PdfPen pen, RectangleF rectangle)
Parameters
| Type | Name | Description |
|---|---|---|
| PdfPen | pen | The pen. |
| System.Drawing.RectangleF | rectangle | The rectangle. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
PdfPage page = document.Pages.Add();
//Create new PDF pen.
PdfPen pen = new PdfPen(Color.Red);
//Create new PdfRectangle instance.
PdfRectangle rect = new PdfRectangle(pen, new RectangleF(0, 0, 200, 100));
//Draw the rectangle to PDF page.
rect.Draw(page, PointF.Empty);
//Save the PDF docment.
document.Save("output.pdf");
//Close the PDF document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a new PDF page.
Dim page As PdfPage = document.Pages.Add()
'Create new PDF pen.
Dim pen As New PdfPen(Color.Red)
'Create new PdfRectangle instance.
Dim rect As New PdfRectangle(pen, New RectangleF(0, 0, 200, 100))
'Draw the rectangle to PDF page.
rect.Draw(page, PointF.Empty)
'Save the PDF docment.
document.Save("output.pdf")
Close the PDF document.
document.Close(True)
PdfRectangle(PdfPen, Single, Single)
Initializes a new instance of the PdfRectangle class.
Declaration
public PdfRectangle(PdfPen pen, float width, float height)
Parameters
| Type | Name | Description |
|---|---|---|
| PdfPen | pen | The pen. |
| System.Single | width | The width of the rectangle. |
| System.Single | height | The height of the rectangle. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
PdfPage page = document.Pages.Add();
//Create new PDF pen.
PdfPen pen = new PdfPen(Color.Red);
//Create new PdfRectangle instance.
PdfRectangle rect = new PdfRectangle(pen, 200, 100);
//Draw the rectangle to PDF page.
rect.Draw(page, PointF.Empty);
//Save the PDF docment.
document.Save("output.pdf");
//Close the PDF document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a new PDF page.
Dim page As PdfPage = document.Pages.Add()
'Create new PDF pen.
Dim pen As New PdfPen(Color.Red)
'Create new PdfRectangle instance.
Dim rect As New PdfRectangle(pen, 200, 100)
'Draw the rectangle to PDF page.
rect.Draw(page, PointF.Empty)
'Save the PDF docment.
document.Save("output.pdf")
Close the PDF document.
document.Close(True)
PdfRectangle(PdfPen, Single, Single, Single, Single)
Initializes a new instance of the PdfRectangle class.
Declaration
public PdfRectangle(PdfPen pen, float x, float y, float width, float height)
Parameters
| Type | Name | Description |
|---|---|---|
| PdfPen | pen | The pen. |
| System.Single | x | The x-coordinate of the upper-left corner of this Rectangle. |
| System.Single | y | The y-coordinate of the upper-left corner of this Rectangle. |
| System.Single | width | The width of the rectangle. |
| System.Single | height | The height of the rectangle. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
PdfPage page = document.Pages.Add();
//Create new PDF pen.
PdfPen pen = new PdfPen(Color.Red);
//Create new PdfRectangle instance.
PdfRectangle rect = new PdfRectangle(pen, 0, 0, 200, 100);
//Draw the rectangle to PDF page.
rect.Draw(page, PointF.Empty);
//Save the PDF docment.
document.Save("output.pdf");
//Close the PDF document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a new PDF page.
Dim page As PdfPage = document.Pages.Add()
'Create new PDF pen.
Dim pen As New PdfPen(Color.Red)
'Create new PdfRectangle instance.
Dim rect As New PdfRectangle(pen, 0, 0, 200, 100)
'Draw the rectangle to PDF page.
rect.Draw(page, PointF.Empty)
'Save the PDF docment.
document.Save("output.pdf")
Close the PDF document.
document.Close(True)
PdfRectangle(RectangleF)
Initializes a new instance of the PdfRectangle class.
Declaration
public PdfRectangle(RectangleF rectangle)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.RectangleF | rectangle | The rectangle. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
PdfPage page = document.Pages.Add();
//Create new PdfRectangle instance.
PdfRectangle rect = new PdfRectangle(new RectangleF(0, 0, 200, 100));
//Draw the rectangle to PDF page.
rect.Draw(page, PointF.Empty);
//Save the PDF docment.
document.Save("output.pdf");
//Close the PDF document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a new PDF page.
Dim page As PdfPage = document.Pages.Add()
'Create new PdfRectangle instance.
Dim rect As New PdfRectangle(New RectangleF(0, 0, 200, 100))
'Draw the rectangle to PDF page.
rect.Draw(page, PointF.Empty)
'Save the PDF docment.
document.Save("output.pdf")
Close the PDF document.
document.Close(True)
PdfRectangle(Single, Single)
Initializes a new instance of the PdfRectangle class.
Declaration
public PdfRectangle(float width, float height)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | width | The width of the rectangle. |
| System.Single | height | The height of the rectangle. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
PdfPage page = document.Pages.Add();
//Create new PdfRectangle instance.
PdfRectangle rect = new PdfRectangle(200, 100);
//Draw the rectangle to PDF page.
rect.Draw(page, PointF.Empty);
//Save the PDF docment.
document.Save("output.pdf");
//Close the PDF document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a new PDF page.
Dim page As PdfPage = document.Pages.Add()
'Create new PdfRectangle instance.
Dim rect As New PdfRectangle(200, 100)
'Draw the rectangle to PDF page.
rect.Draw(page, PointF.Empty)
'Save the PDF docment.
document.Save("output.pdf")
Close the PDF document.
document.Close(True)
PdfRectangle(Single, Single, Single, Single)
Initializes a new instance of the PdfRectangle class.
Declaration
public PdfRectangle(float x, float y, float width, float height)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | x | The x-coordinate of the upper-left corner of this Rectangle. |
| System.Single | y | The y-coordinate of the upper-left corner of this Rectangle. |
| System.Single | width | The width of the rectangle. |
| System.Single | height | The height of the rectangle. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
PdfPage page = document.Pages.Add();
//Create new PdfRectangle instance.
PdfRectangle rect = new PdfRectangle(0, 0, 200, 100);
//Draw the rectangle to PDF page.
rect.Draw(page, PointF.Empty);
//Save the PDF docment.
document.Save("output.pdf");
//Close the PDF document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a new PDF page.
Dim page As PdfPage = document.Pages.Add()
'Create new PdfRectangle instance.
Dim rect As New PdfRectangle(0, 0, 200, 100)
'Draw the rectangle to PDF page.
rect.Draw(page, PointF.Empty)
'Save the PDF docment.
document.Save("output.pdf")
Close the PDF document.
document.Close(True)