I'm having trouble generating pdf with Dompdf using MVC. I'm using the following code:
// Importa arquivo de config da classe DOMPDF
require_once 'bower_components/dompdf/dompdf_config.inc.php';
// reference the Dompdf namespace
// use Dompdf\Dompdf;
// instantiate and use the dompdf class
$dompdf = new Dompdf();
$dompdf->loadHtml('Hello World!');
// (Optional) Setup the paper size and orientation
$dompdf->setPaper('A4', 'landscape');
// Render the HTML as PDF
$dompdf->render();
// Get the generated PDF file contents
$pdf = $dompdf->output();
// Output the generated PDF to Browser
$dompdf->stream('testePDF.pdf');
The result is the following error: Fatal error:
Class 'Dompdf' not found
When I use the following line:
// reference the Dompdf namespace
use Dompdf\Dompdf;
The result is this:
Parse error: syntax error, unexpected 'use' (T_USE)