Doc AddLine Function. Adds a line to the current page. ABCpdf .NET PDF Library.

ABCpdf .net

 
   

Adds a line to the current page.

 

   
Syntax  

[C#]
int AddLine(double x1, double y1, double x2, double y2)

[Visual Basic]
Function AddLine(x1 As Double, y1 As Double, x2 As Double, y2 As Double) As Integer

 

   

Params
 
Name Description
x1 The horizontal offset of the start point.
x2 The horizontal offset of the end point.
y1 The vertical offset of the start point.
y2 The vertical offset of the end point.
return The Object ID of the newly added Graphic Object.

 

   

Notes
 

Adds a line to the current page. The line is drawn in the current color at the current width and with the current options.

The AddLine function returns the Object ID of the newly added Graphic Object.

 

   

Example
 

The following code adds two horizontal lines to a document. The first is blue and the second is green.

[C#]
Doc theDoc = new Doc();
theDoc.Width = 24;
theDoc.Color.String = "0 0 255";
theDoc.AddLine(-50, 100, 999, 100);
theDoc.Color.String = "0 255 0";
theDoc.AddLine(-50, 400, 999, 400);
theDoc.Save(Server.MapPath("docaddline.pdf"));
theDoc.Clear();

[Visual Basic]
Dim theDoc As Doc = New Doc()
theDoc.Width = 24
theDoc.Color.String = "0 0 255"
theDoc.AddLine(-50, 100, 999, 100)
theDoc.Color.String = "0 255 0"
theDoc.AddLine(-50, 400, 999, 400)
theDoc.Save(Server.MapPath("docaddline.pdf"))
theDoc.Clear()


docaddline.pdf