* 4 columns, 12 raws, 5 mm margin so lable width=50 * 12 raws, 10 mm margin, so 23 mm height * */ $um = 5; //upper margin $lm = 5; //left margin $cs = 3; //space between columns $lw = 48; //width $lh = 24; //height $text1 = $_POST['line1']; $text2 = $_POST['line2']; $text3 = $_POST['line3']; //////////////////with text printed twice to take care of lable misalignment for ($i = 0; $i < 4; $i++) { for ($j = 0; $j < 12; $j++) { $pdf->SetFont('times', '', 8); $pdf->SetXY($i * 48 + $i * 3 + 5 + 2, $j * 24 + 5); $pdf->Cell($w = 48 - 4, $h = 4, $text1, $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M'); $pdf->SetXY($i * 48 + $i * 3 + 5 + 2, $j * 24 + 10); $pdf->Cell($w = 48 - 4, $h = 4, $text2, $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M'); $pdf->SetXY($i * 48 + $i * 3 + 5 + 2, $j * 24 + 15); $pdf->Cell($w = 48 - 4, $h = 4, $text3, $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 1, $ignore_min_height = false, $calign = 'T', $valign = 'M'); } } $filename = 'lable.pdf'; $pdf->Output($filename, 'I'); }