Create screenshot from DIV in LWC
- Saurabh Singh
- Dec 28, 2021
- 1 min read
There are some ways to take screenshot from div in javascript but in LWC, we need to modify to make it LWC compatible.
First write html as follows
in JS you need to import html2canvas.js. you can download this js from this location.
using printDiv function we can create screenshot and display on the page.
Remember we can display image on Canvas as well, but in my case I was getting blurry images on canvas, so instead on canvas i displayed it on img tag.