Class PdfRectangle
- Namespace
- Syncfusion.Pdf.Graphics
- Assembly
- Syncfusion.Pdf.Portable.dll
Represents a simple rectangle that could be drawn and/or filled.
public class PdfRectangle : PdfRectangleArea
- Inheritance
-
PdfRectangle
- Inherited Members
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(RectangleF)
Initializes a new instance of the PdfRectangle class.
public PdfRectangle(RectangleF rectangle)
Parameters
rectangle
RectangleFThe 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(PdfBrush, RectangleF)
Initializes a new instance of the PdfRectangle class.
public PdfRectangle(PdfBrush brush, RectangleF rectangle)
Parameters
brush
PdfBrushThe brush.
rectangle
RectangleFThe 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, float, float)
Initializes a new instance of the PdfRectangle class.
public PdfRectangle(PdfBrush brush, float width, float height)
Parameters
brush
PdfBrushThe brush.
width
floatThe width of the rectangle.
height
floatThe 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, float, float, float, float)
Initializes a new instance of the PdfRectangle class.
public PdfRectangle(PdfBrush brush, float x, float y, float width, float height)
Parameters
brush
PdfBrushThe brush.
x
floatThe x-coordinate of the upper-left corner of this Rectangle.
y
floatThe y-coordinate of the upper-left corner of this Rectangle.
width
floatThe width of the rectangle.
height
floatThe 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, RectangleF)
Initializes a new instance of the PdfRectangle class.
public PdfRectangle(PdfPen pen, RectangleF rectangle)
Parameters
pen
PdfPenThe pen.
rectangle
RectangleFThe 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, PdfBrush, RectangleF)
Initializes a new instance of the PdfRectangle class.
public PdfRectangle(PdfPen pen, PdfBrush brush, RectangleF rectangle)
Parameters
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, float, float)
Initializes a new instance of the PdfRectangle class.
public PdfRectangle(PdfPen pen, PdfBrush brush, float width, float height)
Parameters
pen
PdfPenThe pen.
brush
PdfBrushThe brush.
width
floatThe width of the rectangle.
height
floatThe 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, float, float, float, float)
Initializes a new instance of the PdfRectangle class.
public PdfRectangle(PdfPen pen, PdfBrush brush, float x, float y, float width, float height)
Parameters
pen
PdfPenThe pen.
brush
PdfBrushThe brush.
x
floatThe x-coordinate of the upper-left corner of this Rectangle.
y
floatThe y-coordinate of the upper-left corner of this Rectangle.
width
floatThe width of the rectangle.
height
floatThe 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, float, float)
Initializes a new instance of the PdfRectangle class.
public PdfRectangle(PdfPen pen, float width, float height)
Parameters
pen
PdfPenThe pen.
width
floatThe width of the rectangle.
height
floatThe 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, float, float, float, float)
Initializes a new instance of the PdfRectangle class.
public PdfRectangle(PdfPen pen, float x, float y, float width, float height)
Parameters
pen
PdfPenThe pen.
x
floatThe x-coordinate of the upper-left corner of this Rectangle.
y
floatThe y-coordinate of the upper-left corner of this Rectangle.
width
floatThe width of the rectangle.
height
floatThe 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(float, float)
Initializes a new instance of the PdfRectangle class.
public PdfRectangle(float width, float height)
Parameters
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(float, float, float, float)
Initializes a new instance of the PdfRectangle class.
public PdfRectangle(float x, float y, float width, float height)
Parameters
x
floatThe x-coordinate of the upper-left corner of this Rectangle.
y
floatThe y-coordinate of the upper-left corner of this Rectangle.
width
floatThe width of the rectangle.
height
floatThe 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)
Methods
DrawInternal(PdfGraphics)
Draws an element on the Graphics.
protected override void DrawInternal(PdfGraphics graphics)
Parameters
graphics
PdfGraphicsGraphics context where the element should be printed.