Guest User

Untitled

a guest
Jul 19th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. class Pdf extends CI_Controller {
  2. public function __construct() {
  3. parent::__construct();
  4. $this->load->library('M_pdf');
  5. }
  6. public function index() {
  7. //load view
  8. $this->load->model("crud_model");
  9. $data["fetch_data_seminar"] = $this->crud_model->fetch_data_seminar();
  10. $data1["fetch_data_conf"] = $this->crud_model->fetch_data_conf();
  11. $data2["fetch_data_extra"] = $this->crud_model->fetch_data_extra();
  12. $data3["fetch_data_cgpa"] = $this->crud_model->fetch_data_cgpa();
  13. $data4["fetch_data_representation"] = $this->crud_model->fetch_data_representation();
  14. $data5["fetch_data_participation"] = $this->crud_model->fetch_data_participation();
  15. $data6["fetch_data_organ"] = $this->crud_model->fetch_data_organ();
  16. $data7["fetch_data_events"] = $this->crud_model->fetch_data_events();
  17. $data8["fetch_data_program"] = $this->crud_model->fetch_data_program();
  18. $data_array = array(
  19. 'seminar' => $data,
  20. 'conf' => $data1,
  21. 'extra' => $data2,
  22. 'cgpa' => $data3,
  23. 'representation' => $data4,
  24. 'participation' => $data5,
  25. 'organ' => $data6,
  26. 'events' => $data7,
  27. 'program' => $data8,
  28. );
  29.  
  30. $showdata = [];
  31. $html = $this->load->view('makepdf', $data_array, TRUE);
  32. $pdfFilePath = "download.pdf";
  33. $this->m_pdf->pdf->WriteHTML($html);
  34. $this->m_pdf->pdf->Output(pdfFilePath . pdf, "D");
  35. }
  36. public function generatepdf() {
  37.  
  38. }
  39. }
  40.  
  41. $pdfFilePath = "download.pdf";
  42.  
  43. //save in folder
  44. $this->m_pdf->pdf->Output("./your_folder_location/".$pdfFilePath, "F");
  45.  
  46. //download file
  47. $this->m_pdf->pdf->Output($pdfFilePath, "D");
Add Comment
Please, Sign In to add comment