Label
Represents a label page element.
public class Label : RotatingPageElement, IArea, ICoordinate, ISerializable
Public Class Label
Inherits RotatingPageElement
Implements IArea, ICoordinate, ISerializable
Inheritance: ObjectPageElementTaggablePageElementRotatingPageElementLabel
Implements: IArea, ICoordinate, 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 text in a label 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 the string and label
Dim MyText As String = "This is the dark blue, centered text at a 15 degree angle contained in the label."
Dim MyLabel As Label = New Label(MyText, 0, 0, 512, 14, Font.Helvetica, 14, TextAlign.Center, RgbColor.DarkBlue)
' Change the angle property
MyLabel.Angle = 15
' Add the label to the page
MyPage.Elements.Add(MyLabel)
' 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 the string and label
string text = "This is the dark blue, centered text at a 15 degree angle contained in the label.";
Label label = new Label(text, 0, 0, 512, 14, Font.Helvetica, 14, TextAlign.Center, RgbColor.DarkBlue);
// Change the angle property
label.Angle = 15;
// Add the label to the page
page.Elements.Add(label);
// Save the PDF
document.Draw(outputPath);
}
}
Remarks
This class can be used to place labels of text on a page.
Constructors
Label(String, Single, Single, Single, Single) | Initializes a new instance of the Label class. |
Label(String, Single, Single, Single, Single, Font) | Initializes a new instance of the Label class. |
Label(String, Single, Single, Single, Single, Font, Single) | Initializes a new instance of the Label class. |
Label(String, Single, Single, Single, Single, Font, Single, Color) | Initializes a new instance of the Label class. |
Label(String, Single, Single, Single, Single, Font, Single, TextAlign) | Initializes a new instance of the Label class. |
Label(String, Single, Single, Single, Single, Font, Single, TextAlign, Color) | Initializes a new instance of the Label class. |
Properties
Align | Gets or sets the Align enumeration that specifies the text alignment of the label. |
Angle | Gets or sets the heights of the angle element. (Inherited from RotatingPageElement) |
Font | Gets or sets the Font object to use for the text of the label. |
FontSize | Gets or sets the font size for the text of the label. |
Height | Gets or sets the height or the label. |
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) |
RightToLeft | Gets or sets a value indicating if text should be displayed right to left. |
Strikethrough | Gets or sets the strike through to use for the text of the label. |
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) |
Text | Gets or sets the text of the label. |
TextColor | Gets or sets the Color object to use for the text of the label. |
TextOutlineColor | Gets or sets the Color object to use for the text outline of the label. |
TextOutlineWidth | Gets or sets the line width to use for the text outline of the label. |
Underline | Gets or sets a value indicating if the label is underlined. |
VAlign | Gets or sets the VAlign enumeration that specifies the vertical text alignment of the label. |
Width | Gets or sets the width or the label. |
X | Gets or sets the X coordinate of the page element. (Inherited from RotatingPageElement) |
Y | Gets or sets the Y coordinate of the page element. (Inherited from RotatingPageElement) |
Methods
Draw(PageWriter) | Draws the page element to the given PageWriter object. (Inherited from RotatingPageElement) |
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) |