title: PHP: How To Use Snappy (wkhtmltopdf wrapper)
body: <p>I'm trying to generate a pdf using Snappy. I've already read the documentation at <a href="https://github.com/KnpLabs/snappy" rel="nofollow noreferrer">https://github.com/KnpLabs/snappy</a> and try the code.</p>
  <pre><code>require_once '/KnpLabs/src/autoload.php';
  
  use Knp\Snappy\Pdf;
  
  $snappy = new Pdf('C:\Program Files (x86)\wkhtmltopdf');
  
  // Display the resulting image in the browser
  // by setting the Content-type header to jpg
  $snappy = new Pdf('C:\Program Files (x86)\wkhtmltopdf');
  header('Content-Type: application/pdf');
  header('Content-Disposition: attachment; filename=&quot;file.pdf&quot;');
  echo $snappy-&gt;getOutput('http://localhost/pdfTester/try.php');
  </code></pre>
  <p>when i click a link on try.php, there is a popup to open the pdf file and when i choose to open, a message appears.</p>
  <blockquote>
  <p>Adobe Reader could not open 'file.pdf' because it is either not
  supported file type or because the file has been damaged</p>
  </blockquote>
  <p>btw i just got one month-old exp with php and i already search for same topic but it looks like cannot help much. Any helps are appreciated.</p>