Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I underline text using FDPF in PHP?

I'm trying to make my text underlined in FPDF but it seems to be impossible... I'm not using HTML. I'm using an DejaVu unicode font, which supports UTF-8, and also its my first time working with the FPDF.

Is that even possible? Please give me some solutions.

like image 703
Scott Avatar asked Nov 28 '12 05:11

Scott


People also ask

How do you underline text in PHP?

The setUnderline() function is an inbuilt function in PHP | Spreadsheet_Excel_Writer which is used to set the underline of the text. Parameters: This function accepts single parameter $underline.

How do you wrap text in Fpdf?

php'); class PDF extends FPDF { function WordWrap(&$text, $maxwidth) { $text = trim($text); if ($text==='') return 0; $space = $this->GetStringWidth(' '); $lines = explode("\n", $text); $text = ''; $count = 0; foreach ($lines as $line) { $words = preg_split('/ +/', $line); $width = 0; foreach ($words as $word) { $ ...


1 Answers

Try this :

$fpdf->SetFont('Dejavu','U'); //Where "U" means underline.

See also (in german) http://www.fpdf.de/funktionsreferenz/?funktion=SetFont

See also (in english) http://www.fpdf.org/en/doc/setfont.htm

like image 50
Thomas Lauria Avatar answered Oct 12 '22 00:10

Thomas Lauria