SVG icon indicating copy to clipboard operation
SVG copied to clipboard

Svg.SvgDocument Draw() return null

Open JDGrewal opened this issue 2 years ago • 3 comments

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 avatar Nov 18 '22 09:11 JDGrewal

@JDGrewal

If it's version difference, I think it's this change.

https://github.com/svg-net/SVG/pull/818#issuecomment-765868722

H1Gdev avatar Nov 18 '22 12:11 H1Gdev

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

JDGrewal avatar Nov 18 '22 13:11 JDGrewal

@JDGrewal

Can I publish the SVG file that causes this issue ?

3.2.3.36087

Do you mean this ?

H1Gdev avatar Nov 19 '22 06:11 H1Gdev