I have few chapters in pdf file showed in the image below. I want to extract the data (red line) after the bold sentences
My current code able to loop through all the pages and extract all text. But how to extract those after bold sentences?
Sample code:
import PyPDF2
filename = "test.pdf"
pdfFileObj = open(filename, 'rb')
pdfReader = PyPDF2.PdfFileReader(pdfFileObj)
num_pages = pdfReader.numPages
count = 0
text = ""
while count < num_pages:
pageObj = pdfReader.getPage(count)
count += 1
text += pageObj.extractText()
print(text)