Пример #1
0
def convert_to_pdf(doc):
    f = open('test13.docx', 'rb')
    doc = Document(f)
    try:
        word = client.DispatchEx("Word.Application")
        word.Visible = True
        new_name = doc.replace(".docx", r".pdf")
        worddoc = word.Documents.Open(doc)
        print("Exporting ... ")
        worddoc.SaveAs(new_name, FileFormat=17)
        worddoc.Close()
        word.Quit()
    finally:
        print("hello")