We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Embedded chart not rendered when converting PPTX to PDF

We have discovered that, in certain cases, embedded charts in PPTX files are not being rendered when the file is saved as a PDF using Aspose.Slides for .NET 15.6.

I have attached an example PPTX and the associated PDF. The chart is on the first slide.

I have also discovered that calling GetThumbnail() on the chart object results in an error, which I believe is the reason why the chart is not rendered on the PDF.

Example code:

foreach (var slide in presentation.Slides)
{
for (int i = slide.Shapes.Count - 1; i >= 0; i–)
{
var shape = slide.Shapes[i];

if (shape is Chart)
{
var chart = (Chart) shape;

var thumbnailBitmap = chart.GetThumbnail();
}
}
}

Error:

System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Aspose.Slides.Charts.Chart.„™( textFormatManager, ITextFrame textForOverriding, Color colorToSet, ‰‚ chNew)
at Ÿ.’…ctor(Legend legend, –„ g, ‰‚ chart2007)
at Ÿ.Ž…ctor(Chart sourceChart, –„ g, ‰‚ chart2007)
at ƒ.ƒ.Œ(‰‚ chart)
at Š‚.‰‚.Œ()
at .ž„.š›()
at Aspose.Slides.Charts.Chart.š—( c)
at Aspose.Slides.Charts.Chart.Š(‰€ canvas, –ˆ rc)
at Aspose.Slides.Shape.GetThumbnail(ShapeThumbnailBounds bounds, Single scaleX, Single scaleY)
at Aspose.Slides.Shape.GetThumbnail()

If you can address this issue, we will renew our license.

Kind regards,

Reuben

Hi Reuben,


Thank you for your interest in Aspose.Slides.

I have observed your comments and like to share with you that a thumbnail is being generated successfully however the chart is missing on thumbnail as well as on the PDF. A ticket with ID SLIDESNET-36709 has been logged into our issue management system for further investigation and resolution of the issue. I am sharing the sample code to generate thumbnail as well as the generated thumbnail for you kind reference. This thread has been linked with the issue so that you may be notified automatically once the issue will be resolved.

Presentation pres = new Presentation(@“D:\Embedded_chart_example.pptx”);
if (pres.Slides != null && pres.Slides.Any())
{
int pageNumber = 0;
foreach (ISlide slide in pres.Slides)
{
pageNumber++;
Bitmap bmp = slide.GetThumbnail(1f, 1f);
bmp.Save(@“D:\Embedded_chart_example-” + pageNumber + “.jpg”, System.Drawing.Imaging.ImageFormat.Jpeg);
}
}

We are sorry for your inconvenience,

The issues you have found earlier (filed as SLIDESNET-36709) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.