Gautam Parmar

Gautam Parmar

  • 824
  • 867
  • 21.5k

Converted PNG Image from SVG Is Blank

Oct 10 2017 2:27 AM
I have one of client has some there own MAP which is coming from map tag into code 
while it binds svg at running time.
 
When I convert SVG to png image is coming blank while my svg has map of selected area.
  1. var svg = document.getElementById('OpenLayers_Layer_Vector_75_svgRoot');  
  2.                 var xml = new XMLSerializer().serializeToString(svg);  
  3.                 var data = "data:image/svg+xml;base64," + btoa(xml);  
  4.                 var img = new Image();  
  5.   
  6.                 img.setAttribute('src', data);  
  7.                 document.body.appendChild(img);

Answers (3)