'How to save image from html2canvas

I'm using html2canvas to convert the div into an image. To save the image I have to go right-click and save it. Is it possible to download the image without right-clicking?

I tried like :

<a href="<canvas style='width: 1903px; height: 886px;' width='1903' height='886'></canvas>">DOWNLOAD</a>

but it doesnt work.

<div id="output">
   <canvas style="width: 1903px; height: 886px;" width="1903" height="886"></canvas>
</div>

Any help is appreciated



Solution 1:[1]

Maybe this answer helps you: https://stackoverflow.com/a/58652379/9855409 or https://stackoverflow.com/a/29756191/9855409

I think you need just to select the canvas and save it as an image, you can't download it because it is not an image yet.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Perry45