Workarounds for exceptions during PDF generation