title: You have requested a non-existent service "knp_snappy.pdf"
body: <p>I followed the tutorial on <a href="https://github.com/KnpLabs/KnpSnappyBundle" rel="nofollow noreferrer">https://github.com/KnpLabs/KnpSnappyBundle</a> and <a href="https://ourcodeworld.com/articles/read/250/how-to-create-a-pdf-from-html-using-knpsnappybundle-wkhtmltopdf-in-symfony-3" rel="nofollow noreferrer">https://ourcodeworld.com/articles/read/250/how-to-create-a-pdf-from-html-using-knpsnappybundle-wkhtmltopdf-in-symfony-3</a>.</p>
  
  <p>app/config/config.yml</p>
  
  <pre><code>knp_snappy:`enter code here`
  pdf:
      enabled: true
      binary: /usr/local/bin/wkhtmltopdf
      options: []
  image:
      enabled: true
      binary: /usr/local/bin/wkhtmltoimage
      options: []
  </code></pre>
  
  <p>app/AppKernel</p>
  
  <pre><code>new Knp\Bundle\SnappyBundle\KnpSnappyBundle(),
  </code></pre>
  
  <p>MyController</p>
  
  <pre><code>use Knp\Bundle\SnappyBundle\Snappy\Response\PdfResponse;
  
  public function pdfAction(string $offerId)
  {
      $html = $this-&gt;renderView('@App/Offer/offer_pdf.html.twig', array(
          'offerId'  =&gt; $offerId
      ));
  
      return new PdfResponse(
          $this-&gt;get('knp_snappy.pdf')-&gt;getOutputFromHtml($html),
          'file.pdf'
      );
  }
  </code></pre>
  
  <p>I try and this:</p>
  
  <pre><code> public function offerToPDFAction(string $offerId)
  {
  
      $snappy = $this-&gt;container-&gt;get('knp_snappy.pdf');
  
      $html = '&lt;h1&gt;Hello&lt;/h1&gt;';
  
      $filename = 'myFirstSnappyPDF';
  
      return new Response(
          $snappy-&gt;getOutputFromHtml($html),
          200,
          array(
              'Content-Type'          =&gt; 'application/pdf',
              'Content-Disposition'   =&gt; 'attachment; filename="'.$filename.'.pdf"'
          )
      );
  </code></pre>
  
  <p>The same problem: 
  <strong>You have requested a non-existent service "knp_snappy.pdf".</strong></p>