Table of Contents

Class PdfGraphicsElement

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

Represents a base class for all the page graphics elements.

public abstract class PdfGraphicsElement
Inheritance
PdfGraphicsElement
Derived
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

PdfGraphicsElement()

Initializes a new instance of the PdfGraphicsElement class.

protected PdfGraphicsElement()

Methods

Draw(PdfGraphics)

Draws an element on the Graphics.

public void Draw(PdfGraphics graphics)

Parameters

graphics PdfGraphics

Graphics context where the element should be drawn.

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.Graphics);
//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.Graphics)
'Save the PDF docment.
document.Save("output.pdf") 
Close the PDF document.
document.Close(True)

Draw(PdfGraphics, PointF)

Draws an element on the Graphics.

public void Draw(PdfGraphics graphics, PointF location)

Parameters

graphics PdfGraphics

Graphics context where the element should be drawn.

location PointF

Location of the element in the Graphics' co-ordinate system.

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)

Draw(PdfGraphics, float, float)

Draws an element on the Graphics.

public virtual void Draw(PdfGraphics graphics, float x, float y)

Parameters

graphics PdfGraphics

Graphics context where the element should be printed.

x float

X co-ordinate of the element.

y float

Y co-ordinate of the element.

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, 10, 10);
//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, 10, 10)
'Save the PDF docment.
document.Save("output.pdf") 
Close the PDF document.
document.Close(True)

DrawInternal(PdfGraphics)

Draws an element on the Graphics.

protected abstract void DrawInternal(PdfGraphics graphics)

Parameters

graphics PdfGraphics

Graphics context where the element should be printed.