3
I have code on Controller down it is working perfectly, however I want to set my own title and when I try to SetTitle() he returns me this error:
Call to a Member Function Settitle() on null
public function gerar() 
{   
    $this->load->helper('funcoes_helper');
    $this->load->helper('financeiro_helper');
    $this->load->helper('array_helper');
    $this->load->model('cadastro_model');
    $this->load->helper('funcoes');
    //load the view and saved it into $html variable
    $html= $this->load->view('novo/contrato', true);
    //this the the PDF filename that user will get to download
    $pdfFilePath = "contrato.pdf";
    $mpdf =$this->load->library('m_pdf','m_pdf');
    //load mPDF library
    $this->load->library('m_pdf','m_pdf');
    $mpdf->pdf->SetTitle('My Title');
    //generate the PDF from the given html
    $this->m_pdf->pdf->WriteHTML($html);
    //download it.
    $this->m_pdf->pdf->Output($pdfFilePath,'I');       
}
My file .php:
<?php 
    if (!defined('BASEPATH')) exit('No direct script access allowed');
    if (!defined('BASEPATH')) exit('No direct script access allowed');
    include_once APPPATH.'/third_party/mpdf/mpdf.php';
    class M_pdf 
    {
        public $param;
        public $pdf;
        public function __construct($param = "'c', 'A4-L'")
        {
            $this->param =$param;
            $this->pdf = new mPDF($this->param);
        }
    }
?>
I want to set my title to "Contract". How do I do this?