title: Dealing with and printing large text files
body: <p>I'm working on a corporate art project that requires me to: </p>
  
  <ol>
  <li>Take every line of code in our git repo (hundreds of thousands) and join them into a single line in a single file. - This has been completed but the file is quite large (122mb)</li>
  <li>That file needs to be converted into a print shop-ready format (PDF, EPS, etc) in four very large (3' x 8' / 300dpi) posters.</li>
  </ol>
  
  <p>Here's what I've tried:</p>
  
  <ul>
  <li><p>Illustrator (copy/paste crashes)</p></li>
  <li><p>InDesign (crashes)</p></li>
  <li><p>Acrobat (crashes)</p></li>
  <li><p>PHP (I can get the file to display on a large enough webpage but any kind of print-to-pdf, etc just makes my browser die - See code below)</p></li>
  </ul>
  
  <p>-</p>
  
  <pre><code>$READ_LEN = 64*1024; 
  $MAX_BUF_LEN = 2*$READ_LEN; 
  
  $url = "../thisisit.txt"; 
  $handle = fopen($url, "r") or die("Couldn't get handle");
  if ($handle) {
      while (!feof($handle)) {
          $buffer = fgets($handle, 4096);
          // Process buffer here..
          echo htmlentities($buffer);
      }
      fclose($handle);
  }
  </code></pre>
  
  <p>My questions are as follows:</p>
  
  <ul>
  <li><p>Is there a better way to deal with a text file of this size?</p></li>
  <li><p>Is there a way to stream the output of the text file (via a shell command like cat) into a PDF wrapper directly?</p></li>
  <li><p>Am I insane for attempting to do this?</p></li>
  </ul>