public static void AddUnderlineText()
{
// ExStart:AddUnderlineText
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdf_Text();
// Create documentation object
Document pdfDocument = new Document();
// Add age page to PDF document
pdfDocument.Pages.Add();
// Create TextBuilder for first page
TextBuilder tb = new TextBuilder(pdfDocument.Pages[1]);
// TextFragment with sample text
TextFragment fragment = new TextFragment("Test message");
// Set the font for TextFragment
fragment.TextState.Font = FontRepository.FindFont("Arial");
fragment.TextState.FontSize = 10;
// Set the formatting of text as Underline
fragment.TextState.Underline = true;
// Specify the position where TextFragment needs to be placed
fragment.Position = new Position(10, 800);
// Append TextFragment to PDF file
tb.AppendText(fragment);
dataDir = dataDir + "AddUnderlineText_out.pdf";
// Save resulting PDF document.
pdfDocument.Save(dataDir);
// ExEnd:AddUnderlineText
Console.WriteLine("\nUnderline text added successfully.\nFile saved at " + dataDir);
}
public static void AddingBorderAroundAddedText()