PdfGraphicsElement Class
Represents a base class for all the page graphics elements.
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Syncfusion.Pdf.Graphics
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public abstract class PdfGraphicsElement
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.
Declaration
protected PdfGraphicsElement()
Methods
Draw(PdfGraphics)
Draws an element on the Graphics.
Declaration
public void Draw(PdfGraphics graphics)
Parameters
Type | Name | Description |
---|---|---|
PdfGraphics | graphics | 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.
Declaration
public void Draw(PdfGraphics graphics, PointF location)
Parameters
Type | Name | Description |
---|---|---|
PdfGraphics | graphics | Graphics context where the element should be drawn. |
System.Drawing.PointF | location | 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, Single, Single)
Draws an element on the Graphics.
Declaration
public virtual void Draw(PdfGraphics graphics, float x, float y)
Parameters
Type | Name | Description |
---|---|---|
PdfGraphics | graphics | Graphics context where the element should be printed. |
System.Single | x | X co-ordinate of the element. |
System.Single | y | 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)