Advertisement
freddy0512

der

Apr 10th, 2015
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public function submit ()
  2.         {
  3.             if(isset($_POST['cetak']))
  4.             {
  5.  
  6. //data should be here then we dont need data anymore
  7. $data['data'] = $this->penjualan_model->cetak();
  8. $PDFContent=$this->load->view('admin/laporan/cetak_laporan', $data, true);
  9.  
  10. $url = 'http://freehtmltopdf.com';
  11.  $data = array('convert' => '',
  12.               'html' => $PDFContent,
  13.               'baseurl' => base_url(),
  14.               'width' => '210mm',
  15.               'enablejs' => 0,
  16.               'orientation' => 'portrait');
  17.  
  18.  
  19. $options = array('http' => array('header'  => "Content-type: application/x-www-form-urlencoded\r\n",
  20.                                  'method'  => 'POST',
  21.                                  'content' => http_build_query($data)),);
  22.  
  23. $context  = stream_context_create($options);
  24.  
  25. $result = file_get_contents($url, false, $context);
  26.  
  27. header('Content-type: application/pdf');
  28.  
  29. echo $result;
  30.  
  31.  
  32.     }
  33.  
  34.  
  35.  
  36.  
  37.         else if (isset($_POST['cari']))
  38.         {
  39.                 $data['data'] = $this->penjualan_model->cetak();
  40.                 $this->load->view('admin/laporan/cari_laporan', $data);
  41.                
  42.         }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement