I'm trying to use HTML2PDF to print a PDF page that is created with HTML with all its CSS.
I used it inside an AJAX request, to have the print after clicking on a button. On the controller I implemented it in this way:
$this->load->library('html2pdf');
$this->html2pdf->folder('assest__/pdfs/');
$this->html2pdf->filename('printpage.pdf');
$this->html2pdf->paper('a4', 'portrait');
$this->html2pdf->html($view);
$this->html2pdf->create('download');
But I'm getting this kind of error:
Call to a member function
prepend_child()
on a non object
This kind of function is used in frame_tree.cls.php
file. Whenever I try to print the $frame
to which I apply the function it doesn't seem to be empty or null.
Here is what logs print_r($frame)
:
How can I solve this issue?
I am using mpdf, with inline CSS for each, and my framework is CodeIgniter, here is what I do:
I prepared one HTML template that will contain the information I need,
I used cURL to read that template, because am passing the parameters to it to generate the output.
I passed the text to mpdf, and done.