I am rewriting a legacy system from the company I work in (using CakePHP for this) and it generates some PDF reports using FPDF. However, in CakePHP I can not generate any PDF.
Follow the code
Action
function pdf ($id = null) {
App::import('Vendor', 'Fpdf', array('file' => 'fpdf/fpdf.php'));
$this->layout = 'pdf';
$this->set('fpdf', new FPDF('P','mm','A4'));
$mensagem = is_null($id) ? "Nenhum ID fornecido" : "ID: $id";
$this->set('data', $mensagem);
$this->response->type('pdf');
$this->render('pdf');
}
View
$fpdf->AddPage();
$fpdf->SetFont('Arial','B',16);
$fpdf->Cell(40,10, $data);
$fpdf->Output();
No error appears, just the Chrome PDF plugin and it says "loading" but never loads.
It is not a problem on the server because, on the same test server, there is an old system mirror running normally.