Is it possible to get an image of html document using javascript. I am looking for a javascript function like document.getThumbnail() or window.render() that return a PNG of the html document.
There are three different APIs that I can recommend:
Page.captureScreenshot. (docs) and example codechrome.desktopCapture or visibleCapture API. (docs) and example codeThis script allows you to take "screenshots" of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM and as such may not be 100% accurate to the real representation as it does not make an actual screenshot, but builds the screenshot based on the information available on the page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With