How to extract text from pdf line by line in python 2.7
<p>I'm trying to read and parse a PDF file containing a table...</p>

<p>This is the table in the PDF:</p>

<p><a href="http://i.stack.imgur.com/oCzM6.png" rel="nofollow">Table in pdf</a></p>

<p>and this is my code:</p>

<pre><code>import PyPDF2
import re
from PyPDF2 import PdfFileReader , PdfFileWriter
FileRead = open("C:\\Users\\Zahraa Jawad\\S40rooms.pdf", 'rb')
pdfReader = PyPDF2.PdfFileReader(FileRead)
pdfwriter = PdfFileWriter()
for page in pdfReader.pages:
    print page.extractText()
</code></pre>

<p>What I want is to read each line ( split ) in the table separately and save all information in the line ( YEAR, SEMESTER, ROOM, DAY, COURSE NO, INSTRUCTOR, TIME FROM, TIME TO, NUMBER OF STUDENTS ) in an array. After each '\n', I'd like to save the data in a new index in the array. </p>

<p>However, my code does not work; it reads all the information and returns it as a paragraph! I don't know how to split each line.</p>

<p>For example ( See the PDF above ): </p>

<p>341 458 01 Gazwa Sleebekh UTH 09:00 09:50 30 </p>

<p>Output: YEAR, SEMESTER, ROOM, DAY, COURSE NO, INSTRUCTOR, TIME FROM, TIME TO, NUMBER OF STUDENTS </p>

<p>2015/2016, Second, S40-021, U, 341, Ghazwa Sleebekh, 09:00, 09:50, 30  2015/2016, Second, S40-021, T, 341, Ghazwa Sleebekh, 09:00, 09:50, 30  2015/2016, Second, S40-021, H, 341, Ghazwa Sleebekh, 09:00, 09:50, 30</p>

<p>It's split by the UTH ( Day ) but my problem is how to read each line in the PDF and search within it using a regular expression :)</p>