Table of Contents

Class PdfGradientBrush

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

Encapsulates a PdfBrush with a gradient brush.

public abstract class PdfGradientBrush : PdfBrush, ICloneable
Inheritance
PdfGradientBrush
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 gradient brush.  
PdfLinearGradientBrush brush = new PdfLinearGradientBrush(new PointF(0, 0), new PointF(200, 100), Color.Red, Color.Blue);   
//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 gradient brush.           
Dim brush As New PdfLinearGradientBrush(New PointF(0, 0), New PointF(200, 100), Color.Red, Color.Blue)
'Draw rectangle.
graphics.DrawRectangle(brush, New RectangleF(0, 0, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

Properties

AntiAlias

Gets or sets a value indicating whether use anti aliasing algorithm.

public bool AntiAlias { get; set; }

Property Value

bool

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 gradient brush.  
PdfLinearGradientBrush brush = new PdfLinearGradientBrush(new PointF(0, 0), new PointF(200, 100), Color.Red, Color.Blue); 
 //Set anti alias.
 brush.AntiAlias = true;   
//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 gradient brush.           
Dim brush As New PdfLinearGradientBrush(New PointF(0, 0), New PointF(200, 100), Color.Red, Color.Blue)
'Set anti alias.
brush.AntiAlias = True   
'Draw rectangle.
graphics.DrawRectangle(brush, New RectangleF(0, 0, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

Background

Gets or sets the background color of the brush.

public PdfColor Background { get; set; }

Property Value

PdfColor

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 gradient brush.  
PdfLinearGradientBrush brush = new PdfLinearGradientBrush(new PointF(0, 0), new PointF(200, 100), Color.Red, Color.Blue); 
//Set the background.
brush.Background = Color.Black;
//Draw rectangle.
graphics.DrawRectangle(brush, new RectangleF(0, 0, 300, 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 gradient brush.           
Dim brush As New PdfLinearGradientBrush(New PointF(0, 0), New PointF(200, 100), Color.Red, Color.Blue)
'Set the background.
brush.Background = Color.Black
'Draw rectangle.
graphics.DrawRectangle(brush, New RectangleF(0, 0, 300, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

Remarks

This value is optional. If null is assigned to it, the associated entry is removed from the appropriate dictionary.

Methods

CloneAntiAliasingValue(PdfGradientBrush)

Clones the anti aliasing value.

protected void CloneAntiAliasingValue(PdfGradientBrush brush)

Parameters

brush PdfGradientBrush

The brush.

CloneBackgroundValue(PdfGradientBrush)

Clones the background value.

protected void CloneBackgroundValue(PdfGradientBrush brush)

Parameters

brush PdfGradientBrush

The brush.