Word = ('Word.Application')ĭoc.SaveAs(outputFile, FileFormat=wdFormatPDF) OutputFile = os.path.abspath("document.pdf") InputFile = os.path.abspath("document.docx") The following code example shows us how to convert a docx file to a pdf file with the pywin32 package. We can use the Microsoft Word application with this package to open the docx file and save it as a pdf file. The command to install pywin32 is given below. As it is an external package, we have to install pywin32 before using it. The pywin32 package is generally used for creating and initializing COM objects and using windows services in Python. Convert Docx to PDF With the pywin32 Package in Python This tutorial will discuss the methods to convert a docx file to a pdf file in Python.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2023
Categories |