There's a JS library that does exactly this: https://github.com/niklasvh/html2canvas
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.
HTML2Canvas does not render full div, only what is visible on screen?
1 project | reddit.com/r/codehunter | 8 May 2022
Why won't Chrome on iPhone download image from site? Instead it downloads blank 'document' file.
1 project | reddit.com/r/learnprogramming | 1 Feb 2022
How would I go about grabbing a frame from an embedded youtube stream to manipulate further?
1 project | reddit.com/r/webdev | 29 Jan 2022
What website would allow me to turn a CSS image code into an image that I could download or open in a new tab?
1 project | reddit.com/r/learnprogramming | 3 Dec 2021
Building a Reverse Proxy with Cloudflare Workers
1 project | dev.to | 10 Nov 2021