title: Save and download PDF
body: <p>I need to do 2 things together &amp; at the same time with DOMPDF.</p>
  
  <p>I need to do the following together - is this possible?</p>
  
  <pre><code>//print the pdf file to the screen for saving
  $dompdf-&gt;stream("pdf_filename_".rand(10,1000).".pdf", array("Attachment" =&gt; false));
  //save the pdf file on the server
  file_put_contents('/home/stsnew/public_html/pdf/file.pdf', $dompdf-&gt;output()); 
  </code></pre>
  
  <p>The above works fine if <code>$dompdf-&gt;stream</code> and <code>$dompdf-&gt;output()</code> are done separately/individually , but when I try to run them together as shown above, it just crashes.</p>
  
  <p>Any help/advice would be really appreciated.</p>