public function actionDownload() { parent::actionDownload(); $pdf = new PDF(); $pdf->title = 'Absence Status List'; $pdf->AddPage('P'); $pdf->setFont('Arial', 'B', 12); // definisi font $pdf->setFont('Arial', 'B', 8); // menuliskan tabel $header = array('No', 'ID', 'Short Status', 'Long Status', 'Priority'); $model = new Absstatus('searchwstatus'); $dataprovider = $model->searchwstatus(); $dataprovider->pagination = false; $data = $dataprovider->getData(); $cols = $dataprovider->getKeys(); $dataku = array(count($data)); //var_dump($dataku); $w = array(20, 25, 30, 40, 50); $pdf->SetTableHeader(); //Header for ($i = 0; $i < count($header); $i++) { $pdf->Cell($w[$i], 7, $header[$i], 1, 0, 'C', true); } $pdf->Ln(); $pdf->SetTableData(); //Data $fill = false; $i = 0; foreach ($data as $datas) { $i = $i + 1; $pdf->Cell($w[0], 6, $i, 'LR', 0, 'L', $fill); $pdf->Cell($w[1], 6, $datas['absstatusid'], 'LR', 0, 'L', $fill); $pdf->Cell($w[2], 6, $datas['shortstat'], 'LR', 0, 'C', $fill); $pdf->Cell($w[3], 6, $datas['longstat'], 'LR', 0, 'L', $fill); $pdf->Cell($w[4], 6, $datas['priority'], 'LR', 0, 'C', $fill); $pdf->Ln(); $fill = !$fill; } $pdf->Cell(array_sum($w), 0, '', 'T'); // me-render ke browser $pdf->Output('absencestatus.pdf', 'D'); }