We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

ConvertToPDF won't finish

Hi,

we are not able to convert a xlsx file to a pdf although our code works fine with other xlsx files.


Here is the code we are using. The xlsx file is attached. We are using dotnet 6.0 with the Syncfusion.XlsIORenderer.Net.Core 20.4.0.38 package.


using Syncfusion.XlsIO;
using Syncfusion.XlsIORenderer;

using var excelEngine = new ExcelEngine();
var application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
using var fileStream = new MemoryStream(File.ReadAllBytes("PermissionsTimings.xlsx"));
var workbook = application.Workbooks.Open(fileStream);

var worksheet = workbook.Worksheets.First();

var renderer = new XlsIORenderer
{
ChartRenderingOptions =
{
ScalingMode = ScalingMode.Best
},
};
var settings = new XlsIORendererSettings
{
EmbedFonts = true
};

var doc = renderer.ConvertToPDF(worksheet, settings);

var pdfStream = new MemoryStream();
doc.Save(pdfStream);
pdfStream.Seek(0, SeekOrigin.Begin);

File.WriteAllBytes("a.pdf", pdfStream.GetBuffer());


It seems to finish rendering after 10 minutes on my machine. But that's not a reasonable time. Either there is a way to improve performance with a trick or we need to cancel the task after say 30 seconds.


Greetings

Jan


Attachment: PermissionsTimings_7fe262e6.zip


5 Replies 1 reply marked as answer

KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team January 4, 2023 01:19 PM UTC

Hi Jan,


We are able to reproduce the reported issue at our end and validating it currently. We will share the validation details on January 6th, 2023.


Regards,

Keerthi.



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team January 6, 2023 03:42 PM UTC

Jan, we have confirmed the issue as Performance delay occurs while converting Excel with conditional formatting to PDF and logged a defect report. We will include the fix for this issue in our weekly NuGet release scheduled for January 17th, 2023.


You can track the status of defect report through below feedback link.

https://www.syncfusion.com/feedback/40256/performance-delay-occurs-while-converting-excel-with-conditional-formatting-to-pdf


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.


For now, as a workaround, we suggest you to enable the sheet calculations to reduce the time for conversion. Please find the code snippet below.


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

workbook.Worksheets[0].EnableSheetCalculations();



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team January 18, 2023 05:45 PM UTC

Jan, we included the fix to resolve the issue Performance delay occurs while converting Excel with conditional formatting to PDF in our weekly NuGet release version 20.4.0.44. Kindly upgrade to this latest version and let us know if the reported issue is resolved.


Latest NuGet Package: https://www.nuget.org/packages/Syncfusion.XlsIO.Net.Core/20.4.0.44 


Marked as answer

JS Jan Schlacher January 29, 2023 05:39 PM UTC

Hi,


thank you very much! Still takes a couple of seconds (30 seconds), but acceptable I guess. Considering it took 10 minutes before the fix this is highly appreciated.


Jan



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team January 30, 2023 09:09 AM UTC

Thanks for your valuable feedback, Jan. Please contact us if you require any other assistance.


Loader.
Up arrow icon