I am looking at creating a bunch of PDFs that I can send out as wedding invitations. I tried using Python and Latex to create the invitations and then send them, but I have hit a brick wall. I have decided to pivot to getting LaTeX to create the documents and then using VBA (something I have experience doing) to send them based on the name of the PDF and the email address. I have a .csv with data that looks like this:
name_1,email_1
name_2,email_2
...
This is my TeX code so far, I am currently using XeLaTeX to compile the document and the last lines adds the background we want on the invitation:
\documentclass[a4paper]{article}
\usepackage{eso-pic,graphicx}
\usepackage[top=2cm, bottom=2cm, outer=0cm, inner=0cm]{geometry}
\usepackage{fontspec}
\usepackage[absolute,overlay]{textpos}
\usepackage{xcolor}
\definecolor{orangeish}{HTML}{de762c}
\definecolor{greyish}{HTML}{595959}
\pagestyle{empty}
\title{My Title}
\begin{document}
\begin{textblock}{210mm}(0mm,70mm)
\setmainfont{QuicksandBook-Regular}
\color{orangeish}
\fontsize{54}{60}\selectfont
\centering
SAVE THE DATE
\end{textblock}
\begin{textblock}{210mm}(0mm,110mm)
\setmainfont{QuicksandLight-Regular}
\color{greyish}
\fontsize{18}{20}\selectfont
\centering
TO CELEBRATE THE WEDDING OF
\end{textblock}
\begin{textblock}{210mm}(0mm,145mm)
\setmainfont{QuicksandLight-Regular}
\color{greyish}
\fontsize{48}{50}\selectfont
\centering
ME AND MY PARTNER
\end{textblock}
\begin{textblock}{210mm}(0mm,200mm)
\setmainfont{QuicksandLight-Regular}
\color{greyish}
\fontsize{18}{20}\selectfont
\centering
01.01.2000\par
LOCATION\par
\end{textblock}
\begin{textblock}{200mm}(0mm,280mm)
\setmainfont{Quicksand}
\color{greyish}
\fontsize{12}{15}\selectfont
\flushright
NAME ON THE .csv\par
INVITATIONS TO FOLLOW
\end{textblock}
\AddToShipoutPictureBG*{\includegraphics[width=\paperwidth, height=\paperheight]{save_the_date_2_compressed.jpeg}}
\end{document}
So my question is, how can I get TeX to read all of the names from the .csv file and put them into the TeX code then produce a PDF named by those names?
Let me know if anything isn't clear and I'll reply asap!