Table of Contents

Class PdfBrush

Namespace
Syncfusion.Pdf.Graphics
Assembly
Syncfusion.Pdf.Portable.dll

Provides objects used to fill the interiors of graphical shapes such as rectangles, ellipses, pies, polygons, and paths.

public abstract class PdfBrush : ICloneable
Inheritance
PdfBrush
Implements
Derived
Inherited Members

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create new PDF brush.
PdfBrush brush = new PdfSolidBrush(Color.Red);
//Draw rectangle.
graphics.DrawRectangle(brush, new RectangleF(0, 0, 200, 100));
//Save the document.
doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create new PDF brush.
Dim brush As PdfBrush = New PdfSolidBrush(Color.Red)
'Draw rectangle.
graphics.DrawRectangle(brush, New RectangleF(0, 0, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

Constructors

PdfBrush()

protected PdfBrush()

Methods

Clone()

Creates a new copy of a brush.

public abstract PdfBrush Clone()

Returns

PdfBrush

A new instance of the Brush class.

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create new PDF brush.
PdfBrush brush = new PdfSolidBrush(Color.Red);
//Draw rectangle.
graphics.DrawRectangle(brush, new RectangleF(0, 0, 200, 100));
//Clone the existing brush.
PdfBrush brush1 = brush.Clone();
(brush1 as PdfSolidBrush).Color = Color.Green;
//Draw circle.
graphics.DrawEllipse(brush1, new RectangleF(300, 0, 200, 100));
//Save the document.
doc.Save("Output.pdf");
//Close the document.
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Create new PDF brush.
Dim brush As PdfBrush = New PdfSolidBrush(Color.Red)
'Draw rectangle.
graphics.DrawRectangle(brush, New RectangleF(0, 0, 200, 100))
'Clone the existing brush.
Dim brush1 As PdfBrush = brush.Clone()
TryCast(brush1, PdfSolidBrush).Color = Color.Green
'Draw circle.
graphics.DrawEllipse(brush1, New RectangleF(300, 0, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)