I tried to build a checkbox widget that when it is being checked makes a printscreen of an element which is being taken by its class name. This is the handle change method of the event So the end result I’m looking for is something like this but my code always crops the picture based on my client view. I always get a different picture depending if the div is being seen on the screen or not or if there is half of it present there. I get something like for example: or even nothing. I tried changing the canvas coordinates based on the elements dimensions or position using the scroll, offset or client attributes, but it didn’t work. https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollWidth https://developer.mozilla.org/en-US/docs/Web/API/Element/clientWidth https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetWidth
asked
Marcian-Petrut Bondoc-Popescu
2 answers
0
There is already a widget doing something almost similair. You might want to check the code in that one out:
Was using bad version of html canvas, 1.4.0 worked fine and solved my problem https://www.npmjs.com/package/html2canvas https://html2canvas.hertzen.com/dist/html2canvas.min.js