TextBuilder.AppendText
Contents
[
Hide
]AppendText(TextFragment)
Appends text fragment to Pdf page
public void AppendText(TextFragment textFragment)
Parameter | Type | Description |
---|---|---|
textFragment | TextFragment | Text fragment object. |
Examples
The example demonstrates how to create text fragment object, customize it’s text segments and append it to the Pdf page.
Document doc = new Document(inFile);
Page page = (Page)doc.Pages[1];
// create text fragment
TextFragment tf = new TextFragment("main text");
tf.Position = new Position(100, 600);
// set it's text properties
tf.TextState.FontSize = 5;
tf.TextState.Font = FontRepository.FindFont("TimesNewRoman");
tf.TextState.BackgroundColor = Color.LightGray;
tf.TextState.ForegroundColor = Color.Red;
// add one more segment to text fragment's Segments collection
TextSegment segment2 = new TextSegment();
segment2.Text = "another segment";
tf.Segments.Add(segment2);
// create TextBuilder object
TextBuilder builder = new TextBuilder(page);
// append the text fragment to the Pdf page
builder.AppendText(tf);
//save document
doc.Save(outFile);
See Also
- class TextFragment
- class TextBuilder
- namespace Aspose.Pdf.Text
- assembly Aspose.PDF
AppendText(List<TextFragment>)
Appends list of text fragments to Pdf page.
public void AppendText(List<TextFragment> textFragments)
Parameter | Type | Description |
---|---|---|
textFragments | List`1 | Collection of text fragments |
See Also
- class TextFragment
- class TextBuilder
- namespace Aspose.Pdf.Text
- assembly Aspose.PDF