If you just want to have screenshot of a div, you can do it like this Use html2canvas library click here Here is a code to take a screenshot of div <!DOCTYPE html> <html> <head> <title>Take Screen Shot</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.js"></script> </head> <body> <div id="screenshot"> <h1>Take a screenshot of that div</h1> Hello World...... </div> <button onclick="screenshot()">Make Screen Shot</button> <div id="mycanvas"></div> <script type="text/javascript"> function screenshot() { var element = document.getElementById('screenshot'); window.scrollTo(0,0); html2canvas(element, { width: 1200, height: 2000, onrendered:function(c...