I’m currently using doc2pdf
python library to convert some Word docx
files to pdf
.
from docx2pdf import convert
docx_file = '/tmp/One_of_hundreds.docx'
file_ext = os.path.splitext(docx_file)[1]
if file_ext.lower() == '.docx':
# we'll need to convert this to a PDF
pdf_path = os.path.splitext(docx_file)[0] + '.pdf'
convert(docx_file, pdf_path)
Unfortunately, this spins up MS-Word, which I think would be jarring for a user to see, especially if it happens multiple times (in the hundreds). Is there no way to suppress the Word UI (I’m on MacOS if that helps)? Additionally, this also spins up a dialog asking for permissions, which mercifully happens only once, is there no way to prevent that?