Good afternoon,
I've successfully managed to use PdfProcessing in a similar way to the demo but I want to include some error capture. What's the best way to return the error to the View and display it e.g. if the file doesn't exist?
[HttpPost]
public ActionResult Download_Document()
{
try
{
PdfFormatProvider formatProvider = new PdfFormatProvider();
formatProvider.ExportSettings.ImageQuality = ImageQuality.High;
byte[] renderedBytes = null;
using (MemoryStream ms = new MemoryStream())
{
RadFixedDocument document = CreatePdfDocument.CreateDocument();
formatProvider.Export(document, ms);
renderedBytes = ms.ToArray();
}
return File(renderedBytes, "application/pdf", "PdfDocument.pdf");
}
catch (Exception e)
{
return e.Message;
}
}
Kind regards,
Richard