# This script runs on Windows only, and you must have Word installed.
# Changes a Word document file into a PDF
import win32com.client
import docx
wordFilename = 'your_word_document.docx'
pdfFilename = 'your_pdf_filename.pdf'
doc = docx.Document()
# Code to create Word docuemnt goes here.
doc.save(wordFilename)
wdFormatPDF = 17  # Word's numeric code for PDFs.
wordObj = win32com.client.Dispatch('Word.Application')
docObj = wordObj.Documents.Open(wordFilename)
docObj.SaveAs(pdfFilename, FileFormat = wdFormatPDF)
docObj.Close()
wordObj.Quit()
