Word wrap in a cell in FPDF using PHP?-ThrowExceptions

Exception or error:

I am trying to print some words in a cell but wordwrap in not working in a cell, what should i do?

  $pdf->setXY(124, 36 + ($i * 5.1));
            $pdf->SetFillColor(238, 236, 225);
            $pdf->SetFont('Arial', '', 8); 
            $pdf->Cell(40, 6, $resultArrayIndex['pubtitle'], 0, 0, 'L', True); 

Here is my output – words are flowing outside cell

and here what i am trying to achieve – enter image description here trying to wrap word within a cell. (Any help or hint is appreciated)

Edited after comments and sugggestions

After all u suggesting me use Multicell, I used it but it’s still not helpful
not equal gap with each multicell and even sometimes it’s uneven size text and gap

enter image description here

My code after your suggestion and i am using it in for-loop

    $pdf->setXY(17, 36+($i * 6.9));
            $pdf->SetFillColor(255,255,255);
            $pdf->SetFont('Arial', '', 8);
            $pdf->MultiCell(19, 4.6, formatPubDate($resultArrayIndex['pubdate']), 1);

            $pdf->setXY(42, 36 + ($i * 6.9)); 
            $pdf->SetFont('Arial', '', 8);
            $pdf->MultiCell(50.5, 4.6, ($resultArrayIndex['title']), 1);

            $pdf->setXY(124, 33.7 + ($i * 9.0)); 
            $pdf->SetFont('Arial', '', 8); 
            $pdf-> MultiCell(27, 2.9 , $resultArrayIndex['pubtitle'],1); 
How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *