Skip to main content

TextArea

Version: 12.0

cete.dynamicpdf.pageelements.textarea

TextArea​

Represents an area of text.

public class TextArea : RotatingPageElement, IArea, ICoordinate, ISerializable
Public Class TextArea
Inherits RotatingPageElement
Implements IArea, ICoordinate, ISerializable

Inheritance: Object → PageElement → TaggablePageElement → RotatingPageElement → TextArea

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:

Examples​

The following example will display text 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 text area
Dim MyTextArea As TextArea = New TextArea("This is the " + "underlined text of a TextArea", 100, 100, 400, 30, _
ceTe.DynamicPDF.Font.HelveticaBoldOblique, 18)

' Change the underline property to true
MyTextArea.Underline = True

' Add the text to the page
MyPage.Elements.Add(MyTextArea)

' 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 text area
TextArea textArea = new TextArea("This is the underlined " + "text of a TextArea", 100, 100, 400, 30,
ceTe.DynamicPDF.Font.HelveticaBoldOblique, 18);

// Change the underline property to true
textArea.Underline = true;

// Add the text area to the page
page.Elements.Add(textArea);

// Save the PDF
document.Draw(outputPath);
}
}

Remarks​

This class can be used to place text on a page. Using the methods GetOverflowText or GetOverflowTextArea and HasOverflowText, users can control the pagination of TextAreas that come from a source of unknown length. See the Text Continuation topic for more on text continuation.

Constructors​

TextArea(String, Single, Single, Single, Single)​

Initializes a new instance of the TextArea class.

public TextArea(string text, float x, float y, float width, float height)
Public Sub New (text As String, x As Single, y As Single, width As Single, height As Single)

Parameters​

Text to display in the text area.

X coordinate of the text area.

Y coordinate of the text area.

Width of the text area.

Height of the text area.

Licensing Info​

This constructor is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

TextArea(String, Single, Single, Single, Single, Font)​

Initializes a new instance of the TextArea class.

public TextArea(string text, float x, float y, float width, float height, Font font)
Public Sub New (text As String, x As Single, y As Single, width As Single, height As Single, font As Font)

Parameters​

Text to display in the text area.

X coordinate of the text area.

Y coordinate of the text area.

Width of the text area.

Height of the text area.

Font for the text of the text area.

Licensing Info​

This constructor is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

TextArea(String, Single, Single, Single, Single, Font, Single)​

Initializes a new instance of the TextArea class.

public TextArea(string text, float x, float y, float width, float height, Font font, float fontSize)
Public Sub New (text As String, x As Single, y As Single, width As Single, height As Single, font As Font, fontSize As Single)

Parameters​

Text to display in the text area.

X coordinate of the text area.

Y coordinate of the text area.

Width of the text area.

Height of the text area.

Font for the text of the text area.

Font size of the text of the text area.

Licensing Info​

This constructor is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

TextArea(String, Single, Single, Single, Single, Font, Single, Color)​

Initializes a new instance of the TextArea class.

public TextArea(string text, float x, float y, float width, float height, Font font, float fontSize, Color textColor)
Public Sub New (text As String, x As Single, y As Single, width As Single, height As Single, font As Font, fontSize As Single, textColor As Color)

Parameters​

Text to display in the text area.

X coordinate of the text area.

Y coordinate of the text area.

Width of the text area.

Height of the text area.

Font for the text of the text area.

Font size of the text of the text area.

Color of the text of the text area.

Licensing Info​

This constructor is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

TextArea(String, Single, Single, Single, Single, Font, Single, TextAlign)​

Initializes a new instance of the TextArea class.

public TextArea(string text, float x, float y, float width, float height, Font font, float fontSize, TextAlign align)
Public Sub New (text As String, x As Single, y As Single, width As Single, height As Single, font As Font, fontSize As Single, align As TextAlign)

Parameters​

Text to display in the text area.

X coordinate of the text area.

Y coordinate of the text area.

Width of the text area.

Height of the text area.

Font for the text of the text area.

Font size of the text of the text area.

Alignment of the text of the text area.

Licensing Info​

This constructor is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

TextArea(String, Single, Single, Single, Single, Font, Single, TextAlign, Color)​

Initializes a new instance of the TextArea class.

public TextArea(string text, float x, float y, float width, float height, Font font, float fontSize, TextAlign align, Color textColor)
Public Sub New (text As String, x As Single, y As Single, width As Single, height As Single, font As Font, fontSize As Single, align As TextAlign, textColor As Color)

Parameters​

Text to display in the text area.

X coordinate of the text area.

Y coordinate of the text area.

Width of the text area.

Height of the text area.

Font for the text of the text area.

Font size of the text of the text area.

Alignment of the text of the text area.

Color of the text of the text area.

Licensing Info​

This constructor is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Properties​

Align​

Gets or sets the TextAlign enumeration that specifies the text alignment of the text area.

public TextAlign Align { get; set; }
Public Property Align As TextAlign

Property Value​

TextAlign

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Angle​

Gets or sets the heights of the angle element. (Inherited from RotatingPageElement)

public float Angle { get; set; }
Public Property Angle As Single

Property Value​

Single

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

AutoLeading​

Gets or sets a value indicating whether the leading of the text area should be calculated automatically.

public bool AutoLeading { get; set; }
Public Property AutoLeading As Boolean

Property Value​

Boolean

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Remarks​

This property is automatically set to false any time the Leading property is set.

CleanParagraphBreaks​

Gets or sets the clean paragraph breaks for the paragraphs of the text area.

public bool CleanParagraphBreaks { get; set; }
Public Property CleanParagraphBreaks As Boolean

Property Value​

Boolean

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Font​

Gets or sets the Font object used to specify the font of the text for the text area.

public Font Font { get; set; }
Public Property Font As Font

Property Value​

Font

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

FontSize​

Gets or sets the font size for the text of the text area.

public float FontSize { get; set; }
Public Property FontSize As Single

Property Value​

Single

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Height​

Gets or sets the height of the text area.

public float Height { get; set; }
Public Property Height As Single

Property Value​

Single

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

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​

String

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

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)

public bool IgnoreMargins { get; set; }
Public Property IgnoreMargins As Boolean

Property Value​

Boolean

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Examples​

The following example will place the Label in the top-left of the page with IgnoreMargin

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 Label and place it in page top left with margin ignored
Label label = new Label("I am placed in Page top left with margin ignored", 0, 0, 160, 30);
label.RelativeTo = RelativeTo.TopLeft;
label.IgnoreMargin=true; page.Elements.Add(label);

// Save the PDF
document.Draw(outputPath);
}
}

KerningEnabled​

Enable or disable the kerning property of the text.

public bool KerningEnabled { get; set; }
Public Property KerningEnabled As Boolean

Property Value​

Boolean

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Leading​

Gets or sets the leading for the text of the text area.

public float Leading { get; set; }
Public Property Leading As Single

Property Value​

Single

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Remarks​

Setting this property will automatically set the AutoLeading property to false.

ParagraphIndent​

Gets or sets the paragraph indenting for the paragraphs of the text area.

public float ParagraphIndent { get; set; }
Public Property ParagraphIndent As Single

Property Value​

Single

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

ParagraphSpacing​

Gets or sets the paragraph spacing for the paragraphs of the text area.

public float ParagraphSpacing { get; set; }
Public Property ParagraphSpacing As Single

Property Value​

Single

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

RelativeTo​

Gets and sets placement of the page element on the page. (Inherited from PageElement)

public RelativeTo RelativeTo { get; set; }
Public Property RelativeTo As RelativeTo

Property Value​

RelativeTo

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Examples​

The following example will place the Label in the top-left of the page.

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 Label and place it in page top left with margin
Label label = new Label("I am placed in Page top left with margin.", 0, 0, 160, 30);
label.RelativeTo = RelativeTo.TopLeft;
page.Elements.Add(label);

// Save the PDF
document.Draw(outputPath);
}
}

RightToLeft​

Gets or sets a value indicating if text should be displayed right to left.

public bool RightToLeft { get; set; }
Public Property RightToLeft As Boolean

Property Value​

Boolean

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Strikethrough​

Gets or sets the strike through to use for the text of the text area.

public bool Strikethrough { get; set; }
Public Property Strikethrough As Boolean

Property Value​

Boolean

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

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​

Tag

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

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​

Int32

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Text​

Gets or sets the text of the text area.

public string Text { get; set; }
Public Property Text As String

Property Value​

String

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

TextColor​

Gets or sets the Color object to use for the text of the text area.

public Color TextColor { get; set; }
Public Property TextColor As Color

Property Value​

Color

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

TextOutlineColor​

Gets or sets the Color object to use for the text outline of the text area.

public Color TextOutlineColor { get; set; }
Public Property TextOutlineColor As Color

Property Value​

Color

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

TextOutlineWidth​

Gets or sets the line width to use for the text outline of the text area.

public float TextOutlineWidth { get; set; }
Public Property TextOutlineWidth As Single

Property Value​

Single

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Underline​

Gets or sets a value indicating if the text area is underlined.

public bool Underline { get; set; }
Public Property Underline As Boolean

Property Value​

Boolean

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

VAlign​

Gets or sets the VAlign enumeration that specifies the vertical text alignment of the text area.

public VAlign VAlign { get; set; }
Public Property VAlign As VAlign

Property Value​

VAlign

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Width​

Gets or sets the width of the text area.

public float Width { get; set; }
Public Property Width As Single

Property Value​

Single

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

X​

Gets or sets the X coordinate of the page element. (Inherited from RotatingPageElement)

public float X { get; set; }
Public Property X As Single

Property Value​

Single

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Y​

Gets or sets the Y coordinate of the page element. (Inherited from RotatingPageElement)

public float Y { get; set; }
Public Property Y As Single

Property Value​

Single

Licensing Info​

This property is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Methods​

Draw(PageWriter)​

Draws the page element to the given PageWriter object. (Inherited from RotatingPageElement)

public void Draw(PageWriter writer)
Sub Draw(writer As PageWriter)

Parameters​

PageWriter object to receive the page element's output.

Licensing Info​

This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

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​

The Object to compare with the current Object .

Returns​

true if the specified Object is equal to the current Object ; otherwise, false.

Licensing Info​

This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

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 .

Licensing Info​

This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

GetKerningValues()​

Gets the Kerning values.

public KerningValues GetKerningValues()
Function GetKerningValues() As KerningValues

Returns​

KerningValues The kerning values.

Licensing Info​

This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Exceptions​

GeneratorException If KerningEnabled is set to false.

Examples​

The following example demonstrates how to apply custom kerning.

Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.Text
Imports ceTe.DynamicPDF.PageElements

Module Module1

Sub Main()

' Create a PDF Document
Dim MyDocument As Document = New Document

' Create a PDF Page
Dim MyPage As Page = New Page

' Create a Text Area
Dim MyTextArea As TextArea = New TextArea("Text with kerning", 10, 10, 200, 100)

' Enable the kerning for the text area
MyTextArea.KerningEnabled = True

' Get the Kerning Pairs for the text area
Dim MyKerningValues As KerningValues = MyTextArea.GetKerningValues

' Apply a custom kerning value between 'T' & 'e' in 'Text'
' so that chars will be closer than normal
MyKerningValues.Spacing(0) = 200

' Add the text area to the page
MyPage.Elements.Add(MyTextArea)

' Add the page to the document
MyDocument.Pages.Add(MyPage)

' Save the document
MyDocument.Draw("C:\MyDocument.pdf")

End Sub

End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.Text;
using ceTe.DynamicPDF.PageElements;

public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a PDF Document
Document document = new Document();

// Create a PDF Page
Page page = new Page();

// Create a Text Area
TextArea textArea = new TextArea("Text with kerning", 10, 10, 200, 100);

// Enable the kerning for the text area
textArea.KerningEnabled = true;

// Get the Kerning Pairs for the text area
KerningValues kerningValues = textArea.GetKerningValues();

// Apply a custom kerning value between 'T' & 'e' in 'Text'
// so that chars will be closer than normal
kerningValues.Spacing[0] = 200;

// Add the text area to the page
page.Elements.Add(textArea);

// Add the page to the document
document.Pages.Add(page);

// Save the document
document.Draw(outputPath);
}
}

GetLineTextWidth(Int32)​

Returns the width of the given line index with kerning spaces.

public float GetLineTextWidth(int lineIndex)
Function GetLineTextWidth(lineIndex As Integer) As Single

Parameters​

Line number of the text area.

Returns​

Width of the line with kerning spaces.

Licensing Info​

This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

GetOverflowText()​

Returns the text remaining that will be clipped by the text area.

public string GetOverflowText()
Function GetOverflowText() As String

Returns​

The overflow text as a string .

Licensing Info​

This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

GetOverflowTextArea()​

Returns a TextArea object containing the overflow text.

public TextArea GetOverflowTextArea()
Function GetOverflowTextArea() As TextArea

Returns​

Returns a TextArea object.

Licensing Info​

This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Examples​

The following example shows you how to use the GetOverflowTextArea object to allow text of variable length to flow onto new pages as needed.

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 string and assign it to text of variable length
Dim myVariableText As String = ""
Dim i As Integer
For i = 0 To 50
myVariableText &= "This is a sentence that I will use as my variable length text. "
Next
' Create a text area
Dim MyTextArea As TextArea = New TextArea(myVariableText, 0, 0, 250, 200)
Do
' Create a new page
Dim MyPage As Page = New Page

' Add the text area to the page;
MyPage.Elements.Add(MyTextArea)

' Add the page to the document
MyDocument.Pages.Add(MyPage)

' Set the text area object equal to the rest of the text that did not fit
' if all the text fit this will set textArea to null
MyTextArea = MyTextArea.GetOverflowTextArea()
Loop While Not MyTextArea Is Nothing

' 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 string and assign it to text of variable length
string variableText = "";
for( int i = 0; i < 50; i++ )
variableText += "This is a sentence that I will use as my variable length text. ";

// Create a text area
TextArea textArea = new TextArea( variableText, 0, 0, 250, 200 );
do
{
// Create a new page
Page page = new Page();

// Add the text area to the page;
page.Elements.Add( textArea );

// Add the page to the document
document.Pages.Add( page );

// Set the text area object equal to the rest of the text that did not fit
// if all the text did fit, GetOverflowTextArea will return null
textArea = textArea.GetOverflowTextArea();
} while( textArea != null );
// Save the PDF
document.Draw( outputPath );
}
}

Remarks​

This method returns a new TextArea object that contains the remaining text that did not fit.

GetOverflowTextArea(Single, Single)​

Returns a TextArea object containing the overflow text.

public TextArea GetOverflowTextArea(float x, float y)
Function GetOverflowTextArea(x As Single, y As Single) As TextArea

Parameters​

X coordinate of the new text area.

Y coordinate of the new text area.

Returns​

Returns a TextArea object.

Licensing Info​

This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Examples​

The following example shows you how to use the GetOverflowTextArea object to allow text of variable length to flow onto new pages as needed.

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 string and assign it to text of variable length
Dim myVariableText As String = ""
Dim i As Integer
For i = 0 To 50
myVariableText &= "This is a sentence that I will use as my variable length text. "
Next
' Create a text area
Dim MyTextArea As TextArea = New TextArea(myVariableText, 0, 0, 250, 200)
Do
' Create a new page
Dim MyPage As Page = New Page

' Add the text area to the page;
MyPage.Elements.Add(MyTextArea)

' Add the page to the document
MyDocument.Pages.Add(MyPage)

' Set the text area object equal to the rest of the text that did not fit
' if all the text fit this will set textArea to null
MyTextArea = MyTextArea.GetOverflowTextArea(50, 50)
Loop While Not MyTextArea Is Nothing

' 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 string and assign it to text of variable length
string variableText = "";
for( int i = 0; i < 50; i++ )
variableText += "This is a sentence that I will use as my variable length text. ";

// Create a text area
TextArea textArea = new TextArea( variableText, 0, 0, 250, 200 );
do
{
// Create a new page
Page page = new Page();

// Add the text area to the page;
page.Elements.Add( textArea );

// Add the page to the document
document.Pages.Add( page );

// Set the text area object equal to the rest of the text that did not fit
// if all the text did fit, GetOverflowTextArea will return null
textArea = textArea.GetOverflowTextArea( 50, 50 );
} while( textArea != null );
// Save the PDF
document.Draw( outputPath );
}
}

Remarks​

This method returns a new TextArea object that contains the remaining text that did not fit.

GetOverflowTextArea(Single, Single, Single, Single)​

Returns a TextArea object containing the overflow text.

public TextArea GetOverflowTextArea(float x, float y, float width, float height)
Function GetOverflowTextArea(x As Single, y As Single, width As Single, height As Single) As TextArea

Parameters​

X coordinate of the new text area.

Y coordinate of the new text area.

Width of the new text area.

Height of the new text area.

Returns​

Returns a TextArea object.

Licensing Info​

This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Examples​

The following example shows you how to use the GetOverflowTextArea object to allow text of variable length to flow onto new pages as needed.

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 string and assign it to text of variable length
Dim myVariableText As String = ""
Dim i As Integer
For i = 0 To 50
myVariableText &= "This is a sentence that I will use as my variable length text. "
Next
' Create a text area
Dim MyTextArea As TextArea = New TextArea(myVariableText, 0, 0, 250, 200)
Do
' Create a new page
Dim MyPage As Page = New Page

' Add the text area to the page;
MyPage.Elements.Add(MyTextArea)

' Add the page to the document
MyDocument.Pages.Add(MyPage)

' Set the text area object equal to the rest of the text that did not fit
' if all the text fit this will set textArea to null
MyTextArea = MyTextArea.GetOverflowTextArea(50, 50, 100,200)
Loop While Not MyTextArea Is Nothing

' 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 string and assign it to text of variable length
string variableText = "";
for( int i = 0; i < 50; i++ )
variableText += "This is a sentence that I will use as my variable length text. ";

// Create a text area
TextArea textArea = new TextArea( variableText, 0, 0, 250, 200 );
do
{
// Create a new page
Page page = new Page();

// Add the text area to the page;
page.Elements.Add( textArea );

// Add the page to the document
document.Pages.Add( page );

// Set the text area object equal to the rest of the text that did not fit
// if all the text did fit, GetOverflowTextArea will return null
textArea = textArea.GetOverflowTextArea( 50, 50, 100,200);
} while( textArea != null );
// Save the PDF
document.Draw( outputPath );
}
}

Remarks​

This method returns a new TextArea object that contains the remaining text that did not fit.

GetRequiredHeight()​

Returns the height required to fit all of the text supplied.

public float GetRequiredHeight()
Function GetRequiredHeight() As Single

Returns​

The required height to display all text.

Licensing Info​

This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

GetTextHeight()​

Returns the height of the text that will be drawn.

public float GetTextHeight()
Function GetTextHeight() As Single

Returns​

The height of visible text.

Licensing Info​

This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

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.

Licensing Info​

This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

GetVisibleLineCount()​

Returns the number of lines that will be displayed in the current text area.

public int GetVisibleLineCount()
Function GetVisibleLineCount() As Integer

Returns​

The number are lines that will display.

Licensing Info​

This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

HasOverflowText()​

Returns a value indicating if there is text remaining that will not be drawn to the text area.

public bool HasOverflowText()
Function HasOverflowText() As Boolean

Returns​

Value indication whether or not overflow text exists.

Licensing Info​

This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

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 .

Licensing Info​

This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

See Also​

ceTe.DynamicPDF.PageElements