Open mIcHyAmRaNe opened 5 years ago
Experienced the same issue (not sure if it's an issue though). What I did to quick-fix it is execute the function inside setTimeout().
Also, in my case I got multiple divs to print. So I executed the function recursively. :)
I met same issue Here is the original view from my website:
however, after pressing the download button (screenshot) it show like this
image from network(url) does not show, but only the black color container.
Please help me.
👍 I experienced the same issue.
Experienced the same issue (not sure if it's an issue though). What I did to quick-fix it is execute the function inside setTimeout().
Also, in my case I got multiple divs to print. So I executed the function recursively. :)
Where do you put your setTimeout()
?
I found the solutions just have to pass useCORS: true
to the options to make it work :)
Where do you put your
setTimeout()
?
Actually, we don't really need to put it inside a setTimeout()
. It just depends on your use case.
This is what I did to make it work (esp loading images using URLs):
<div>
<img src="https://somesecuredwebsite.com/images/1.png" crossorigin="anonymous" />
</div>
take note of the crossorigin="anonymous" above...
const base64Image = await this.$html2canvas(el, { type: 'dataURL', useCORS: true, logging: false })
console.log(base64Image)
Hello all, shall we close this?
crossorigin="anonymous"
Not working.
Where do you put your
setTimeout()
?Actually, we don't really need to put it inside a
setTimeout()
. It just depends on your use case.This is what I did to make it work (esp loading images using URLs):
<div> <img src="https://somesecuredwebsite.com/images/1.png" crossorigin="anonymous" /> </div>
take note of the crossorigin="anonymous" above...
const base64Image = await this.$html2canvas(el, { type: 'dataURL', useCORS: true, logging: false }) console.log(base64Image)
It is not working. I am getting the same issue.
I'm also having this occur. I've added useCORS
but it still occurs.
The solution mentioned adding crossorigin="anonymous"
but this won't solve problems if using something like html2pdf.js
as you would need to edit the page that you are converting first.
I'm also facing this issue, however Im not using an img element, its a VUE component that Im trying to draw. In any case, I have created a seperate issue regarding this here. If anyone has any input on this, kindly let me know. Thanks :)
I can also confirm that black background is shown when image is loaded via network. My solution is to put as much assets i can in project and then it works fine, but im scared if i need to load something dynamically it wont work... Can you fix that?
hello
i'm trying to use vue-html2canvas but for some reason it s not able to load images
note: i have this as options
Console output:
can you please take a look? source code