You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
from pdf2docx import Converter
|
|
|
|
|
|
|
|
|
|
# PDF文件路径
|
|
|
|
|
pdf_file = 'TestDataPlan-CET.pdf'
|
|
|
|
|
# 输出Word文档路径
|
|
|
|
|
word_file = 'd.docx'
|
|
|
|
|
|
|
|
|
|
# 初始化转换器
|
|
|
|
|
cv = Converter(pdf_file)
|
|
|
|
|
|
|
|
|
|
# 将PDF转换为Word,默认全部页面,可以指定页码范围,如:pages=[0, 1, 2]
|
|
|
|
|
cv.convert(word_file, start=0, end=None)
|
|
|
|
|
|
|
|
|
|
# 关闭转换器,释放资源
|
|
|
|
|
cv.close()
|