<div id="capture" style="padding: 10px; background: #f5da55"> <h4 style="color: #000; ">Hello world!</h4> </div>
html2canvas(document.querySelector("#capture")).then(canvas => { document.body.appendChild(canvas) });
npm install --save html2canvas
yarn add html2canvas
Test out html2canvas by rendering the viewport from the current page.