cete.dynamicpdf.pageelements.line
Line
- Namespace: ceTe.DynamicPDF.PageElements
- Assemblies: ceTe.DynamicPDF.40.dll
Represents a line page element.
public class Line : TaggablePageElement, ISerializable
Public Class Line
Inherits TaggablePageElement
Implements ISerializable
Inheritance: Object → PageElement → TaggablePageElement → Line
Implements: ISerializable
Licensing
This class is a DynamicPDF Generator Community Edition feature.
Examples
The following example will display two different lines on the page.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
' Create a Page and add it to the document
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
' Create a line
Dim MyLine As Line = New Line(50, 50, 50, 400, 5, _ Grayscale.Black, LineStyle.Solid)
' Change the line cap property
MyLine.Cap = LineCap.Round
' Add two lines to the page
MyPage.Elements.Add(MyLine)
MyPage.Elements.Add(New Line(60, 50, 150, 400, 2, _
RgbColor.Blue, LineStyle.DashLarge))
' Save the PDF
MyDocument.Draw("C:\MyDocument.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
class MyClass
{
static void Main()
{
// Create a PDF Document
Document document = new Document();
// Create a Page and add it to the document
Page page = new Page();
document.Pages.Add( page );
// Create a line
Line line = new Line( 50, 50, 50, 400, 5, Grayscale.Black, LineStyle.Solid );
// Change the line cap property
line.Cap = LineCap.Round;
// Add two lines to the page
page.Elements.Add( line );
page.Elements.Add( new Line( 60, 50, 150, 400, 2, RgbColor.Blue, LineStyle.DashLarge ) );
// Save the PDF
document.Draw( @"C:\MyDocument.pdf" );
}
}
Remarks
This class can be used to place lines of different length, width, color and patterns on a page.
Constructors
Line(Single, Single, Single, Single)
Initializes a new instance of the Line class.
public Line(float x1, float y1, float x2, float y2)
Public Sub New (x1 As Single, y1 As Single, x2 As Single, y2 As Single)
Parameters
- x1: Single
X1 coordinate of the line.
- y1: Single
Y1 coordinate of the line.
- x2: Single
X2 coordinate of the line.
- y2: Single
Y2 coordinate of the line.
Line(Single, Single, Single, Single, Color)
Initializes a new instance of the Line class.
public Line(float x1, float y1, float x2, float y2, Color color)
Public Sub New (x1 As Single, y1 As Single, x2 As Single, y2 As Single, color As Color)
Parameters
- x1: Single
X1 coordinate of the line.
- y1: Single
Y1 coordinate of the line.
- x2: Single
X2 coordinate of the line.
- y2: Single
Y2 coordinate of the line.
- color: Color
Color of the line.
Line(Single, Single, Single, Single, Single)
Initializes a new instance of the Line class.
public Line(float x1, float y1, float x2, float y2, float width)
Public Sub New (x1 As Single, y1 As Single, x2 As Single, y2 As Single, width As Single)
Parameters
- x1: Single
X1 coordinate of the line.
- y1: Single
Y1 coordinate of the line.
- x2: Single
X2 coordinate of the line.
- y2: Single
Y2 coordinate of the line.
- width: Single
Width of the line.
Line(Single, Single, Single, Single, Single, Color)
Initializes a new instance of the Line class.
public Line(float x1, float y1, float x2, float y2, float width, Color color)
Public Sub New (x1 As Single, y1 As Single, x2 As Single, y2 As Single, width As Single, color As Color)
Parameters
- x1: Single
X1 coordinate of the line.
- y1: Single
Y1 coordinate of the line.
- x2: Single
X2 coordinate of the line.
- y2: Single
Y2 coordinate of the line.
- width: Single
Width of the line.
- color: Color
Color of the line.
Line(Single, Single, Single, Single, Single, Color, LineStyle)
Initializes a new instance of the Line class.
public Line(float x1, float y1, float x2, float y2, float width, Color color, LineStyle style)
Public Sub New (x1 As Single, y1 As Single, x2 As Single, y2 As Single, width As Single, color As Color, style As LineStyle)
Parameters
- x1: Single
X1 coordinate of the line.
- y1: Single
Y1 coordinate of the line.
- x2: Single
X2 coordinate of the line.
- y2: Single
Y2 coordinate of the line.
- width: Single
Width of the line.
- color: Color
Color of the line.
- style: LineStyle
Style of the line.
Properties
Cap
Gets or sets the LineCap enumeration used to specify the line cap style of the line.
public LineCap Cap { get; set; }
Public Property Cap As LineCap
Property Value
Color
Gets or sets the Color object to use for the line.
public Color Color { get; set; }
Public Property Color As Color
Property Value
ID
Gets or sets the ID of the page element. (Inherited from PageElement)
public string ID { get; set; }
Public Property ID As String
Property Value
Style
Gets or sets the LineStyle object to use for the style of the line.
public LineStyle Style { get; set; }
Public Property Style As LineStyle
Property Value
Tag
Gets or sets the tag of the taggable element. (Inherited from TaggablePageElement)
public Tag Tag { get; set; }
Public Property Tag As Tag
Property Value
Licensing
This property is a DynamicPDF Generator Enterprise Edition feature. One of the following licenses is required for non-evaluation usage:
- DynamicPDF Generator for .NET Enterprise Edition
- DynamicPDF Merger for .NET Enterprise Edition
- DynamicPDF ReportWriter for .NET Enterprise Edition
- DynamicPDF Core Suite for .NET Enterprise Edition
TagOrder
Gets or sets the tag order of the taggable element. (Inherited from TaggablePageElement)
public int TagOrder { get; set; }
Public Property TagOrder As Int32
Property Value
Width
Gets or sets the width of the line.
public float Width { get; set; }
Public Property Width As Single
Property Value
X1
Gets or sets the X1 coordinate of the line.
public float X1 { get; set; }
Public Property X1 As Single
Property Value
X2
Gets or sets the X2 coordinate of the line.
public float X2 { get; set; }
Public Property X2 As Single
Property Value
Y1
Gets or sets the Y1 coordinate of the line.
public float Y1 { get; set; }
Public Property Y1 As Single
Property Value
Y2
Gets or sets the Y2 coordinate of the line.
public float Y2 { get; set; }
Public Property Y2 As Single
Property Value
Methods
Draw(PageWriter)
Draws the line to the given PageWriter object.
public void Draw(PageWriter writer)
Sub Draw(writer As PageWriter)
Parameters
- writer: PageWriter
PageWriter object to receive the line's output.
Equals(Object)
Determines whether the specified Object is equal to the current Object . (Inherited from Object)
public bool Equals(Object obj)
Function Equals(obj As Object) As Boolean
Parameters
- obj: Object
The Object to compare with the current Object .
Returns
true if the specified Object is equal to the current Object ; otherwise, false.
GetHashCode()
Serves as a hash function for a particular type. (Inherited from Object)
public int GetHashCode()
Function GetHashCode() As Integer
Returns
A hash code for the current Object .
GetType()
Gets the Type of the current instance. (Inherited from Object)
public Type GetType()
Function GetType() As Type
Returns
The Type instance that represents the exact runtime type of the current instance.
ToString()
Returns a String that represents the current Object . (Inherited from Object)
public string ToString()
Function ToString() As String
Returns
A String that represents the current Object .