Class PdfDrawElement
- Namespace
- Syncfusion.Pdf.Graphics
- Assembly
- Syncfusion.Pdf.Portable.dll
Represents a graphics element which can be drawn by a pen.
public abstract class PdfDrawElement : PdfShapeElement
- Inheritance
-
PdfDrawElement
- 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 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.
protected PdfDrawElement()
PdfDrawElement(PdfPen)
Initializes a new instance of the PdfDrawElement class with the specified pen
protected PdfDrawElement(PdfPen pen)
Parameters
pen
PdfPenThe pen.
Properties
Pen
Gets or sets a pen that will be used to draw the element.
public PdfPen Pen { get; set; }
Property Value
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)
Methods
ObtainPen()
Gets the pen. If both pen and brush are not explicitly defined, default pen will be used.
protected virtual PdfPen ObtainPen()
Returns
- PdfPen
Gets the pen for drawing.