html2canvas: Error DOMException: Failed to execute 'setEnd' on 'Range': The offset 45 is larger than the node's length (44).
- html2canvas version tested with: 1.0.0-alpha.4
- Browser & version: Google Chrome 63.0.3239.84 64-bit
- Operating system: Windows 10
Error DOMException: Failed to execute 'setEnd' on 'Range': The offset 45 is larger than the node's length (44).
at getRangeBounds (http://my-local-site.test/libraries/html2canvas/dist/html2canvas.js?v=1.0.0-alpha.4:2310:11)
at parseTextBounds (http://my-local-site.test/libraries/html2canvas/dist/html2canvas.js?v=1.0.0-alpha.4:2278:54)
at Function.fromTextNode (http://my-local-site.test/libraries/html2canvas/dist/html2canvas.js?v=1.0.0-alpha.4:1640:84)
at parseNodeTree (http://my-local-site.test/libraries/html2canvas/dist/html2canvas.js?v=1.0.0-alpha.4:2887:64)
at parseNodeTree (http://my-local-site.test/libraries/html2canvas/dist/html2canvas.js?v=1.0.0-alpha.4:2918:29)
Happens when trying to run the h2c function, prevents the canvas from being created.
About this issue
- Original URL
- State: open
- Created 7 years ago
- Comments: 16 (2 by maintainers)
The special character
ßwill be rendered asSSif you have atext-transform: uppercase;and this will trick html2canvas. I solved it by replacingßbySSin the markup, when I knew the text would be rendered in uppercase.I found the root cause of this error, if any special character like (‘ß’) present in your text and its Unicode html conversion is ‘ss’ that’s increase the length of offset. Please update the library Thanks.