Advertisement
jamboljack

Lap_daftar Controller

Dec 8th, 2015
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.92 KB | None | 0 0
  1. public function cetak_cv_pdf_status() {
  2.         $Tgl1       = $this->uri->segment(4);
  3.         $Tgl2       = $this->uri->segment(5);
  4.         $Status     = $this->uri->segment(6);
  5.         $data = array(             
  6.                 'Tgl1' => $Tgl1,
  7.                 'Tgl2' => $Tgl2,
  8.                 'Status' => $Status
  9.             );
  10.         $data['preview'] = $this->laporan_model->select_print_cv_status($data)->result();
  11.                
  12.         $time = time();
  13.         $filename = 'ReportCVStatus_'.$time;
  14.         $pdfFilePath = FCPATH."download/$filename.pdf";
  15.        
  16.         if (file_exists($pdfFilePath) == FALSE){
  17.             ini_set('memory_limit','50M');
  18.             $html = $this->load->view('panel/laporan/r_cv_print_status_pdf', $data, true); // render the view into HTML
  19.              
  20.             $this->load->library('pdf');
  21.             $pdf = $this->pdf->load();
  22.             $pdf->SetHeader('');
  23.             $pdf->SetFooter('');
  24.             $pdf->WriteHTML($html); // write the HTML into the PDF
  25.             $pdf->Output($pdfFilePath, 'F'); // save to file because we can
  26.         }
  27.         redirect("download/$filename.pdf");    
  28.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement