-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
Hi, Congrats for this great project @scanny!
In a .docx file, I need to replace every text {{name}}
by a variable in Python, and then export the .docx to PDF. This works:
doc = docx.Document('template.docx')
for paragraph in doc.paragraphs:
paragraph.text = paragraph.text.replace('{{name}}', 'john')
doc.save('temp.docx')
# this is very fast until here
# the next line is very slow (3 or 4 seconds for each iteration):
subprocess.call(r"C:\Program Files\LibreOffice\program\soffice.exe --headless --convert-to pdf temp.docx --outdir ." % i)
Is there a faster way, built-in in python-docx
, or with another python library, to export a DOCX to PDF?
(I need to do this in batch for thousands of PDF)
Metadata
Metadata
Assignees
Labels
No labels