I'm using the mpdf library in my project, but at the time of generating the document it's returning a string and is not generating nothing, you know what it can be?
Google Chrome Developer Tools - Preview:
GoogleChromeDeveloperTools-Response:
ControllerClass:
publicfunctionget_relatorio_pdf(){$request_body=file_get_contents('php://input');$data=json_decode($request_body);if(!is_logged_in()||!$this->session->has_userdata('admin')){$this->load->view('login_view');return;}$this->load->library('pdf');//carregaabibliotecamPDF$body=$this->pdf->get_relatorio_teste();$mpdf=$this->pdf->load();//criaumobjetode'pdf'$mpdf->WriteHTML($body);$mpdf->Output('relatorio.pdf','I');//mostraopdfnonavegadorreturn;}
Pdf.php
publicfunctionload($param=NULL){if(file_exists('/xampp/htdocs/teste/vendor/autoload.php')){//caminhonowindowsdedesenvolvimentolocalinclude_once'/xampp/htdocs/teste/vendor/autoload.php';include_once'/xampp/htdocs/teste/vendor/mpdf/mpdf/mpdf.php';}elseif(file_exists('/var/www/html/teste/vendor/autoload.php')){//caminhonoubuntudedesenvolvimentolocalinclude_once'/var/www/html/teste/vendor/autoload.php';include_once'/var/www/html/teste/vendor/mpdf/mpdf/mpdf.php';}else{//colocarcaminhodosincludesdoservidordeproducaodadirppgaqui/*include_once'/var/www/????/vendor/autoload.php';//descobrirocaminhodeautoload.phpinclude_once'/var/www/????/vendor/mpdf/mpdf/mpdf.php';//descobrirocaminhodempdf.php*/var_dump("Erro");
}
if ($param == NULL) {
$param = '"en-GB-x","A4","","",10,10,10,10,6,3';
}
$mpdf = new mPDF($param);
return $mpdf;
}
public function get_relatorio_teste(){
$html = '<div>Olá mundo</div>';
return $html;
}