Table of Contents

Class Text

Namespace
iText.Layout.Element
Assembly
itext.layout.dll

A Text is a piece of text of any length.

public class Text : AbstractElement<Text>, IAbstractElement, ILeafElement, IElement, IPropertyContainer, IAccessibleElement
Inheritance
Text
Implements
Derived
Inherited Members

Remarks

A Text is a piece of text of any length. As a leaf element , it is the smallest piece of content that may bear specific layout attributes.

Constructors

Text(string)

Constructs a Text with its role initialized.

public Text(string text)

Parameters

text string

the contents, as a string

Fields

tagProperties

protected DefaultAccessibilityProperties tagProperties

Field Value

DefaultAccessibilityProperties

text

protected string text

Field Value

string

Methods

GetAccessibilityProperties()

public virtual AccessibilityProperties GetAccessibilityProperties()

Returns

AccessibilityProperties

GetHorizontalScaling()

Gets the horizontal scaling property, which determines how wide the text should be stretched.

public virtual float? GetHorizontalScaling()

Returns

float?

the horizontal spacing, as a float

GetText()

Gets the contents of the Text object that will be rendered.

public virtual string GetText()

Returns

string

the string with the contents

GetTextRise()

Gets the text rise.

public virtual float GetTextRise()

Returns

float

the vertical distance from the text's default base line, as a float.

MakeNewRenderer()

protected override IRenderer MakeNewRenderer()

Returns

IRenderer

SetHorizontalScaling(float)

The horizontal scaling parameter adjusts the width of glyphs by stretching or compressing them in the horizontal direction.

public virtual Text SetHorizontalScaling(float horizontalScaling)

Parameters

horizontalScaling float

the scaling parameter. 1 means no scaling will be applied, 0.5 means the text will be scaled by half. 2 means the text will be twice as wide as normal one.

Returns

Text

this Text

SetNeutralRole()

Give this element a neutral role.

public virtual Text SetNeutralRole()

Returns

Text

this Element

Remarks

Give this element a neutral role. See also SetRole(string).

SetSkew(float, float)

Skews the text to simulate italic and other effects.

public virtual Text SetSkew(float alpha, float beta)

Parameters

alpha float

the first angle in degrees

beta float

the second angle in degrees

Returns

Text

this Text

Remarks

Skews the text to simulate italic and other effects. Try alpha=0 and beta=12.

SetText(string)

Sets the contents of the Text object.

public virtual void SetText(string text)

Parameters

text string

the new contents

SetTextRise(float)

Sets the text rise.

public virtual Text SetTextRise(float textRise)

Parameters

textRise float

a vertical distance from the text's default base line.

Returns

Text

this Text