Are there specific font options or functions in PHP for underlining text in PDF documents?

To underline text in PDF documents using PHP, you can use the SetTextDecoration() function provided by the TCPDF library. This function allows you to set the text decoration style, including underlining. By calling SetTextDecoration('u'), you can underline the text in the PDF document.

require_once('tcpdf/tcpdf.php');

$pdf = new TCPDF();
$pdf->AddPage();

$pdf->SetFont('times', '', 12);
$pdf->Cell(0, 10, 'Underlined Text', 0, 1, 'C');
$pdf->Ln();

$pdf->SetFont('times', '', 12);
$pdf->SetTextColor(0, 0, 255);
$pdf->SetTextDecoration('u');
$pdf->Cell(0, 10, 'Underlined Blue Text', 0, 1, 'C');

$pdf->Output('example.pdf', 'I');