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

Charts not visible when exporting to PDF

Hi,

I have successfully created and saved a XLSX file (first attachment). The same document should be provided as PDF from the Customer Area.

When I use Export, I can't see the charts (second attachment).

This is the code I have used:

<<
                            ExcelToPdfConverter converter = new ExcelToPdfConverter(workbook);
                            //ExcelToPdfConverter converter = new ExcelToPdfConverter(workbook.Worksheets[0]);  //same thing if I export the single sheet...
                            ExcelToPdfConverterSettings cSettings = new ExcelToPdfConverterSettings();
                            cSettings.LayoutOptions = LayoutOptions.FitAllColumnsOnOnePage;

                            //Initialize PDF document
                            PdfDocument pdfDocument = new PdfDocument();
                            //Convert Excel document into PDF document
                            pdfDocument = converter.Convert(cSettings);

                            var pdfName = @"\" + guid.ToString() + ".pdf";
                            var fulldocname = saveDir + TEMP_REPOSITORY_FOLDER + pdfName;

                            pdfDocument.Save(fulldocname);
>>

Based on documentation, 2D and 3D charts should be exported.

What's the matter?

Thanks. 
Claudio

Attachment: Downloads_92875559.zip

5 Replies

PK Prakash Kumar D Syncfusion Team November 20, 2018 06:46 AM UTC

Hi CLAUDIO, 
 
Thank you for contacting Syncfusion support. 
 
To preserve the charts during Excel To PDF conversion, initialize the ChartToImageConverter of IApplication interface otherwise the charts present in worksheet gets skipped. The following code illustrates how to convert an Excel with chart to PDF document. 
 
Code Example: 
application.ChartToImageConverter = new ChartToImageConverter(); 
 
To know more about this, pleaser refer the following UG link 
 
Regards, 
Prakash Kumar 



CR CLAUDIO RICCARDI November 20, 2018 04:24 PM UTC

Hi, Prakash Kumar

thank you for the support.
In order to initialize the ChartToImageConverter, must I update my libraries to the last version?
I'm using version 16.1.0.23 of Essential Studio. (ASP.NET MVC EJ1)

Thanks.

Claudio Riccardi


PK Prakash Kumar D Syncfusion Team November 21, 2018 06:55 AM UTC

Hi Claudio, 
 
To initialize the ChartToImageConverter, you have to refer the assembly (Syncfusion.ExcelChartToImageConverter.WPF) / NuGet package (Syncfusion.ExcelChartToImageConverter.WinForms.nupkg) 
 
Please refer the following link about assemblies required to convert chart in XlsIO 
  
Please refer the following link about NuGet package required to convert chart in XlsIO 
  
Please let us know if you need further assistance on this. 
 
Regards, 
Prakash Kumar 



CR CLAUDIO RICCARDI November 23, 2018 08:26 AM UTC

Thankk you for the support.

Problem solved!

Best Regards.

Claudio


PK Prakash Kumar D Syncfusion Team November 23, 2018 08:41 AM UTC

Hi Claudio, 
  
Thank you for updating us. 
  
We are glad that your issue is resolved. Please get back to us if you need further assistance. 
  
Regards, 
Prakash Kumar 


Loader.
Live Chat Icon For mobile
Up arrow icon