title: Extract bold and underlined texts from .pdf
body: <p>I need to extract text from pdf. But the pdf has some bold and underlined texts. I tried MyPDF2 but getting error while trying to read those pdfs containing formatted texts.</p>
  
  <pre><code>    import PyPDF2
      pdf_file = open('Downloads/th.pdf','rb')
      read_pdf = PyPDF2.PdfFileReader(pdf_file)
      number_of_pages = read_pdf.getNumPages()
      page = read_pdf.getPage(0)
      page_content = page.extractText()
      print (page_content)
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <pre><code>    ˘ˇˆˆ˝˛˚˜ ˜˚!˘˘ˇˆ˙˛˝˚˜˚ !ˆ"#$ˆ%&amp;'˛"˝#$%˝˚'(˚˛)˛˝*+!-.$ˆ˚˛˚˛˘/˛˛0˛122/ 
      ˘˛˘˚˘˚2ˆ$".#$ˆ%˘˛˛$ˆ$%#$ˆ%˛˛˛˛˝˝(0/ 0$%˙˚˙3#"$˘--4˛0˚! 
      ˆ"#$ˆ%56272˛ˇ5'˛6222˛'4˘8(9˛(˜˚˛&amp;˙˙˙˙˙
  </code></pre>