美文网首页
python:pdf 转 word

python:pdf 转 word

作者: 玩转测试开发 | 来源:发表于2021-09-11 02:13 被阅读0次

pdf2docx是一个非常好用的pdf转word的第三方库,优势在于减少了文件泄露的风险,并且完全没有免费转换的次数限制,缺点是格式可能没WPS等pdf转word的转出来的内容没有那么智能,格式没那么规范。

安装:pip install pdf2docx

转换源码:

# coding:utf-8

from pdf2docx import Converter

pdf_file = 'input.pdf'  # 你的pdf文件路径
doc_file = 'output.doc'  # 输出的word文件路径
cv = Converter(pdf_file)
cv.convert(doc_file, start=0, end=None)
cv.close()

运行效果:

图片

相关文章

网友评论

      本文标题:python:pdf 转 word

      本文链接:https://www.haomeiwen.com/subject/apszwltx.html