I am using Python as a backend file handler and i have tried different libraries and com itself to convert word files to pdf such as;
and also pythoncom.CoInitialize().
The fastest one is aspose but it needs a license otherwise it puts a watermark in the pdf file. I was wondering is there anything else that i can use to speed up my process?
ps: i tried using packages that uses libreoffice but it changes the format (design) of the file. it is no use.
If you are running windows, you can use comtypes simply. For example,
import sys
import os
import comtypes.client
wdFormatPDF = 17
in_file = os.path.abspath(sys.argv[1])
out_file = os.path.abspath(sys.argv[2])
word = comtypes.client.CreateObject('Word.Application')
doc = word.Documents.Open(in_file)
doc.SaveAs(out_file, FileFormat=wdFormatPDF)
doc.Close()
word.Quit()