Saturday, 10 June 2017

php - DOMPDF not working, giving error

I have form.php file that getting data from mysql table.
form.php



 if(mysql_num_rows($sql)==0){
?>





1. America

Export as PDF
} else {
?>





1. India

Export as PDF
}
?>


And pdf.php



require_once("dompdf/dompdf_config.inc.php");
ob_start();
$html = file_get_contents('form.php');
$dompdf = new DOMPDF();
date_default_timezone_set('Asia/Kolkata');
$tym = date('g:i s');
$filename = 'FAA-8130_3_'.$tym;
$dompdf->load_html($html);
ob_end_flush();
$dompdf->render();
$dompdf->stream($filename. ".pdf", array("Attachment" => 0));


When I try to export it as PDF file, it is giving error...




Fatal error: Call to a member function prepend_child() on a non-object in C:\wamp\www\path\to\dompdf\include\frame_tree.cls.php on line 231




I could not understand why it is happening. I viewed this,this and this, but failed to resolve.

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...