$pdf->ToPaths['ToBottom'] = $file; $ImgLowSize = getimagesize($pdf->ToPaths['ToBottom']); } $AccH = $pdf->getPageHeight() / 3 - 10; $AccW = $pdf->getPageWidth() / 2 - 10; while ($MyRow = safe_fetch($Rs)) { $pdf->SetDefaultColor(); $PosX = $cntPass % 2 == 0 ? 5 : $pdf->getPageWidth() / 2 + 5; $PosY = $cntPass % 6 < 2 ? 5 : ($cntPass % 6 < 4 ? $pdf->getPageHeight() / 3 + 5 : $pdf->getPageHeight() * 2 / 3 + 5); $AccColor = array(255, 255, 255); if (!is_null($MyRow->AcColor)) { $AccColor = array(base_convert(substr($MyRow->AcColor, 0, 2), 16, 10), base_convert(substr($MyRow->AcColor, 2, 2), 16, 10), base_convert(substr($MyRow->AcColor, 4, 2), 16, 10)); } //Every 4 Accreditation I change page if ($cntPass % 6 == 0) { $pdf->AddPage(); } //PRIMA Area dell'accredito: Logo SX e Nome/Country + sfondo colore - Altezza 6/20 (ne restano 14/20)) $pdf->SetXY($PosX, $PosY); $pdf->SetFont('', 'B', 12); $pdf->Cell($AccW, $AccH * 0.05, $pdf->Name, 0, 0, 'C', 0); $pdf->Rect($PosX, $PosY + $AccH * 0.05, $AccW, $AccH * 0.2, 'F', array(), $AccColor); $tmpX = $PosX + 2; if (!is_null($ImgSxSize)) { //Immagine Sinistra if ($ImgSxSize[0] / $ImgSxSize[1] <= ($AccW * 0.4 - 4) / ($AccH * 0.2 - 4)) { //Immagine troppo larga $pdf->Image($pdf->ToPaths['ToLeft'], $tmpX, $PosY + $AccH * 0.05 + 2, 0, $AccH * 0.2 - 4); } else { $pdf->Image($pdf->ToPaths['ToLeft'], $tmpX, $PosY + $AccH * 0.05 + ($AccW * 0.4 - 4) / $ImgSxSize[0] * $ImgSxSize[1] / 2 / $pdf->getScaleFactor(), $AccW * 0.4 - 4, 0); }