Search code examples
phpfpdf

FPDF - combined font styles


By using FPDF (multiCell) I'm not able to apply different tags for a simple word.

As an example:

<em><strong><u>Sample</u></strong></em>  

At the end it's shown in PDF only with underscore style (latest one). Is there any possibilities to combine them?


Solution

  • Not sure if you're using FPDF or TCPDF since FPDF'Multicell function doesn't seem to accept HTML, but with TCPDF an HTML string with multiples tags works:

    $ishtml = true;
    $test = '<em><strong><u>Sample</u></strong></em>';
    $pdf->MultiCell($width, $height, $test, $border, '$align, $fill, $ln, $x, $y, $reseth, $stretch, $ishtml);