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

IFrame with no width/height fails #1892

Open
2 tasks done
daniel-hauser opened this issue Jun 16, 2019 · 5 comments
Open
2 tasks done

IFrame with no width/height fails #1892

daniel-hauser opened this issue Jun 16, 2019 · 5 comments

Comments

@daniel-hauser
Copy link

  • You are using the latest version
  • You are testing using the non-minified version of html2canvas and checked any potential issues reported in the console

Bug reports:

Trying to export an element with iframe with no width/height fails.

v1.0.0-rc.0: works as expected see here.
v1.0.0-rc.3: will fail with Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0. see here.

Specifications:

  • html2canvas version tested with:
    • Browser & version: Google Chrome Version 74.0.3729.169 (Official Build) (64-bit)
    • Operating system: MacOS Mojave 10.14.5
@daniel-hauser
Copy link
Author

#1887 is probably related but has no code to confirm

@daniel-hauser
Copy link
Author

@niklasvh
A possible fix is to use getComputedStyle(iframe).width here instead of iframe.width (and same for height)

Would you want me to open a PR?

@val1984
Copy link
Contributor

val1984 commented Jun 18, 2019

PR #1863 has been merged in master recently so next release will hopefully solve your issue.

@daniel-hauser
Copy link
Author

The code added in #1863 will result in not adding the iframe to the canvas.
This is not good - as iframe width and height have default values (300 x 150px)

@val1984
Copy link
Contributor

val1984 commented Jun 19, 2019

Sorry, I didn't check everything. You can definitely open a PR, that's what I did for the issue I had opened (#1865) and my PR has been merged.

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

2 participants