Python 3 Script to Convert Word Documents Docx to PDF Using docx2pdf Library Full Project For Beginners


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 docx2pdflibrary 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


# 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 

# 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 


READ  Python 3 Script to Check Whether a Number is Odd or Even Full Tutorial For Beginners


Leave a Reply