different attempt to create the pdf before emailing