Uncaught (in promise) DOMException: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0.
See original GitHub issueUncaught (in promise) DOMException: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0.
Specifications:
- html2canvas version tested with: 1.0.0-rc.2
- Browser & version: chromium latest release
- Operating system: fedora 29
Issue Analytics
- State:
- Created 4 years ago
- Comments:22 (2 by maintainers)
Top Results From Across the Web
The image argument is a canvas element with a width or ...
"Failed to execute 'createPattern' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0.".
Read more >CanvasRenderingContext2D.drawImage() - Web APIs | MDN
The width to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is...
Read more >Blazor signature Uncaught DOMException: Failed to execute ...
Uncaught DOMException : Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0....
Read more >Failed to execute 'drawImage' on 'CanvasRenderingContext2D'
The error message is saying that cowpies is not an image element. You can only draw image elements onto the canvas. When you...
Read more >Failed to execute 'drawImage' on 'CanvasRenderingContext2D
toJSON(), the console send me this error:Failed to execute 'drawImage' on ... drawImage( image, 0, 0, image.width, image.height );; }; canvas = _canvas; ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I got the similar error
InvalidStateError: CanvasRenderingContext2D.createPattern: Passed-in canvas has width 0
which only occurs in Firefox. After some investigation I found out it occurs on svg-images set as background-image.See this jsfiddle for demo.
Including the lines
is a quickfix.
@rdpatel3996 Yes, I just needed to add the ignoreElements configuration and all is well, appearently the new version of Google Maps use iframe elements inside which makes it impossible to capture.
The key is to add this config: