利用python的pdfplumber库可以实现转换,一些常用的方法
.extract_text() 用来提页面中的文本,将页面的所有字符对象整理为的那个字符串
.extract_words() 返回的是所有的单词及其相关信息
.extract_tables() 提取页面的表格
1、pdf转txt
import pdfplumber as pb
file_handle=open('out.txt',mode='w',encoding='utf-8')
# 读取PDF文档
pdf = pb.open("需求文档.pdf")
# 绝对路径也可以这么写,下同
# path = 'D:\\GKProject\\需求文档.pdf'
# 获取页数
a= len(pdf.pages)
print("当前页:",a)
print("-----------------------------------------")
i=0
for i in range(0