Adding Underlined Text in PDF with Aspose.PDF for .NET

Aspose.PDF for .NET is a powerful PDF processing library that allows developers to create, modify, and manipulate PDF documents without requiring Adobe Acrobat. This example demonstrates how to create a new PDF document and add text with underline formatting using the TextBuilder and TextFragment classes. The code creates a simple PDF with a test message formatted in Arial font with underline styling, positioning it at specific coordinates within the page.


Copy
// Code example
Step/Step

Installation Instructions

1: Install Aspose.PDF for .NET

You can install Aspose.PDF for .NET using one of the following methods:

Using NuGet Package Manager:

Install-Package Aspose.PDF

Using .NET CLI:

dotnet add package Aspose.PDF

Using PackageReference in your project file:

<PackageReference Include="Aspose.PDF" Version="23.1.0" />

2: Add Required Using Statements

using Aspose.Pdf;
using Aspose.Pdf.Text;

Additional Resources