Advertisement
jamboljack

Controller

Sep 28th, 2014
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.82 KB | None | 0 0
  1. public function cetak($id_dko) {
  2.         $id_dko = $this->uri->segment(4);      
  3.         $data['dko'] = $this->dko_model->select_by_id2($id_dko)->row();
  4.         $data['daftar_detail'] = $this->dko_model->select_detail_all($id_dko)->result();
  5.        
  6.         $pdfFilePath = "C:\\downloads/reports/$filename.pdf";
  7.         if (file_exists($pdfFilePath) == FALSE){
  8.             ini_set('memory_limit','32M');
  9.             $html = $this->load->view('adm/r_print_dko', $data, true); // render the view into HTML
  10.              
  11.             $this->load->library('pdf');
  12.             $pdf = $this->pdf->load();
  13.             $pdf->SetFooter($_SERVER['HTTP_HOST'].'|{PAGENO}|'.date(DATE_RFC822));
  14.             $pdf->WriteHTML($html); // write the HTML into the PDF
  15.             $pdf->Output($pdfFilePath, 'F'); // save to file because we can
  16.         }
  17.         redirect("C:\\downloads\reports\$filename.pdf");
  18.        
  19.         //$this->load->view('adm/r_print_dko', $data);
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement