title: How to render pdf from HTML using CakePdf? I followed the instructions given in github but getting an error 'Failed to load PDF document'?
body: <p>I installed the plugins of CakePdf using composer. So in my vendor folder I have CakePdf plugin &amp; other dependencies.</p>
  <p>I downloaded wkhtmltopdf and installed it in a directory. The directory is <code>C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe</code></p>
  <p>Next by running the command <code>./bin/cake plugin load CakePdf -b</code> I added the plugin in <code>src/application.php</code></p>
  <pre><code>$this-&gt;addPlugin('CakePdf', ['bootstrap' =&gt; true]);
  </code></pre>
  <p>Then I wrote the below line in <code>config/routes.php</code> just before <code>Router::scope</code></p>
  <pre><code>Router::extensions(['pdf']);
  </code></pre>
  <p>And in <code>config/bootstrap.php</code></p>
  <pre><code>Configure::write('CakePdf', [
      'engine' =&gt; [
          'className' =&gt; 'CakePdf.WkHtmlToPdf',
          'binary' =&gt; 'C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe',
          'options' =&gt; [
              'print-media-type' =&gt; false,
              'outline' =&gt; true,
              'dpi' =&gt; 96
          ],
      ],
  ]);
  </code></pre>
  <p>Now in my <code>abc</code> controller <code>view</code> action I wrote</p>
  <pre><code>$this-&gt;viewBuilder()-&gt;options([
          'pdfConfig' =&gt; [
              'orientation' =&gt; 'portrait',
              'filename' =&gt; 'Invoice_' . $id.'.pdf'
      ]
  ]);
  </code></pre>
  <p>I have also created <code>view.ctp</code> inside <code>src/Templates/abc/pdf/view.ctp</code> and a <code>default.pdf</code> layout inside <code>src/Templates/Layout/pdf/default.ctp</code> .</p>
  <p>Now when I go to <code>localhost/abc/view/1.pdf</code>, I get an error saying <code>Failed to load PDF document</code>!</p>
  <p><a href="https://i.stack.imgur.com/sTrrq.jpg" rel="nofollow noreferrer">Failed to load the PDF document</a></p>
  <blockquote>
  <p>I would really like to know what could have went wrong and how I can fix it to work?</p>
  </blockquote>