I've saw some pages that allow user to upload PDF and returns a DOC file, like PdfToWord
Is there any way to convert a PDF file to a DOC/DOCX file using Python or any Unix command ?
Thanks in advance
If you have LibreOffice installed
lowriter --invisible --convert-to doc '/your/file.pdf'
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)
来源:https://stackoverflow.com/questions/26358281/convert-pdf-to-doc-python-bash