Bug 8007: (QA followup) Add error handling when generating the pdf