将 PDF 转换为 DOC(Python/Bash) [英] Convert PDF to DOC (Python/Bash)
本文介绍了将 PDF 转换为 DOC(Python/Bash)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我看到一些页面允许用户上传 PDF
并返回一个 DOC
文件,例如 PdfToWord
I've saw some pages that allow user to upload PDF
and returns a DOC
file, like PdfToWord
有没有办法使用 Python 或任何 Unix 命令将 PDF
文件转换为 DOC/DOCX
文件?
Is there any way to convert a PDF
file to a DOC/DOCX
file using Python or any Unix command ?
提前致谢
推荐答案
如果您安装了 LibreOffice
If you have LibreOffice installed
lowriter --invisible --convert-to doc '/your/file.pdf'
如果您想为此使用 Python:
If you want to use Python for this:
import os
import subprocess
for top, dirs, files in os.walk('/my/pdf/folder'):
for filename in files:
if filename.endswith('.pdf'):
abspath = os.path.join(top, filename)
subprocess.call('lowriter --invisible --convert-to doc "{}"'
.format(abspath), shell=True)
这篇关于将 PDF 转换为 DOC(Python/Bash)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文