I've created a short python script that creates invitations. It opens the word doc template, goes through an excel file with all the people, and puts the name inside and saves.
The issue is that I only have it saving as a docx, but really want it as a pdf, so currently I have to manually open each created docx and "save as" pdf. Does anyone know a package that will save as pdf?
code:
import pandas as pd
import docx
from docx.shared import Pt
doc = docx.Document('Z:/sample.docx')
names = pd.read_excel('Z:/example.xlsx')
style = doc.styles['Normal']
font = style.font
font.name = 'Calibri'
font.size = Pt(16)
for index, row in names.iterrows():
doc.paragraphs[2].text = '{} {} {},'.format(row['title'], row['firstname'], row['lastname'])
doc.paragraphs[2].style = doc.styles['Normal']
doc.save('Z:/{}_{}.docx'.format(row['title'], row['lastname']))