title: extract text with formatting preserved in php
body: <p>I am using <a href="http://pdfparser.org/" rel="nofollow">pdfparser</a> I want to extract data from pdf in php such that it preserves all  the whitespaces. Currently it just returns the string from pdf removing all the formatting.</p>
  
  <p>this is what i did</p>
  
  <pre><code>function extract_data($filename)
  {
        $parser=new Smalot\PdfParser\Parser();
        $pdf=$parser-&gt;parseFile($filename);
        $text=$pdf-&gt;getText();
        return $text;
  }
  </code></pre>