PdfLine Class
Represents a line shape.
Inheritance
Inherited Members
Namespace: Syncfusion.Pdf.Graphics
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfLine : PdfDrawElement
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));
//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))
'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
PdfLine(PdfPen, PointF, PointF)
Initializes a new instance of the PdfLine class.
Declaration
public PdfLine(PdfPen pen, PointF point1, PointF point2)
Parameters
Type | Name | Description |
---|---|---|
PdfPen | pen | The pen. |
System.Drawing.PointF | point1 | The line start point. |
System.Drawing.PointF | point2 | The line end point. |
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)
PdfLine(PdfPen, Single, Single, Single, Single)
Initializes a new instance of the PdfLine class.
Declaration
public PdfLine(PdfPen pen, float x1, float y1, float x2, float y2)
Parameters
Type | Name | Description |
---|---|---|
PdfPen | pen | The pen. |
System.Single | x1 | The x-coordinate of the first point. |
System.Single | y1 | The y-coordinate of the first point. |
System.Single | x2 | The x-coordinate of the end pint. |
System.Single | y2 | The y-coordinate of the end pint. |
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, 0, 0, 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, 0, 0, 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)
PdfLine(PointF, PointF)
Initializes a new instance of the PdfLine class.
Declaration
public PdfLine(PointF point1, PointF point2)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.PointF | point1 | The line start point. |
System.Drawing.PointF | point2 | The line end point. |
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));
//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))
'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)
PdfLine(Single, Single, Single, Single)
Initializes a new instance of the PdfLine class from the specified two pair fo coordinates.
Declaration
public PdfLine(float x1, float y1, float x2, float y2)
Parameters
Type | Name | Description |
---|---|---|
System.Single | x1 | The x-coordinate of the first point. |
System.Single | y1 | The y-coordinate of the first point. |
System.Single | x2 | The x-coordinate of the end pint. |
System.Single | y2 | The y-coordinate of the end pint. |
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(0, 0, 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 PdfLine instance.
Dim line As New PdfLine(0, 0, 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)
Properties
X1
Gets or sets the x coordinate of the start point.
Declaration
public float X1 { get; set; }
Property Value
Type |
---|
System.Single |
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 the x coordinate of the start point.
line.X1 = 0;
//Set the y coordinate of the start point.
line.Y1 = 0;
//Set the x coordinate of the end point.
line.X2 = 100;
//Set the y coordinate of the end point.
line.Y2 = 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 PdfLine instance.
Dim line As New PdfLine(New PointF(0, 0), New PointF(100, 0))
'Set the x coordinate of the start point.
line.X1 = 0
'Set the y coordinate of the start point.
line.Y1 = 0
'Set the x coordinate of the end point.
line.X2 = 100
'Set the y coordinate of the end point.
line.Y2 = 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)
X2
Gets or sets the x coordinate of the end point.
Declaration
public float X2 { get; set; }
Property Value
Type |
---|
System.Single |
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 the x coordinate of the start point.
line.X1 = 0;
//Set the y coordinate of the start point.
line.Y1 = 0;
//Set the x coordinate of the end point.
line.X2 = 100;
//Set the y coordinate of the end point.
line.Y2 = 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 PdfLine instance.
Dim line As New PdfLine(New PointF(0, 0), New PointF(100, 0))
'Set the x coordinate of the start point.
line.X1 = 0
'Set the y coordinate of the start point.
line.Y1 = 0
'Set the x coordinate of the end point.
line.X2 = 100
'Set the y coordinate of the end point.
line.Y2 = 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)
Y1
Gets or sets the y coordinate of the start point.
Declaration
public float Y1 { get; set; }
Property Value
Type |
---|
System.Single |
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 the x coordinate of the start point.
line.X1 = 0;
//Set the y coordinate of the start point.
line.Y1 = 0;
//Set the x coordinate of the end point.
line.X2 = 100;
//Set the y coordinate of the end point.
line.Y2 = 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 PdfLine instance.
Dim line As New PdfLine(New PointF(0, 0), New PointF(100, 0))
'Set the x coordinate of the start point.
line.X1 = 0
'Set the y coordinate of the start point.
line.Y1 = 0
'Set the x coordinate of the end point.
line.X2 = 100
'Set the y coordinate of the end point.
line.Y2 = 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)
Y2
Gets or sets the y coordinate of the end point.
Declaration
public float Y2 { get; set; }
Property Value
Type |
---|
System.Single |
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 the x coordinate of the start point.
line.X1 = 0;
//Set the y coordinate of the start point.
line.Y1 = 0;
//Set the x coordinate of the end point.
line.X2 = 100;
//Set the y coordinate of the end point.
line.Y2 = 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 PdfLine instance.
Dim line As New PdfLine(New PointF(0, 0), New PointF(100, 0))
'Set the x coordinate of the start point.
line.X1 = 0
'Set the y coordinate of the start point.
line.Y1 = 0
'Set the x coordinate of the end point.
line.X2 = 100
'Set the y coordinate of the end point.
line.Y2 = 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)