Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fonts are not loaded when using html2canvas within an iframe #1772

Open
diego-rey opened this issue Mar 13, 2019 · 3 comments
Open

Fonts are not loaded when using html2canvas within an iframe #1772

diego-rey opened this issue Mar 13, 2019 · 3 comments

Comments

@diego-rey
Copy link

Hi all, I'm having a similar issue to this one: #328.
I created a widget that uses html2canvas to take a screenshot. The problem is that the widget must be inserted in a site inside an iframe, the capture works but the fonts don't load. Here is a simple example of what happens: test-case-iframe

Specifications:

  • html2canvas version tested with: v1.0.0-alpha.12
  • Browser & version: Google Chrome Version 72.0.3626.121 (Official Build) (64-bit)
  • Operating system: Mac OS 10.13.6
@diego-rey diego-rey changed the title Fonts doesn't load when use html2canvas inside an iframe Fonts are not loaded when using html2canvas within an iframe Mar 13, 2019
@jasonbarry
Copy link

@diego-rey I found that if your child frame is on the same domain as the parent, you can append a canvas element to the body of the child frame. Then pass that element to html2canvas using the canvas option. It'll pick up the font definitions inside the child frame.

@diego-rey
Copy link
Author

Oh the solution was simple. Thanks for the help @jasonbarry ! Doing this I was able to make it work.

@bierx
Copy link

bierx commented Nov 7, 2019

@diego-rey can you provide example for your resolve?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants