For wrapping text in pdf this is the method that I have been using .
It handles variable font and sizes and also variable widths on the paragraph.
<?php
$c = $db->row['content'];
$color = convert_hexcolor_rgbdec($color_hex);
pdf_setcolor($pdf, 'both', 'rgb', $color['r'], $color['g'], $color['b']);
$font = pdf_findfont($pdf, "$fontStyle", "host", 1);
pdf_setfont($pdf, $font, $s);
$par1 = stripslashes($c);
$j = 0;
$n = 0;
while($j < $pw && $c != "") {
$f = substr($par1, $n, 1);
$fWidth = pdf_stringwidth($pdf, "$f", 1, $s);
$j = $j + $fWidth;
$fWidth = 0;
$n++;
}
$wrap = $n;
$lead = $s + 2;
$paragraph = wordwrap($paragraph, $wrap, "***");
$parArr = explode("***", $paragraph);
pdf_show_xy($pdf, "$parArr[0]", $x, $y);
pdf_set_leading($pdf, $lead);
$i = 1;
while($parArr[$i]) {
pdf_continue_text($pdf, "$parArr[$i]");
$i++;
}
}