formats[$formatName]; $pdf = new \App\Libraries\Pdf\MyFPDF('P', 'mm', $f['page']); $pdf->SetAutoPageBreak(false); $i = 0; $total = count($data); while ($i < $total) { $pdf->AddPage(); for ($row = 0; $row < $f['rows']; $row++) { for ($col = 0; $col < $f['cols']; $col++) { $x = $f['marginLeft'] + ($col * ($f['width'] + $f['gapX'])); $y = $f['marginTop'] + ($row * ($f['height'] + $f['gapY'])); if ($pos < $start) { $pos++; continue; } if ($i >= $total) { break 3; } $pdf->SetXY($x, $y); extract(array_merge($data[$i], [ 'pdf' => $pdf, 'x' => $x, 'y' => $y, 'f' => $f, ])); require APPPATH . 'Views/' . $view . '.php'; $i++; $pos++; } } } $pdf->Output('I', 'labels.pdf'); exit; } }