Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. public function gerar() {
  2.  
  3.  
  4. $this->load->helper('funcoes_helper');
  5. $this->load->helper('financeiro_helper');
  6. $this->load->helper('array_helper');
  7. $this->load->model('cadastro_model');
  8.  
  9. $this->load->helper('funcoes');
  10.  
  11.  
  12.  
  13.  
  14. //load the view and saved it into $html variable
  15. $html= $this->load->view('novo/contrato', true);
  16.  
  17. //this the the PDF filename that user will get to download
  18. $pdfFilePath = "contrato.pdf";
  19.  
  20. $mpdf =$this->load->library('m_pdf','m_pdf');
  21. //load mPDF library
  22. $this->load->library('m_pdf','m_pdf');
  23.  
  24. $mpdf->pdf->SetTitle('My Title');
  25.  
  26. //generate the PDF from the given html
  27. $this->m_pdf->pdf->WriteHTML($html);
  28.  
  29. //download it.
  30. $this->m_pdf->pdf->Output($pdfFilePath,'I');
  31. }
  32.  
  33. include_once APPPATH.'/third_party/mpdf/mpdf.php';
  34.  
  35. class M_pdf {
  36.  
  37. public $param;
  38. public $pdf;
  39. public function __construct($param = "'c', 'A4-L'")
  40. {
  41. $this->param =$param;
  42. $this->pdf = new mPDF($this->param);
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement