Convert .docx File to PDF Using Python docx2pdf

In this tutorial, we will introduce a simple way to conver a .docx file to pdf file in python, we will use python docx2pdf package to implment it.

1. Install docx2pdf

pip install docx2pdf

2. Import library

from docx2pdf import convert

3. Convert .docx file to pdf

We can use convert() function to convert.

convert("Name_Of_Your_Doc_File.docx", "Output.pdf")