on-internet
← Community

Convert Microsoft Word document to PDF using Python

Stack Overflow ·

I have tons of Word and Excel files. I want to convert many Word files in folders by sub folders to PDF, and I try following code. This code is not active (I mean there aren't Word convert to PDF) although no error. What could be the problem? Is there another solution? This is my code: import os from win32com import client path = 'D:\programing\test' word_file_names = [] word = client.DispatchEx("Word.Application") for dirpath, dirnames, filenames in os.walk(path): print (dirpath) for f in filenames: if f.lower().endswith(".docx") and re.search('Addendum', f): new_name = f.replace(".docx", r".

Comments

Sign in or sign up to comment and upvote.

No comments yet.