Class PdfDrawElement
Represents a graphics element which can be drawn by a pen.
Inheritance
System.Object
PdfDrawElement
Inherited Members
Namespace: Syncfusion.Pdf.Graphics
Assembly: Syncfusion.Pdf.NET.dll
Syntax
public abstract class PdfDrawElement : PdfShapeElement
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
PdfPage page = document.Pages.Add();
//Create new PDF pen.
PdfPen pen = new PdfPen(Color.Red);
//Create new PdfLine instance.
PdfLine line = new PdfLine(pen, new PointF(0, 0), new PointF(100, 0));
//Draw the line to PDF page.
line.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 PDF pen.
Dim pen As New PdfPen(Color.Red)
'Create new PdfLine instance.
Dim line As New PdfLine(pen, New PointF(0, 0), New PointF(100, 0))
'Draw the line to PDF page.
line.Draw(page, PointF.Empty)
'Save the PDF docment.
document.Save("output.pdf")
'Close the PDF document.
document.Close(True)
Constructors
PdfDrawElement()
Initializes a new instance of the PdfDrawElement class.
Declaration
protected PdfDrawElement()
PdfDrawElement(PdfPen)
Initializes a new instance of the PdfDrawElement class with the specified pen
Declaration
protected PdfDrawElement(PdfPen pen)
Parameters
Type | Name | Description |
---|---|---|
PdfPen | pen | The pen. |
Properties
Pen
Gets or sets a pen that will be used to draw the element.
Declaration
public PdfPen Pen { get; set; }
Property Value
Type |
---|
PdfPen |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a new PDF page.
PdfPage page = document.Pages.Add();
//Create new PdfLine instance.
PdfLine line = new PdfLine(new PointF(0, 0), new PointF(100, 0));
//Set pen.
line.Pen = new PdfPen(Color.Red);
//Draw the line to PDF page.
line.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 PdfLine instance.
Dim line As New PdfLine(New PointF(0, 0), New PointF(100, 0))
'Set pen.
line.Pen = New PdfPen(Color.Red)
'Draw the line to PDF page.
line.Draw(page, PointF.Empty)
'Save the PDF docment.
document.Save("output.pdf")
'Close the PDF document.
document.Close(True)