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
PdfGraphicsGraphics 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
PdfGraphicsGraphics context where the element should be drawn.
location
PointFLocation 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
PdfGraphicsGraphics context where the element should be printed.
x
floatX co-ordinate of the element.
y
floatY 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
PdfGraphicsGraphics context where the element should be printed.