Skip to content

Instantly share code, notes, and snippets.

View webstyle's full-sized avatar
🎯
Focusing

Farrukh Mamatkhalilov webstyle

🎯
Focusing
  • Tashkent, Uzbekistan
View GitHub Profile
@webstyle
webstyle / docx2pdf.py
Created December 19, 2019 14:01 — forked from MichalZalecki/docx2pdf.py
Converting DOCX to PDF using Python
import sys
import subprocess
import re
def convert_to(folder, source, timeout=None):
args = [libreoffice_exec(), '--headless', '--convert-to', 'pdf', '--outdir', folder, source]
process = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=timeout)
filename = re.search('-> (.*?) using filter', process.stdout.decode())