title: Extract first two lines of PDF with Python and pyPDF
body: <p>I'm using python 2.7 and pyPDF to get the title meta info from PDF files. Unfortunately not all of PDF have the meta info. What I want to do now is grab the first two line of text from a PDF. Using what I have now how can I modify the code to capture the first two lines with pyPDF?</p>
  
  <pre><code>from pyPdf import PdfFileWriter, PdfFileReader
  import os
  
  for fileName in os.listdir('.'):
      try:
          if fileName.lower()[-3:] != "pdf": continue
          input1 = PdfFileReader(file(fileName, "rb"))
  
          # print the title of document1.pdf
          print fileName, input1.getDocumentInfo().title
      except:
          print ",", 
  </code></pre>