Advertisement
freddy0512

pdf

Apr 10th, 2015
297
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.  
  7. $data['data'] = $this->penjualan_model->cetak();
  8.  
  9. $PDFContent=$this->load->view('admin/laporan/cetak_laporan', $data, true);
  10.  
  11. $url = 'http://freehtmltopdf.com';
  12.  
  13.  
  14. $apiConfigData = array('convert' => '',
  15. 'html' => $PDFContent,
  16. 'baseurl' => base_url(),
  17. 'width' => '210mm',
  18. 'enablejs' => 0,
  19. 'orientation' => 'portrait');
  20.  
  21.  
  22. //i'm still dont understand $data
  23. $options = array('http' => array('header' => "Content-type: application/x-www-form-urlencoded\r\n",
  24. 'method' => 'POST',
  25. 'content' => http_build_query($apiConfigData)),);
  26.  
  27. $context = stream_context_create($options);
  28.  
  29. $result = file_get_contents($url, false, $context);
  30.  
  31. header('Content-type: application/pdf');
  32.  
  33. echo $result;
  34.  
  35.  
  36. }
  37.  
  38.  
  39. else if (isset($_POST['cari']))
  40. {
  41. $data['data'] = $this->penjualan_model->cetak();
  42. $this->load->view('admin/laporan/cari_laporan', $data);
  43.  
  44. }
  45.  
  46.  
  47.  
  48.  
  49.  
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement