ArgumentException is thrown when trying to create a SVG Image from the stream produced by ImageExporter.


https://www.nevron.com/Forum/Topic11874.aspx
Print Topic | Close Window

By Irina - 8 Years Ago
Hi,
I'm using the code from https://www.nevron.com/Forum/11860/ArgumentException-is-thrown-when-trying-to-create-an-Image-from-the-stream-produced-by-ImageExporter topic to create a SVG image, but it does not work. I'm getting System.ArgumentException


var memoryStream = new MemoryStream();
nChartControl1.ImageExporter.SaveToStream(memoryStream, new NSize(500, 500), NResolution.ScreenResolution, new NSvgImageFormat());
memoryStream.Seek(0, SeekOrigin.Begin);
var image = Image.FromStream(memoryStream);


How the exception  can be prevented?
Thank you

By Nevron Support - 8 Years Ago
Hi Irina,
.NET image class does not support SVG image format - you can create it from a metafile or png image for example.

By Irina - 8 Years Ago
Hi,
Thank you for the explanation.