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

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 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.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply