The Hound of the Wolf

For the strength of Pack is in the Wolf, and the strength of Wolf is in the Pack -Rudyard Kipling

Wednesday, September 03, 2008

Cell wrapping in FPDF

what a life saver!

From http://www.roxxor.co.uk/blog/2007/10/05/wrapping-text-in-fpdf-table-cells/


$x=16;
$y=26;

$width=100;
$height=35;
$leftmargin=16;
for ($r=0;$r<10;$r++){
for ($c=0;$c<6;$c++){
$pdf->SetY($y); //set pointer back to previous values
$pdf->SetX($x);
$x=$pdf->GetX()+$width;
$y=$pdf->GetY();
$pdf->MultiCell($width,$height,$r."-".$c." ".$x.",".$y,1,'L');
}
$y+=$height;
$x=$leftmargin;
$pdf->SetY($y);
}