title: Printing file output to printer?
body: <p>I am trying to generate some contents dynamically from a PHP page for print. Currently, I am using a file to store contents and then send that file to the printer. Is there a way, I can store contents in a variable or buffer and send to printer directly with out saving them in the file.</p>
  
  <p>My current code:</p>
  
  <pre><code>ob_start();
  include 'printcheck.php';
  $result = ob_get_clean();
  file_put_contents('/var/www/prints/rt/rtorder.txt', ob_get_contents());
  // end buffering and displaying page
  ob_end_flush();
  </code></pre>
  
  <p>Print it.</p>
  
  <pre><code>exec("cat "/var/www/prints/rt/rtorder.txt" | lp -d "TSP100"); 
  </code></pre>