将pdf文件转换成word文件,可利用python的pdf2docx第三方库。
1.导入第三方库相关类
from pdf2docx import Converter
2.实例化Converter
pdf_file = 'D:\pdf文件.pdf'
cv = Converter(pdf_file=pdf_file)
参数pdf_file为要转换的pdf文件路径
3.转换成word文件并关闭实例化的Converter
cv.convert(docx_filename=docx_file, start=0, end=None)
cv.close()
参数docx_filename为转换后的word文件的文件路径;start为转换的起始页,end为转换的终止页,默认整篇转换。