Welcome folks today in this blog post we will be converting docx to pdf documents using docx2pdf library
. All the source code of the application is given below.
Get Started
In order to get started we need to install docx2pdf
library using the pip command
as shown below
pip install docx2pdf
Now you can convert word documents docx to pdf
using the command
docx2pdf inputfile.docx outputfile.pdf
app.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# Python3 program to convert docx to pdf # using docx2pdf module # Import the convert method from the # docx2pdf module from docx2pdf import convert # Converting docx present in the same folder # as the python file convert("GFG.docx") # Converting docx specifying both the input # and output paths convert("GeeksForGeeks\GFG_1.docx", "Other_Folder\Mine.pdf") # Notice that the output filename need not be # the same as the docx # Bulk Conversion convert("GeeksForGeeks\") |