javascript take screenshot
<!DOCTYPE html>
<html>
<head>
<title>
How to take screenshot of
a div using JavaScript?
</title>
<!-- Include from the CDN -->
<script src=
"https://cdn.jsdelivr.net/npm/[email protected]/dist/html2canvas.min.js">
</script>
<!-- Include locally otherwise -->
<!-- <script src='html2canvas.js'></script> -->
<style>
#photo {
border: 4px solid green;
padding: 4px;
}
</style>
</head>
<body>
<div id="photo">
<h1>GeeksforGeeks</h1>
Hello everyone! This is a
trial page for taking a
screenshot.
<br><br>
This is a dummy button!
<button> Dummy</button>
<br><br>
Click the button below to
take a screenshot of the div.
<br><br>
<!-- Define the button
that will be used to
take the screenshot -->
<button onclick="takeshot()">
Take Screenshot
</button>
</div>
<h1>Screenshot:</h1>
<div id="output"></div>
</body>
</html>