html2canvas(document.getElementById("poster-canvas-box"), { useCORS: true, height: Document.getelementbyid ("poster-canvas-box").clientheight - 2, // Canvas height is the same as or less than the height of the screenshot. document.getElementById("poster-canvas-box").clientWidth - 2}).then((canvasElement) => { // do something })Copy the code