PDF格式转换为DOC(Python的/ bash)的 [英] Convert PDF to DOC (Python/Bash)
本文介绍了PDF格式转换为DOC(Python的/ bash)的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经看到了一些页面,允许用户上传 PDF
并返回商务部
文件,像<一个HREF =http://www.pdftoword.com相对=nofollow> PdfToWord
I've saw some pages that allow user to upload PDF
and returns a DOC
file, like PdfToWord
有什么办法到 PDF
文件到 DOC / DOCX
文件转换使用Python或任何Unix命令?的
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屋!
查看全文