我有一个扫描的PDF表格(带有表格数据)。我想使用python从pdf文本中提取文本。我尝试了pdfminer
和mypdf2
,但无法获取输出。谁能帮助我:
也尝试过wand
,但没有得到所需的输出。我使用的代码如下
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.converter import TextConverter
from pdfminer.layout import LAParams
from pdfminer.pdfpage import PDFPage
from io import StringIO
rsrcmgr = PDFResourceManager()
retstr = StringIO()
codec = 'utf-8'
laparams = LAParams()
device = TextConverter(rsrcmgr, retstr, codec=codec, laparams=laparams)
fp = open('seriform.pdf', 'rb')
interpreter = PDFPageInterpreter(rsrcmgr, device)
password = ""
maxpages = 0
caching = True
pagenos=set()
for page in PDFPage.get_pages(fp, pagenos, maxpages=maxpages, password=password,caching=caching, check_extractable=True):
interpreter.process_page(page)
text = retstr.getvalue()
fp.close()
device.close()
retstr.close()
file1=open('ch.txt','w')
file1.write(text)
print(text,retstr)
预期的输出形式数据,实际的输出箭头符号
答案 0 :(得分:0)
尝试:
RecyclerViewAdapter