I need to auto adjust the cell size depends upon the text . I have the following code .
$pdf->Cell(50,10,$name,1,0,\'L\',0);
If the $
I refer to: GetStringWidth and SetFont. As pointed out there, to use this method, a font must be selected. So I assume, you already have something like:
.
.
$pdf->AddPage();
$fontFamily = 'Courier'; // 'Courier', 'Helvetica', 'Arial', 'Times', 'Symbol', 'ZapfDingbats'
$fontStyle = 'B'; // 'B', 'I', 'U', 'BI', 'BU', 'IU', 'BIU'
$fontSize = 12.0; // float, in point
$pdf->SetFont($fontFamily, $fontStyle, $fontSize);
To adjust the cell width to the length of the text, let its value take the calculated length of the text:
$width = $pdf->GetStringWidth($name);
$height = 10.0;
$border = 1;
$ln = 0;
$align = 'L';
$fill = FALSE;
$pdf->Cell($width, $height, $name, $border, $ln, $align, $fill);
Havn't tested it, just read the manual. Hope it works.