Try something like this:
function textBlock($pdf,$string,$x,$y,$lineSpacing,$maxWidth,$size,$style="Times-Roman",$rendering=0)
{
PDF_set_font($pdf, $style, $size, "winansi");
PDF_set_text_rendering($pdf, $rendering);
PDF_set_leading($pdf ,$lineSpacing);
PDF_set_text_pos($pdf , $x, $y);
$words = split(" ",$string);
$cantWords = count($words);
for($i=0;$i<$cantWords; $i++)
{
$text .= $words[$i];
if(strlen($text)<$maxWidth)
{
$text .= " ";
}else
{
PDF_continue_text($pdf, $text);
$text="";
}
}
PDF_continue_text($pdf,$text);
}