php - Managing a new page in tcpdf -
i'm generating pdf reports in php using tcpdf. first page positions textbox correctly down page, textboxes in subsequent pages placed in header(one textbox per page) making document long.
//code require_once('../report/header.php'); // add page $pdf->addpage(); $p=30; ($i = 30; $i < 1000; $i = $i + 20) { $pdf->createtextbox('patient card' . $i, 30, $p, 120, 40, 20); $p=$p+20; }
i have made solution detects if have reached bottom of page try , fix above not usable incase of dynamic text(where text database). solution adds new page in case have reached value in y axis , resets y axis
//code require_once('../report/header.php'); // add page $pdf->addpage(); $p=30; ($i = 30; $i < 1000; $i = $i + 20) { $pdf->createtextbox('patient card' . $i, 30, $p, 120, 40, 20); if ($i == 230 || $i == 430 || $i==......){ $pdf->addpage(); $p=30; } $p=$p+20; }
is there way new pages can added automatically , value of y axis reset new page?
Comments
Post a Comment