Svg.SvgDocument Draw() return null
I'm using latest version 3.4.4 to convert base30 string to PNG and all working fine in development environment.
But when deployed to dev server, it throw a NullReferenceException. Svg.SvgDocument Draw() function returns NULL Bitmap.
Example data
I'm converting base30 to SVG using custom code and than using Svg Document as follow
SvgDocument mySVG; MemoryStream newStream = new MemoryStream(Encoding.Default.GetBytes(docSVG)); mySVG = SvgDocument.Open<Svg.SvgDocument>(newStream);
// then convert it to PNG MemoryStream tempStream = new MemoryStream(); mySVG.Draw().Save(tempStream, System.Drawing.Imaging.ImageFormat.Png); System.Drawing.Image img = System.Drawing.Image.FromStream(tempStream); return img;
Used Versions
Please note this working fine in development environment but not on web server.
Older version 2.4.3.29446 was working fine on web server.
Thanks for help.
@JDGrewal
If it's version difference, I think it's this change.
https://github.com/svg-net/SVG/pull/818#issuecomment-765868722
I've changed the version of Svg.dll from 3.4.4 To 3.2.3.36087
Error stop but image saved as blank. And to fix this error, I've changed the version of following:
System.Memory.dll >> 4.5.5 To 4.6.27617.2 System.Runtime.CompilerServices.Unsafe.dll >> 6.0.0 To 4.6.26919.2