title: Laravel: Output array of bytes to browser in pdf format
body: <p>I am getting a response from an external api which contains an array of bytes I'd like to convert to pdf.</p>
  
  <p><a href="https://gist.github.com/santosh401/407815de780852bab210356203c27a55" rel="nofollow noreferrer">Sample response</a> from the api.</p>
  
  <p>So far, I have tried below code in laravel with no success.</p>
  
  <p><code>$data</code> is received from api.</p>
  
  <pre><code>return response($data)
                  -&gt;withHeaders([
                      'Content-Type'=&gt; 'application/pdf'
                  ]);
  </code></pre>