$max_y = 0; while ($row = gaz_dbi_fetch_array($result)) { $mas=intval(substr($row['codice'],0,3)); $y=$pdf->GetY(); if ($y<250){ $max_str=intval(13*(254-$y)); if ($ctrl_mas<$mas ){ // mastri if (intval(substr($row['codice'],3,6))==0) { $cm_d=trim($row['ceedar']); $cm_a=trim($row['ceeave']); } if (isset($note[1])){ // ma se ho una nota del mastro precedente la devo stampare $pdf->AddPage('P',$config->getValue('page_format')); $pdf->Cell(135); $pdf->SetFont('helvetica','',7); $pdf->MultiCell(51,4,$note[1],1,'L',true); $y=$pdf->GetY(); $max_str=intval(13*(254-$y)); } $start_y=$y; if ($max_y>$y) { //se con i conti son andato oltre... $pdf->Cell(135,1,'','T'); $pdf->SetY($max_y); // inizio dalla loro fine $start_y=$max_y; } $note = str_split($row['annota'],$max_str); $pdf->SetFont('helvetica','B',7); $pdf->Cell(15,4,$mas,1,0,'C',1); $pdf->Cell(120,4,$row['descri'],'LTB',0,'L',1); $pdf->SetFont('helvetica','',7); $pdf->MultiCell(51,4,$note[0],1,'L',true);