capture and log exceptions when generating PDFs