public static void UsingTextBuilderAndFragment()
{
// ExStart:UsingTextBuilderAndFragment
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdf_Text();
// Create Document instance
Document pdfDocument = new Document();
// Add page to pages collection of Document
Page page = pdfDocument.Pages.Add();
// Create TextBuilder instance
TextBuilder builder = new TextBuilder(pdfDocument.Pages[1]);
// Create text fragment instance with sample contents
TextFragment wideFragment = new TextFragment("Text with increased character spacing");
wideFragment.TextState.ApplyChangesFrom(new TextState("Arial", 12));
// Specify character spacing for TextFragment
wideFragment.TextState.CharacterSpacing = 2.0f;
// Specify the position of TextFragment
wideFragment.Position = new Position(100, 650);
// Append TextFragment to TextBuilder instance
builder.AppendText(wideFragment);
dataDir = dataDir + "CharacterSpacingUsingTextBuilderAndFragment_out.pdf";
// Save resulting PDF document.
pdfDocument.Save(dataDir);
// ExEnd:UsingTextBuilderAndFragment
Console.WriteLine("\nCharacter spacing specified successfully using Text builder and fragment.\nFile saved at " + dataDir);
}
public static void UsingTextBuilderAndParagraph()