I was looking for wordwrap function with TextState property and I found this is most suitable example for me.
Document doc = new Document(inFile);Page page = (Page)doc.Pages[1]; <span class="code-comment" style="color: rgb(128, 128, 128); background-color: inherit;">// create text paragraph
TextParagraph paragraph = new TextParagraph();
<span class="code-comment" style="color: rgb(128, 128, 128); background-color: inherit;">// set the paragraph rectangle
paragraph.Rectangle = new Rectangle(100, 600, 200, 700);
<span class="code-comment" style="color: rgb(128, 128, 128); background-color: inherit;">// set word wrapping options
paragraph.FormattingOptions.WrapMode = TextFormattingOptions.WordWrapMode.ByWords;
<span class="code-comment" style="color: rgb(128, 128, 128); background-color: inherit;">// append string lines
paragraph.AppendLine(“the quick brown fox jumps over the lazy dog”);
paragraph.AppendLine(“line2”);
paragraph.AppendLine(“line3”);<span class="code-comment" style="color: rgb(128, 128, 128); background-color: inherit;">// append the paragraph to the Pdf page with the TextBuilder
TextBuilder textBuilder = new TextBuilder(page);
textBuilder.AppendParagraph(paragraph);<span class="code-comment" style="color: rgb(128, 128, 128); background-color: inherit;">// save Pdf document
doc.Save(outFile);
Above code works fine, but when I add ‘TextState’ to paragraph variable as second parameter it gives me an error.