TextParagraph

TextParagraph class

Represents text paragraphs as multiline text object.

public sealed class TextParagraph

Constructors

Name Description
TextParagraph() The default constructor.

Properties

Name Description
FirstLineIndent { get; set; } Gets or sets subsequent lines indent value. If set to a non-zero value, it has an advantage over the FormattingOptions.SubsequentLinesIndent value.
FormattingOptions { get; set; } Gets or sets formatting options.
HorizontalAlignment { get; set; } Gets or sets horizontal alignment for the text inside paragrph’s Rectangle.
Justify { get; set; } Gets or sets value whether text is justified.
Margin { get; set; } Gets or sets the padding.
Position { get; set; } Gets or sets position of the paragraph.
Rectangle { get; set; } Gets or sets rectangle of the paragraph.
Rotation { get; set; } Gets or sets rotation angle in degrees.
SubsequentLinesIndent { get; set; } Gets or sets subsequent lines indent value. If set to a non-zero value, it has an advantage over the FormattingOptions.SubsequentLinesIndent value.
TextRectangle { get; } Gets rectangle of the text placed to the paragraph.
VerticalAlignment { get; set; } Gets or sets vertical alignment for the text inside paragrph’s Rectangle.

Methods

Name Description
AppendLine(string) Appends text line
AppendLine(TextFragment) Appends text line with text state parameters.
AppendLine(string, float) Appends text line.
AppendLine(string, TextState) Appends text line with text state parameters.
AppendLine(TextFragment, TextState) Appends text line with text state parameters.
AppendLine(string, TextState, float) Appends text line with text state parameters
AppendLine(TextFragment, TextState, float) Appends text line with text state parameters
BeginEdit() Begins the editing of the TextParagraph.
EndEdit() Ends the editing of the TextParagraph.

Examples

The example demonstrates how to create text paragraph object and append it to the Pdf page.

Document doc = new Document(inFile);

Page page = (Page)doc.Pages[1];

// create text paragraph
TextParagraph paragraph = new TextParagraph();
           
// set the paragraph rectangle
paragraph.Rectangle = new Rectangle(100, 600, 200, 700);

// set word wrapping options
paragraph.FormattingOptions.WrapMode = TextFormattingOptions.WordWrapMode.ByWords;

// append string lines
paragraph.AppendLine("the quick brown fox jumps over the lazy dog");
paragraph.AppendLine("line2");
paragraph.AppendLine("line3");

// append the paragraph to the Pdf page with the TextBuilder
TextBuilder textBuilder = new TextBuilder(page);
textBuilder.AppendParagraph(paragraph);

// save Pdf document
doc.Save(outFile);

See Also