0
I installed mPDF by the prompt on the Friends Of Cake github, and followed the instructions as on the github, but it is giving mPDF class error not found and line error $mpdf = new mPDF();, giving as no file or directory found even if there is the file, do not know how to solve!
Gerarpdf.ctp
<?php
include ('/Plugin/mpdf/src/Mpdf.php');
$pagina =
"<html>
<body>
<h1>Relatório de lead cadastrado</h1>
<ul>
<li>[email protected]</li>
<li>[email protected]</li>
<li>[email protected]</li>
</ul>
<h4>http://www.celke.com.br</h5>
</body>
</html>
";
$arquivo = "Cadastro.pdf";
$mpdf = new mPDF();
$mpdf->WriteHTML($pagina);
$mpdf->Output($arquivo, 'I');
// I - Abre no navegador
// F - Salva o arquivo no servido
// D - Salva o arquivo no computador do usuário
?>
Controller
namespace App\Controller;
use App\Controller\AppController;
use Cake\ORM\TableRegistry;
class RelatoriosController extends AppController
{
public function GerarPdf()
{
$this -> pdfConfig = array (
'orientation' => 'landscape',
'download' => true
);
}
}