i'm trying to conver word file into pdf file with this code: but it gives me the this not understood error (OSError: [WinError -2147221005] Invalid class string) I checked this answer but I didn't understand the answer
import os
import comtypes.client
wdFormatPDF = 17
in_file = os.path.abspath("C:\\Users\\somename\\Desktop\\tests\\sad.doc")
out_file = os.path.abspath("C:\\Users\\somename\\Desktop\\tests\\sad.pdf")
word = comtypes.client.CreateObject('Word.Application')
doc = word.Documents.Open(in_file)
doc.SaveAs(out_file, FileFormat=wdFormatPDF)
doc.Close()
word.Quit()