Python实现PDF转WORD的方式

Python Python实战

背景

网上的PDF转WORD都是收费的,写了好几年的Python了,打算想搞一个开源工具网站,其中的一个常用功能之一就是PDF转WORD,所以想探索一下所有的转换方式,持续更新中。。。。。。


环境

id name Version
1 Python 3.7

结果比较

详解

记录一下所有的包,有需要的可以进行参考。

pdf2docx

官网

https://www.cnpython.com/pypi/pdf2docx#

代码

1
2
3
4
5
6
7
8
9
10
11
import os
from pdf2docx import Converter

data_folder = os.path.join(os.getcwd(), 'pdf')
pdf_file = os.path.join(data_folder, '阿里云数据库.pdf')
print(pdf_file)
word_file = '%s-pdf2docx.docx' % os.path.splitext(pdf_file)[0]
print(word_file)
c = Converter(pdf_file)
c.convert(word_file)
c.close()

LibreOffice

官网

https://www.libreoffice.org/

PyPDF2

官网

https://pypdf2.readthedocs.io/en/latest/

PDFMiner

官网

https://www.unixuser.org/~euske/python/pdfminer/programming.html

结束语

坚持每天学习。。。。。。


Python实现PDF转WORD的方式
http://pygo2.top/articles/11221/
作者
mingliang.gao
发布于
2022年6月4日
许可协议