Codeigniter Dompdf : Call to a member function isHtml5ParserEnabled() on null -


i placed 'dompdf' @ '/system/libraries/', , create class file 'dompdf.php' @ same dir, code below:

<?php  defined('basepath') or exit('no direct script access allowed');  require_once("dompdf/autoload.inc.php");  use dompdf\dompdf; use dompdf\options;  class ci_dompdf extends dompdf {     /**      * set template table config file if exists      *      * @param   array   $config (default: array())      * @return  void      */     public function __construct($config = array())     {         log_message('info', 'dompdf class initialized');     } } 

below part of controller function using dompdf library:

public function pdf_create($html, $filename='', $stream=true){     $this->load->library('dompdf','dompdf');      $this->dompdf->load_html($html);     $this->dompdf->render();     if ($stream) {         $this->dompdf->stream($filename.".pdf");     } else {         return $this->dompdf->output();     } } 

but error below:

php fatal error:  call member function ishtml5parserenabled() on null in /home/mysite/public_html/ci/system/libraries/dompdf/src/dompdf.php on line 492 

i'd checked function exists in 'dompdf/src/options.php'.

i have no idea how solve it.

my dev env:

  • codeigniter 3.0.6
  • dompdf 0.7.0

thanks.

update found error occurred due not call dompdf constructor, correct code below:

<?php  defined('basepath') or exit('no direct script access allowed');  require_once("dompdf/autoload.inc.php");  use dompdf\dompdf;  class ci_dompdf extends dompdf {      /**      *      * @param   array   $config (default: array())      * @return  void      */     public function __construct($config = array()) {         parent::__construct($config);          log_message('info', 'dompdf class initialized');     }  } 


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -