Hi Florian,
Try this:
using var document = new PdfDocument();
var page = document.Pages.Add();
using var formattedText = new PdfFormattedText();
formattedText.Underline = new PdfTextDecoration(
style: PdfTextDecorationStyle.Single,
wordsOnly: false,
thickness: 4,
color: PdfColors.Red,
opacity: 1,
dashPattern: PdfLineDashPatterns.Solid);
formattedText.Append("Hello World!");
page.Content.DrawText(formattedText, new PdfPoint(100, 700));
document.Save("output.pdf");
I hope this helps, let me know if you need anything else.
Regards,
Mario