title: Extract Text Using PdfMiner and PyPDF2 Merges columns
body: <p>I am trying to parse the pdf file text using pdfMiner, but the extracted text gets merged. I am using the pdf file from the following link.</p>
  
  <p><a href="http://www.housingnyc.com/downloads/resources/sta_bldngs/2011StatenIslBldgs.pdf" rel="noreferrer">PDF File </a></p>
  
  <p>I am good with any type of output (file/string). Here is the code which returns the extracted text as string for me but for some reason, columns are merged.</p>
  
  <pre><code>from pdfminer.converter import TextConverter
  from pdfminer.layout import LAParams
  from pdfminer.pdfinterp import PDFResourceManager, process_pdf
  import StringIO
  
  def convert_pdf(filename):
      rsrcmgr = PDFResourceManager()
      retstr = StringIO()
      codec = 'utf-8'
      laparams = LAParams()
      device = TextConverter(rsrcmgr, retstr, codec=codec)
  
      fp = file(filename, 'rb')
      process_pdf(rsrcmgr, device, fp)
      fp.close()
      device.close()
  
      str = retstr.getvalue()
      retstr.close()
      return str
  </code></pre>
  
  <p>I have also tried PyPdf2, but faced the same issue. Here is the sample code for PyPDF2</p>
  
  <pre><code>from PyPDF2.pdf import PdfFileReader
  import StringIO
  import time
  
  def getDataUsingPyPdf2(filename):
      pdf = PdfFileReader(open(filename, "rb"))
      content = ""
  
      for i in range(0, pdf.getNumPages()):
          print str(i)
          extractedText = pdf.getPage(i).extractText()
          content +=  extractedText + "\n"
  
      content = " ".join(content.replace("\xa0", " ").strip().split())
      return content.encode("ascii", "ignore")
  </code></pre>
  
  <p>I have also tried <a href="https://github.com/euske/pdfminer/blob/c7709045e9c9b19676b9df12656664f32b0963b1/tools/pdf2txt.py" rel="noreferrer">pdf2txt.py</a> but unable to get the formatted output.</p>