Line
Represents a line page element.
public class Line : TaggablePageElement, ISerializable
Public Class Line
Inherits TaggablePageElement
Implements ISerializable
Inheritance: ObjectPageElementTaggablePageElementLine
Implements: ISerializable
Licensing Info
This class is a DynamicPDF Core Suite Essentials feature. One of the following is required for non-evaluation usage:
- Any active DynamicPDF Subscription (Essentials, Professional, Professional Plus or Ultimate).
- A DynamicPDF Core Suite for .NET v12.X Essentials license.
- It can also be used for free with a public link back to www.dynamicpdf.com and with the DynamicPDF Essentials message displaying on the bottom of each page.
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;
public class Example
{
public static void CreatePDF(string outputPath)
{
// 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(outputPath);
}
}
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. |
Line(Single, Single, Single, Single, Color) | Initializes a new instance of the Line class. |
Line(Single, Single, Single, Single, Single) | Initializes a new instance of the Line class. |
Line(Single, Single, Single, Single, Single, Color) | Initializes a new instance of the Line class. |
Line(Single, Single, Single, Single, Single, Color, LineStyle) | Initializes a new instance of the Line class. |
Properties
Cap | Gets or sets the LineCap enumeration used to specify the line cap style of the line. |
Color | Gets or sets the Color object to use for the line. |
ID | Gets or sets the ID of the page element. (Inherited from PageElement) |
IgnoreMargins | Gets or sets ignore margin property. Setting false will consider the margin while placing the page element based on the RelativeTo property. (Inherited from PageElement) |
RelativeTo | Gets and sets placement of the page element on the page. (Inherited from PageElement) |
Style | Gets or sets the LineStyle object to use for the style of the line. |
Tag | Gets or sets the tag of the taggable element. (Inherited from TaggablePageElement) |
TagOrder | Gets or sets the tag order of the taggable element. (Inherited from TaggablePageElement) |
Width | Gets or sets the width of the line. |
X1 | Gets or sets the X1 coordinate of the line. |
X2 | Gets or sets the X2 coordinate of the line. |
Y1 | Gets or sets the Y1 coordinate of the line. |
Y2 | Gets or sets the Y2 coordinate of the line. |
Methods
Draw(PageWriter) | Draws the line to the given PageWriter object. |
Equals(Object) | Determines whether the specified Object is equal to the current Object . (Inherited from Object) |
GetHashCode() | Serves as a hash function for a particular type. (Inherited from Object) |
GetType() | Gets the Type of the current instance. (Inherited from Object) |
ToString() | Returns a String that represents the current Object . (Inherited from Object) |