Class PdfLine
- Namespace
- Syncfusion.Pdf.Graphics
- Assembly
- Syncfusion.Pdf.Portable.dll
Represents a line shape.
public class PdfLine : PdfDrawElement
- Inheritance
-
PdfLine
- Inherited Members
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(PointF, PointF)
Initializes a new instance of the PdfLine class.
public PdfLine(PointF point1, PointF point2)
Parameters
point1
PointFThe line start point.
point2
PointFThe 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(PdfPen, PointF, PointF)
Initializes a new instance of the PdfLine class.
public PdfLine(PdfPen pen, PointF point1, PointF point2)
Parameters
pen
PdfPenThe pen.
point1
PointFThe line start point.
point2
PointFThe 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, float, float, float, float)
Initializes a new instance of the PdfLine class.
public PdfLine(PdfPen pen, float x1, float y1, float x2, float y2)
Parameters
pen
PdfPenThe pen.
x1
floatThe x-coordinate of the first point.
y1
floatThe y-coordinate of the first point.
x2
floatThe x-coordinate of the end pint.
y2
floatThe 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(float, float, float, float)
Initializes a new instance of the PdfLine class from the specified two pair fo coordinates.
public PdfLine(float x1, float y1, float x2, float y2)
Parameters
x1
floatThe x-coordinate of the first point.
y1
floatThe y-coordinate of the first point.
x2
floatThe x-coordinate of the end pint.
y2
floatThe 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.
public float X1 { 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 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.
public float X2 { 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 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.
public float Y1 { 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 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.
public float Y2 { 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 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)
Methods
DrawInternal(PdfGraphics)
Draws an element on the Graphics.
protected override void DrawInternal(PdfGraphics graphics)
Parameters
graphics
PdfGraphicsGraphics context where the element should be printed.
GetBoundsInternal()
Overloaded. Returns a rectangle that bounds this element.
protected override RectangleF GetBoundsInternal()
Returns
- RectangleF
Returns a rectangle that bounds this element.