PDF Index was outside the bounds of the array during Excel to PDF conversion with Syncfusion

I’m using Syncfusion to convert an Excel file to PDF, but I’m getting an error: 'Index was outside the bounds of the array

version used: 30.1.37

here is my code 

                                using (ExcelEngine excelE = new ExcelEngine())

                                {

                                    IApplication application = excelE.Excel;

                                    application.DefaultVersion = ExcelVersion.Xlsx;


                                    //Initialize XlsIO renderer.

                                    XlsIORenderer renderer = new XlsIORenderer();


                                    using (FileStream excelStream = new FileStream(newRelativeFilePath, FileMode.Open, FileAccess.Read))

                                    {

                                        IWorkbook wb = application.Workbooks.Open(excelStream);

                                        ExcelTemplater.CalculateFormulaForPdf(wb);


                                        //Convert Excel document with charts into PDF document

                                        using (PdfDocument pdfDocument = renderer.ConvertToPDF(wb, settings))

                                        {

                                            using (Stream s = new FileStream(newRelativeFilePathPdf, FileMode.Create, FileAccess.ReadWrite))

                                            {

                                                if (data!.ContainsKey("annexes"))

                                                {

                                                    AddAnnexes(JArray.Parse(data["annexes"].ToString()), pdfDocument);

                                                }

                                                pdfDocument.Save(s);

                                            }

                                        }

                                    }

                                }

thank you



Attachment: 10119_586c9131.zip

4 Replies

KS Karthika Santhana Krishnan Syncfusion Team July 2, 2025 10:57 AM UTC

Hi Team,


We have reproduced the issue on our end. 

We are currently validating it. We will share the validation details on July 04, 2025.


Regards,

Karthika S.



KS Karthika Santhana Krishnan Syncfusion Team July 4, 2025 03:44 PM UTC

Hi Aitbouhou,


Sorry for the inconvenience.

Due to complexity of the issue, we need additional time to validate.

We will share the validation details on July 08th, 2025.


Regards,

Karthika S.






AH Alex Harson James Henso Syncfusion Team July 8, 2025 02:28 PM UTC

Hi Adam,

The respective team confirmed that the reported issue with “Index out of range Exception occurs while converting WMF to image/PdfTemplate using MetafileRenderer library.” is a defect and they have logged a defect report. They will include the fix for this defect in our weekly NuGet release, which is estimated to be available on July 22th, 2025.

The status of this bug can be tracked through the below link:

https://www.syncfusion.com/feedback/68755/index-out-of-range-exception-occurs-while-converting-wmf-to-image-pdftemplate

 

Note: If you require a patch for the reported issue in any of our Essential Studio Main or SP release version, then kindly let us know the version, so that we can provide a patch in that version based on our SLA policy.

 

Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.” 

 

Regards,

Alex Harson James H



KS Karthika Santhana Krishnan Syncfusion Team July 22, 2025 03:33 PM UTC

Hi Adam,

 

We have included the fix to resolve the issue "Index out of range Exception occurs while converting WMF to image/PdfTemplate using MetafileRenderer library." in our weekly NuGet release version 30.1.41. Kindly upgrade your Syncfusion packages to this new 30.1.41 version and let us know if the issue is resolved.

NuGet Package: NuGet Gallery | Syncfusion.XlsIORenderer.Net.Core 30.1.41

Regards,

Karthika S.


Loader.
Up arrow icon