eKoopmans / html2pdf.js

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

html2pdf doesn't work, nothing happened #356

Open fmgono opened 4 years ago

fmgono commented 4 years ago

i'm using this code https://codesandbox.io/s/xlnzq7y28q

but when i click export pdf button, that html2pdf() function like didn't execute anything

vhurryharry commented 3 years ago

Same here. Nothing happens when I call the html2pdf() function. The demo is not working as well. Is there any fix or update for this?

jinyuejin commented 3 years ago

我正在使用此代码 https://codesandbox.io/s/xlnzq7y28q

但是当我单击导出pdf按钮时,该html2pdf()功能没有执行任何操作

Do you solve this problem? I had the same problem

jsmithdev commented 3 years ago

i'm using this code codesandbox.io/s/xlnzq7y28q

but when i click export pdf button, that html2pdf() function like didn't execute anything

that worked here but if it still doesn't for you, maybe include browser, OS, etc. I also noticed that link was using older 0.8.2 fwiw

Deanari commented 3 years ago

I've been with a similar problem for a long time today, in my case, your codesandbox is working so if you see it working on your sandbox but not on your computer you might have a similar problem as I had: this lib does not work when opening directly from the html file, check your browser and the url, if you see "file" it won't work, this is due to browser's security, since some attacks are made this way. You need to test it with an IDE that have live preview, for example brackets.io or get a plugin on your visual studio code. With live preview you will see that the url changes to a port on your localhost, then your code should work as in your sandbox 😄