我正在尝试将扫描的pdf转换为可读的pdf,我使用下面的代码进行同样的转换。首先,我正在将扫描的文档转换为图像,并将其写回空白pdf。它给出了没有任何表的pdf的输出,但没有为包含表的pdf创建任何图像。
from pdf2jpg import pdf2jpg
import pytesseract
source = "C://convertpdf//source"
destination = "C://convertpdf//dest"
pdf2jpg.convert_pdf2jpg(source, destination, pages="ALL")
text = pytesseract.image_to_pdf_or_hocr(image, lang='eng')
target_path = "C://pdfconvert//readblepdf//new.pdf"
with open(target_path, 'wb') as tmp_pdf:
tmp_pdf.write(text)
tmp_pdf.close()我想得到的pdf与表格也转换为图像,并随后到一个可读的。在pdf2image中有没有其他包或方法可以做同样的事情?
发布于 2019-08-28 14:23:16
您可以使用tesseract生成可搜索的pdf,如下所示:(确保您的路径中有eng.traineddata )
tesseract words.png out -l eng PDF发布于 2019-08-29 13:57:44
Pdf2jpg.convert_pdf2jpg(源,目标,pages="ALL")
将PDF转换为图像
https://stackoverflow.com/questions/57685987
复制相似问题