I need to loop a list of names in a CSV file, and for each new name (row), create a page using a background "front" and add the name in the right side, say ~75% from left.
Then create a new page, with just the background "back" since we would print as double-sided paper.
Here's what I have so far, except from 3rd page onwards, it seems to merge both front and back backgrounds onto the same page.
\documentclass[12pt, a5paper,landscape]{memoir} % Use memoir for vplace
\usepackage[utf8]{inputenc} % required for characters like: Î ç etc.
\usepackage{color}
\usepackage{wallpaper} % For background image frame
\usepackage{datatool} % For loading data from file (e.g. from csv)
% Load database 'names' from file 'namelist.csv'
\DTLloaddb[keys={OrderNumber,Date,First,Last,Email,Quantity,Ticket,Order,Total,Fees,Payment,Status,Country,DrupalOrg,Meal,OtherMeal,Job,Company}]{names}{namelist.csv}
\begin{document}
\color{white}
\pagestyle{empty}
% For each record (line) in database 'names'
\DTLforeach{names}
{\firstname=First, \lastname=Last}{
{
\TileWallPaper{\paperwidth}{\paperheight}{A5_Badge_Front_Without_Placeholder}
\begin{vplace}[1.4]
\raggedleft{\bfseries\MakeUppercase{\firstname}} {\bfseries\MakeUppercase{\lastname}}
\end{vplace}
\vspace{\fill}
\leavevmode\thispagestyle{empty}\newpage
\clearpage
}
{
\TileWallPaper{\paperwidth}{\paperheight}{A5_badge_back}
\vspace{\fill}
\leavevmode\thispagestyle{empty}\newpage
\clearpage
\newpage
\cleardoublepage
}
}
\end{document}
See result at: https://www.sharelatex.com/project/58a1eb8f4cd29cd31efc3897
Reading from CSV works fine, adding a background - for just say front and outputting - was working fine before but I needed to add the new 2nd page in-between for the 'back' background. I tried adding \vspace{\fill}
around and using different variations of \clearpage
vs \newpage
but still get weird output for 3rd page (5th page etc.).