Added error handling for PdfController.