-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Uncaught Error: IndexSizeError: DOM Exception 1 #183
Comments
What browser are you using? Which version of html2canvas? |
|
I got this error too. Here's my code: el = document.createElement('div');
el.innerHTML = '<h1>Hello world</h1>';
html2canvas(el); |
@nbashaw The element needs to be appended to the document for it to be rendable. |
I get this same error on IE9. Works fine in Chrome and FireFox. I was looking around for answers and I saw this post: http://stackoverflow.com/questions/15328764/html2canvas-error-uncaught-error-indexsizeerror-dom-exception-1 I logged all the dimensions, and they appear within the bounds. Is there a bug in IE9 with drawImage method? |
I found out that IE9 browser seems to crap out when padding and font-size is applied to a div that you are targeting. #page { $(function() { Testing 1 2 3by Thomas YungTesting 1 2 3 Go |
Hey I have been having the exactly the same problem. Isnt there any way to render a display:none/hidden element?? |
The issue seems to occur when the element being rendered has size 0. Creating a canvas with size 0 is accepted, but as soon as you try to draw to it, IndexSizeError is thrown. This patch should fix the issue: https://gist.github.com/InfernoZeus/6010328#file-html2canvas-indexsizeerror-patch-diff |
This issue also occurs in Internet explorer when the width of the element element being rendered using html2canvas is wider than 8192 pixels. |
8192 pixels is the largest Microsoft support for size of a canvas, see here: http://msdn.microsoft.com/en-us/library/ie/ff975062%28v=vs.85%29.aspx
Not sure how html2canvas should handle that though.. Also, I don't think that issue is directly related to the original issue, despite the same error message. Perhaps another issue should be filed? |
so how did you guys get over this error? |
The one posted originally by switer, or the one mentioned by oosterholt? |
the one posted by switer. I am getting the same error when the div I am trying to export is bigger that the window and scroll bars appear. Do you have any workaround for me? :) |
This is the fix I used for the problem where it tries to render an element with size 0 (or display:none/hidden): https://gist.github.com/InfernoZeus/6010328#file-html2canvas-indexsizeerror-patch-diff I don't think that's actually directly related to the issue you're having where the div is bigger than the window. |
This is the fix I use for the problem where the image is wider than 8192 pixels:
Requested pull request |
Can someone close this issue? |
I confirm #320 fixes this IE issue if bound.left is negative. Thank you so much. |
I get this error in Microsoft Edge. I noticed that I got this error because of the padding-left in the element that I was selecting to render. |
Uncaught Error: IndexSizeError: DOM Exception 1
when it execute
ctx.drawImage(canvas, bounds.left, bounds.top, bounds.width, bounds.height, 0, 0, bounds.width, bounds.height);
while my code want to html2canvas.render a
display:none
element;What causes this error ?
The error track :
(anonymous function) html2canvas.js:2828 _html2canvas.Renderer html2canvas.js:2552 options.complete html2canvas.js:2667 start html2canvas.js:2082 img.onload
The text was updated successfully, but these errors were encountered: