title: How to load html file inside cakephp using dompdf
body: <p>I am using dompdf with cakephp 3.6 to generate prints from HTML to PDF</p>
  
  <p>I have a function name <strong>test</strong> inside drivercontroller and i want to load a ctp file which is created inside src\Template\DriverDetails and filename is testpdf.ctp</p>
  
  <p>Can u plz help me to suggest how to pass complete file.</p>
  
  <p>Below is my code</p>
  
  <pre><code>public function test()  {
              $html = file_get_contents("testpdf.ctp");            
              $dompdf = new Dompdf();
              $dompdf-&gt;loadHtml($html);
              $dompdf-&gt;setPaper('A4', 'portrait');
              $dompdf-&gt;render();
              $dompdf-&gt;stream("invoice.pdf", array("Attachment" =&gt;0));
              exit(0);
          }
  </code></pre>
  
  <p><strong>src\Template\DriverDetails\testpdf.ctp</strong></p>
  
  <pre><code>&lt;html&gt;
      &lt;body&gt;
          &lt;table&gt;
              &lt;tr&gt;&lt;td align="center"&gt;&lt;?php echo $id; ?&gt;&lt;/td&gt;&lt;/tr&gt;
              &lt;tr&gt;&lt;td align="center"&gt;Demo Data&lt;/td&gt;&lt;/tr&gt;
          &lt;/table&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>