I am using the TCPDF app in CakePHP as a vendor. I have everything setup according to the instructions. I am able to produce a valid PDF and it works great. Now I want to take the results of an HTML rendered view that already exists and create a PDF from it.
I set the HTML variable and use that in the view as:
$pdf->writeHTML($html, true, false, true, false, '');
Here is what I have tried and it renders a blank screen:
ob_start();
$this->render('results', 'pdf');
$data = ob_get_contents();
ob_end_clean();
$this->set('html', $data);
I have also tried:
$data = $this->results();
$this->set('html', $data);
But it only shows the PDF with the word OBJECT
in it.
How can I render an existing view but have the output directed to the PDF?