Capture a div as an image

25,194

You can create an image using the canvas element. If your charts are rendered using HTML elements you need to draw that HTML onto the canvas. Then you can use toDataURL on the canvas to get the B64-encoded image data.

Share:
25,194
MarGa
Author by

MarGa

Updated on July 09, 2022

Comments

  • MarGa
    MarGa almost 2 years

    I have some div tags containing charts rendered by javascript. I want to export them in an image format by the press of a button. I don't know if it's possible to capture a div tag as an image using javascript ! so there i'm asking for tips and hints. Thanks in advance.