I was working on a system that needed generate a PDF report of a view, I solved it as follows:
function report_view() {
...
$this->render();
require_once ('vendors/dompdf/dompdf_config.inc.php'); // import dompdf library
$dompdf = new DOMPDF();
$dompdf->load_html($this->output);
$dompdf->set_paper("a4", "landscape" );
$dompdf->render();
$dompdf->stream('ReportExample_'.date('d_M_Y').'.pdf');
exit(0);
}
You can see, that I used “$this->output” as parameter of load_html to get the output of the view.
I used the dompdf library.
diciembre 12th, 2012 on 7:32 pm
My name is Acosta Manuel Enrique Vecino , I just wanted to write that the blog is really interesting. Continue like this!
diciembre 12th, 2012 on 7:37 pm
Hi Enrique,
Thank you for your comment, is good to know that the information is useful.
Best regards.