title: dompdf->render(); not working in api class
body: <p>I'm having a problem when trying to render html to pdf using dompdf. </p>
  
  <p>I have the code placed inside a class and after the procedure code I would like it to create a pdf of the html. </p>
  
  <p>This is the code I have at the moment: </p>
  
  <pre><code>$templatefile = file_get_contents("templates/costreport.htm");
  //fill headers
  $templatefile = str_replace("%DATES%",stripslashes($startdate)." - ".stripslashes($enddate),$templatefile);     
  
  if ($siteid&gt;0) {
      $pdfname = "costreport-".$clientid.".pdf";
  } else {
      $pdfname = "costreport-".$clientid."-".$siteid.".pdf";
  }
  //insert into database
  //Close and output PDF document
  $pdfname = str_replace("/","-",$pdfname);
  $pdfname = str_replace("\\","-",$pdfname);
  //create pdf
  // unregister Yii's autoloader
  spl_autoload_unregister('my_autoloader');
  // register dompdf's autoloader
  require_once("../system/dompdf/dompdf_config.inc.php");
  // register Yii's autoloader again
  spl_autoload_register('my_autoloader');
  $dompdf = new DOMPDF();
  $dompdf-&gt;set_paper("A4","portrait");
  $dompdf-&gt;load_html($templatefile);
  //set_time_limit(240);
  $dompdf-&gt;render();
  $pdf = $dompdf-&gt;output();
  // You can now write $pdf to disk, store it in a database or stream it
  // to the folder.
  file_put_contents('../tmp/'.$clientid.'/'.$pdfname, $pdf);  
  </code></pre>
  
  <p>The code fails when the dompdf->render(); is in but once I take that line out the code works and the file is created but I cant open it if it hasn't rendered.</p>
  
  <p>I've tried debugging the code and made the template is HTML valid but I'm at a loss now.  </p>
  
  <p>The error I am getting back is just <code>boolen false</code> when I run the script with the <code>dompdf-&gt;render();</code> in it. </p>