I am trying to convert svg to png nin my asp.net applictaion using c#. I got some help from here. I followed Anish's suggestion . But I am getting exception on this. I dont have idea of this . My code include :
string path = "d:\\";
string svgstr = temp.Value;
var byteArray = Encoding.ASCII.GetBytes(svgstr);
var stream = new MemoryStream(byteArray);
var bitmap = SvgDocument.Open(stream).Draw();
bitmap.Save(path, ImageFormat.Png);
I am getting following exception on this:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 102: var stream = new MemoryStream(byteArray);
Line 103:
Line 104: var bitmap = SvgDocument.Open(stream).Draw();
Line 105:
Line 106: bitmap.Save(path, ImageFormat.Png);
Source File: e:\HighchartDemo\HighchartDemo\ColumnChart.aspx.cs Line: 104
I really need help on this. Any other alternative way would be helpful too. Thanks All