This project is read-only.

Convert svg to png , NullReferenceException

Jun 11, 2013 at 10:03 PM
Hello guys,

I try to convert .svg to .png. Here is my code :
   var sample = SvgDocument.Open(@"D:\DATA\test0.svg");
   sample.Draw().Save(@"D:\DATA\Projet LPIE\WebApplication1\WebApplication1\sample.png");         
But it generate NullReferenceException on the sample.Draw() function.
My .svg file is created manually and work well when i open it with Google Chrome.
Jun 12, 2013 at 10:53 AM
Hi again,

After verification, the problem comes from my .svg file. Its a very simple, file here is the code :
<?xml version="1.0" encoding="UTF-8"?>
<circle cx="350" cy="350" r="2" stroke="red" stroke-width="2" fill="red"/>
<line x1="350" y1="350" x2="420" y2="280" stroke="blue" stroke-width="2"/>

<line x1="420" y1="280" x2="517" y2="256" stroke="blue" stroke-width="2"/>

<line x1="517" y1="256" x2="517" y2="356" stroke="blue" stroke-width="2"/>

<line x1="517" y1="356" x2="428" y2="401" stroke="blue" stroke-width="2"/>

<circle cx="428" cy="401" r="2" stroke="yellow" stroke-width="2" fill="yellow"/>
What is wrong on this svg file ?

Jun 12, 2013 at 11:19 AM
OK problem solved i forgot width and height declaration on the <svg> header.
But the resulting image doesnt display the text on my svg file. Is that normal ?