在Python中从PDF中提取水平线和文本

在Python中从PDF中提取水平线和文本,python,pypdf2,Python,Pypdf2,PDF是 我希望得到一个JSON文件包含:参考,日期,申请人,地点和建议。我的第一个目标是研究如何通过水平线“拆分”pdf以提取每个应用程序 我正在使用PyPDF2 import PyPDF2 pdfFileObj = open('example.pdf','rb') pdfReader = PyPDF2.PdfFileReader(pdfFileObj) pageObj = pdfReader.getPage(0) print (pageObj.extractText()

PDF是

我希望得到一个JSON文件包含:参考,日期,申请人,地点和建议。我的第一个目标是研究如何通过水平线“拆分”pdf以提取每个应用程序

我正在使用PyPDF2

import PyPDF2

pdfFileObj = open('example.pdf','rb') 
pdfReader = PyPDF2.PdfFileReader(pdfFileObj)
pageObj = pdfReader.getPage(0)         
print (pageObj.extractText())

然而,我不能让这种分裂的工作。我一直试图让PyPDF2打印出它从PDF中“看到”的所有内容,但也无法做到这一点。

您找到解决方案了吗?