take a screenshot javascript of canvas 1

take a screenshot javascript of canvas

canvas.toDataURL('png')

Here is what the above code is Doing:
1. Create a new canvas element
2. Set the width and height of the canvas
3. Get the context of the canvas
4. Draw the image on the canvas
5. Get the data-URL formatted image
6. Set the href attribute of the download link to the data-URL formatted image
7. Simulate a click on the download link
8. Remove the canvas element once the image has been downloaded

Similar Posts