Last active
May 13, 2025 14:16
-
-
Save nelsonfncosta/2c90fed5b9f0ee79b899854c4ab3de7b to your computer and use it in GitHub Desktop.
Convert Canvas pdf element to downloadable image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function downloadImage(elem) { | |
const image = elem.toDataURL("image/png").replace("image/png", "image/octet-stream"); | |
const a = document.createElement("a"); | |
a.href = image; | |
a.download = "image.png"; // Specify the file name here | |
a.click(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment