FormattedTextArea
Represents an area of formatted text.
public class FormattedTextArea : RotatingPageElement, IArea, ICoordinate, ISerializable
Public Class FormattedTextArea
Inherits RotatingPageElement
Implements IArea, ICoordinate, ISerializable
Inheritance: ObjectPageElementTaggablePageElementRotatingPageElementFormattedTextArea
Implements: IArea, ICoordinate, ISerializable
Licensing Info
This class is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Examples
The following example shows a paragraph of formatted text being displayed 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 style
Dim style As FormattedTextAreaStyle = New FormattedTextAreaStyle(FontFamily.Helvetica, 12, False)
' Create the text and the formatted text area
Dim formattedText As String = "<p>Formatted text area provide rich formatting support for " + _
"text that appears in the document. You have complete control over 8 paragraph " + _
"properties: spacing before, spacing after, first line indentation, left indentation," + _
" right indentation, alignment, allowing orphan lines, and white space preservation; " + _
"6 font properties: <font face='Times'>font face, </font><font " + _
"pointSize='6'>font size, </font><font color='FF0000'>color, " + _
"</font><b>bold, </b><i<italic and </i><u>" + _
"underline</u>; and 2 line properties: leading, and leading type. Text can " + _
"also be rotated.</p>"
Dim MyFormattedTextArea As FormattedTextArea = New FormattedTextArea(formattedText, 0, 0, 256, 400, style)
' Add the formatted text area to the page
MyPage.Elements.Add(MyFormattedTextArea)
' 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 an formatted style
FormattedTextAreaStyle style = new FormattedTextAreaStyle(FontFamily.Helvetica, 12, false);
// Create the text and the formatted text area
string formattedText = "<p>Formatted text area provide rich formatting support for text that " +
"appears in the document. You have complete control over 8 paragraph properties: " +
"spacing before, spacing after, first line indentation, left indentation, right " +
"indentation, alignment, allowing orphan lines, and white space preservation; 6 " +
"font properties: <font face='Times'>font face, </font><font " +
"pointSize='6'>font size, </font><font color='FF0000'>color, " +
"</font><b>bold, </b><i>italic and </i><u>" +
"underline</u>; and 2 line properties: leading, and leading type. Text can " +
"also be rotated.</p>";
FormattedTextArea formattedTextArea = new FormattedTextArea(formattedText, 0, 0, 256, 400, style);
// Add the formatted text area to the page
page.Elements.Add(formattedTextArea);
// Save the PDF
document.Draw(outputPath);
}
}
Remarks
This class can be used to place formatted text onto an area of the page. For a complete list of supported font tags take a look at the Formatted TextArea Formatting topic. See the Text Continuation topic for more on text continuation.
Constructors
FormattedTextArea(String, Single, Single, Single, Single, FontFamily, Single, Boolean) | Initializes a new instance of the FormattedTextArea class. |
FormattedTextArea(String, Single, Single, Single, Single, FormattedTextAreaStyle) | Initializes a new instance of the FormattedTextArea class. |
Properties
Angle | Gets or sets the heights of the angle element. (Inherited from RotatingPageElement) |
FontFaces | Gets the FontFamilyList used by the formatted text area. |
Height | Gets or sets the height of the formatted text area. |
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 FormattedTextAreaStyle object used to specify the initial style of the formatted text area. |
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 for the formatted text area. |
VAlign | Gets or sets a value indicating the vertical alignment of the formatted text area. |
Width | Gets or sets the width of the formatted text area. |
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) |
GetOverflowFormattedTextArea() | Returns a new FormattedTextArea object containing the overflow text. |
GetOverflowFormattedTextArea(Single, Single) | Returns a new FormattedTextArea object containing the overflow text. |
GetOverflowFormattedTextArea(Single, Single, Single) | Returns a new FormattedTextArea object containing the overflow text. |
GetRequiredHeight() | Returns the required height to fit all of the text of the FormattedTextArea . |
GetType() | Gets the Type of the current instance. (Inherited from Object) |
HasOverflowText() | Returns a value specifying if there is text that did not fit in the FormattedTextArea . |
ToString() | Returns a String that represents the current Object . (Inherited from Object) |