Closed Parathantl closed 11 months ago
👋 @Parathantl
Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. To help make it easier for us to investigate your issue, please follow the contributing guidelines.
We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
@Parathantl
wrapping your component in a div may helps
in my vue case,
<div >
<UCard ref={elShare}
to
<div ref={elShare}>
<UCard
solved
@hylarucoder Thanks it solved to me.
still broken to me
Summary of Issue: I am using React and wanted to download the parsed HTML element as an Image when the button clicks. But, it doesn't do as expected. In the console, it gives an error.
Expected Behavior
It should download the image version of parsed HTML content
Current Behavior
It gives error as: TypeError: Cannot read properties of undefined (reading 'defaultView')
Steps To Reproduce
import { toPng } from 'html-to-image';
` const onButtonClick = (htmlContent) => { if (htmlContent === null) { return; }
console.log('on button click::', htmlContent); // Content consoles here...
toPng(htmlContent, { cacheBust: true }) .then((dataUrl) => { const link = document.createElement('a'); link.download = 'my-image-name.png'; link.href = dataUrl; link.click(); }) .catch((err) => { console.log(err); }); };`