Recently we face with the problem that sometimes we have an exception thrown when adding SVG image to Images collection of Presentation object.
Here is a code sample:
string source = // Loaded svg image from file as a string
var image = new Aspose.Slides.SvgImage(source);
presentation.Images.AddImage(image);
There’s an exception with message “System.Runtime.InteropServices.ExternalException : A generic error occurred in GDI+.” in the third line. It has next stack trace:
at System.Drawing.Imaging.Metafile…ctor(Stream stream, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type, String description)
at System.Drawing.Imaging.Metafile…ctor(Stream stream, IntPtr referenceHdc, Rectangle frameRect, MetafileFrameUnit frameUnit, EmfType type)
at Aspose.Slides.\u000e .\u0002(Int32 \u0002, Int32 \u0003)
at Aspose.Slides.\u000e …ctor(\u0002 \u0002, Int32 \u0003, Int32 \u0005)
at Aspose.Slides.\u000f .\u0002(String \u0002, \u0008 \u0003, Int32 \u0005, Int32 \u0008)
at Aspose.Slides.ImageCollection.AddImage(ISvgImage svgImage)
It doesn’t happen all the time. Only sometimes.
Here’s a svg image:
chart-1-1-svg.zip (2.4 KB)
We use Aspose.Slides for .NET v.21.7.0