Table of Contents

Class PdfTilingBrush

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

Implements a colored tiling brush.

public class PdfTilingBrush : PdfBrush, ICloneable
Inheritance
PdfTilingBrush
Implements
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 tile brush.  
PdfTilingBrush brush = new PdfTilingBrush(new RectangleF(0, 0, 11, 11));
//Draw rect inside the tile.
brush.Graphics.DrawRectangle(PdfPens.Red, new RectangleF(0, 0, 10, 10));
//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 tile brush. 
Dim brush As New PdfTilingBrush(New RectangleF(0, 0, 11, 11))
'Draw rect inside the tile.
brush.Graphics.DrawRectangle(PdfPens.Red, New RectangleF(0, 0, 10, 10))
'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

PdfTilingBrush(RectangleF)

Initializes a new instance of the PdfTilingBrush class.

public PdfTilingBrush(RectangleF rectangle)

Parameters

rectangle RectangleF

The boundaries of the smallest brush cell.

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 tile brush.  
PdfTilingBrush brush = new PdfTilingBrush(new RectangleF(0, 0, 11, 11));
//Draw rect inside the tile.
brush.Graphics.DrawRectangle(PdfPens.Red, new RectangleF(0, 0, 10, 10));
//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 tile brush. 
Dim brush As New PdfTilingBrush(New RectangleF(0, 0, 11, 11))
'Draw rect inside the tile.
brush.Graphics.DrawRectangle(PdfPens.Red, New RectangleF(0, 0, 10, 10))
'Draw rectangle.
graphics.DrawRectangle(brush, New RectangleF(0, 0, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

PdfTilingBrush(RectangleF, PdfPage)

Initializes a new instance of the PdfTilingBrush class.

public PdfTilingBrush(RectangleF rectangle, PdfPage page)

Parameters

rectangle RectangleF

The boundaries of the smallest brush cell.

page PdfPage

The Current Page Object.

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Set document color space
doc.ColorSpace = PdfColorSpace.GrayScale;
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create new PDF tile brush.  
PdfTilingBrush brush = new PdfTilingBrush(new RectangleF(0, 0, 11, 11), page);
//Draw rect inside the tile.
brush.Graphics.DrawRectangle(PdfPens.Red, new RectangleF(0, 0, 10, 10));
//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()
'Set document color space
doc.ColorSpace = PdfColorSpace.GrayScale
'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 tile brush. 
Dim brush As New PdfTilingBrush(New RectangleF(0, 0, 11, 11), page)
'Draw rect inside the tile.
brush.Graphics.DrawRectangle(PdfPens.Red, New RectangleF(0, 0, 10, 10))
'Draw rectangle.
graphics.DrawRectangle(brush, New RectangleF(0, 0, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

PdfTilingBrush(RectangleF, float)

Initialize a new instance of PdfTilingBrush with the specified rectangle as the pattern and the outer size that defines the spacing between repeated instances of the pattern.

public PdfTilingBrush(RectangleF rectangle, float outerSize)

Parameters

rectangle RectangleF

The rectangular region that serves as the pattern's area is defined.

outerSize float

The spacing between the repeated instances of the pattern is defined by its size.

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 tile brush.  
PdfTilingBrush brush = new PdfTilingBrush(new RectangleF(0, 0, 11, 11), 842);
//Draw rect inside the tile.
brush.Graphics.DrawRectangle(PdfPens.Red, new RectangleF(0, 0, 10, 10));
//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 tile brush. 
Dim brush As New PdfTilingBrush(New RectangleF(0, 0, 11, 11), 842)
'Draw rect inside the tile.
brush.Graphics.DrawRectangle(PdfPens.Red, New RectangleF(0, 0, 10, 10))
'Draw rectangle.
graphics.DrawRectangle(brush, New RectangleF(0, 0, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

PdfTilingBrush(SizeF)

Initializes a new instance of the PdfTilingBrush class.

public PdfTilingBrush(SizeF size)

Parameters

size SizeF

The size of the smallest brush cell.

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 tile brush.  
PdfTilingBrush brush = new PdfTilingBrush(new SizeF(11, 11));
//Draw rect inside the tile.
brush.Graphics.DrawRectangle(PdfPens.Red, new RectangleF(0, 0, 10, 10));
//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 tile brush. 
Dim brush As New PdfTilingBrush(New SizeF(11, 11))
'Draw rect inside the tile.
brush.Graphics.DrawRectangle(PdfPens.Red, New RectangleF(0, 0, 10, 10))
'Draw rectangle.
graphics.DrawRectangle(brush, New RectangleF(0, 0, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

PdfTilingBrush(SizeF, PdfPage)

Initializes a new instance of the PdfTilingBrush class.

public PdfTilingBrush(SizeF size, PdfPage page)

Parameters

size SizeF

The size of the smallest brush cell.

page PdfPage

The Current Page Object.

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Set document color space
doc.ColorSpace = PdfColorSpace.GrayScale;
//Add a page to the document.
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Create new PDF tile brush.  
PdfTilingBrush brush = new PdfTilingBrush(new SizeF(11, 11), page);
//Draw rect inside the tile.
brush.Graphics.DrawRectangle(PdfPens.Red, new RectangleF(0, 0, 10, 10));
//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()
'Set document color space
doc.ColorSpace = PdfColorSpace.GrayScale
'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 tile brush. 
Dim brush As New PdfTilingBrush(New SizeF(11, 11), page)
'Draw rect inside the tile.
brush.Graphics.DrawRectangle(PdfPens.Red, New RectangleF(0, 0, 10, 10))
'Draw rectangle.
graphics.DrawRectangle(brush, New RectangleF(0, 0, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

PdfTilingBrush(SizeF, float)

Initialize a new instance of PdfTilingBrush with the specified size for the pattern and the outer size that defines the spacing between repeated instances of the pattern.

public PdfTilingBrush(SizeF size, float outerSize)

Parameters

size SizeF

Specify the dimensions of the pattern.

outerSize float

The spacing between the repeated instances of the pattern is defined by its size.

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 tile brush.  
PdfTilingBrush brush = new PdfTilingBrush(new SizeF(11, 11), 842);
//Draw rect inside the tile.
brush.Graphics.DrawRectangle(PdfPens.Red, new RectangleF(0, 0, 10, 10));
//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 tile brush. 
Dim brush As New PdfTilingBrush(New SizeF(11, 11), 842)
'Draw rect inside the tile.
brush.Graphics.DrawRectangle(PdfPens.Red, New RectangleF(0, 0, 10, 10))
'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

Graphics

Gets Graphics context of the brush.

public PdfGraphics Graphics { get; }

Property Value

PdfGraphics

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 tile brush.  
PdfTilingBrush brush = new PdfTilingBrush(new RectangleF(0, 0, 11, 11));
//Draw rect inside the tile.
brush.Graphics.DrawRectangle(PdfPens.Red, new RectangleF(0, 0, 10, 10));
//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 tile brush. 
Dim brush As New PdfTilingBrush(New RectangleF(0, 0, 11, 11))
'Draw rect inside the tile.
brush.Graphics.DrawRectangle(PdfPens.Red, New RectangleF(0, 0, 10, 10))
'Draw rectangle.
graphics.DrawRectangle(brush, New RectangleF(0, 0, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

Rectangle

Gets the boundary box of the smallest brush cell.

public RectangleF Rectangle { get; }

Property Value

RectangleF

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 tile brush.  
PdfTilingBrush brush = new PdfTilingBrush(new RectangleF(0, 0, 11, 11));
//Draw rect inside the tile.
brush.Graphics.DrawRectangle(PdfPens.Red, new RectangleF(0, 0, 10, 10));
//Get the smallest cell bounds.
RectangleF smallestCellBounds = brush.Rectangle;
//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 tile brush. 
Dim brush As New PdfTilingBrush(New RectangleF(0, 0, 11, 11))
'Draw rect inside the tile.
brush.Graphics.DrawRectangle(PdfPens.Red, New RectangleF(0, 0, 10, 10))
'Get the smallest cell bounds.
Dim smallestCellBounds As RectangleF = brush.Rectangle
'Draw rectangle.
graphics.DrawRectangle(brush, New RectangleF(0, 0, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

Size

Gets the size of the smallest brush cell.

public SizeF Size { get; }

Property Value

SizeF

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 tile brush.  
PdfTilingBrush brush = new PdfTilingBrush(new RectangleF(0, 0, 11, 11));
//Draw rect inside the tile.
brush.Graphics.DrawRectangle(PdfPens.Red, new RectangleF(0, 0, 10, 10));
//Get the smallest cell size.
SizeF smallestCellSize = brush.Size;
//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 tile brush. 
Dim brush As New PdfTilingBrush(New RectangleF(0, 0, 11, 11))
'Draw rect inside the tile.
brush.Graphics.DrawRectangle(PdfPens.Red, New RectangleF(0, 0, 10, 10))
'Get the smallest cell size.
Dim smallestCellSize As SizeF = brush.Size
'Draw rectangle.
graphics.DrawRectangle(brush, New RectangleF(0, 0, 200, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)

Methods

Clone()

Creates a new copy of a brush.

public override 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 tile brush.  
PdfTilingBrush brush = new PdfTilingBrush(new RectangleF(0, 0, 11, 11));
//Draw rect inside the tile.
brush.Graphics.DrawRectangle(PdfPens.Red, new RectangleF(0, 0, 10, 10));
//Draw rectangle.
graphics.DrawRectangle(brush, new RectangleF(0, 0, 200, 100)); 
//Clone the existing tile brush.
PdfTilingBrush cBrush = brush.Clone() as PdfTilingBrush;
//Draw rectangle.
graphics.DrawRectangle(cBrush, new RectangleF(0, 150, 100, 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 tile brush. 
Dim brush As New PdfTilingBrush(New RectangleF(0, 0, 11, 11))
'Draw rect inside the tile.
brush.Graphics.DrawRectangle(PdfPens.Red, New RectangleF(0, 0, 10, 10))
'Draw rectangle.
graphics.DrawRectangle(brush, New RectangleF(0, 0, 200, 100))
'Clone the existing tile brush.
Dim cBrush As PdfTilingBrush = TryCast(brush.Clone(), PdfTilingBrush)
'Draw rectangle.
graphics.DrawRectangle(cBrush, New RectangleF(0, 150, 100, 100))
'Save the document.
doc.Save("Output.pdf")
'Close the document.
doc.Close(True)