title: Save D3 chart as image
body: <p>I created lots of D3 chart in the application . </p>
  
  <p>But right now my requirement is to save D3 chart in any format like png/gif or pdf. </p>
  
  <p>I searched a lot and every one say we can use canvas for that. </p>
  
  <p>Can anyone give any example or link for that... </p>
  
  <p>Conceptually I am clear about that like</p>
  
  <p>Use the canvg JavaScript library to render the SVG image using Canvas:    <a href="https://github.com/gabelerner/canvg" rel="noreferrer">https://github.com/gabelerner/canvg</a></p>
  
  <p>Capture a data URI encoded as a JPG (or PNG) from the Canvas, according to these instructions: Capture HTML Canvas as gif/jpg/png/pdf?</p>
  
  <p>What I want actually if any one have implemented, then could you please share the code. </p>