PdfProcessing: IndexOutOfRangeException is thrown when encoding an image with Grayscale color space
When encoding an image with Grayscale color space an exception is thrown: IndexOutOfRangeException: 'Index was outside the bounds of the array.'
1 comment
ADMIN
Dess | Tech Support Engineer, Principal
Posted on:14 Jan 2025 12:52
Hi,
As of Q1 2025 the PdfExportSettingswill offer the DocumentUnhandledException event which is purposed to allow our clients to handle exceptions while exporting a document. A sample code snippet of the API is shown in the following example:
PdfFormatProvider provider = new PdfFormatProvider();
PdfExportSettings settings = new PdfExportSettings();
provider.ExportSettings = settings;
settings.DocumentUnhandledException += (s, e) =>
{
Debug.WriteLine("The document is corrupted and cannot be exported: " + e.Exception.Message);
e.Handled = true;
};
Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik