We can convert MS Word files (.docx) to .pdf on Windows or macOS, but the Microsoft Word must be installed. On Windows, this is implemented via win32com while on macOS this is implemented via JXA (Javascript for Automation, aka AppleScript in JS).
Let’s see an example.
from docx2pdf import convert # docx file path word_file = '/myinput/Doc1.docx' # pdf file path (output) pdf_file = '/myoutput/Doc1.pdf' convert(word_file, pdf_file)