eKoopmans / html2pdf.js

Client-side HTML-to-PDF rendering using pure JS.
MIT License
4.13k stars 1.39k forks source link

html2pdf function works until page is refreshed #367

Open alexchoiweb opened 3 years ago

alexchoiweb commented 3 years ago

Hi I am having a very weird issue - the function works on first load but after I refresh the page the button/functionality no longer downloads. Then back in my code editor I delete the function call, save, add the function call, and the function works again until I refresh the page. I'm using React with Typescript. Any ideas?

Ebn-Omier commented 3 years ago

Hi. try to add with addEventListener(); function...

const btn= document.getElementById('button'); btn.addEventListener("click", () => { html2pdf().from().save(); })