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
html2canvas: Error finding the DIV in the cloned document #1414
Comments
Same problem when I try to store the canvas in the local Storage and link to another page by using React.js
|
Facing same problem When we pass mainDom to html2canvas it shows below error. html2canvas: Error finding the DIV in the cloned document |
@harishSonar Can you please replicate the issue on jsfiddle? |
This is fixed now. It just that I have to take care of removal of mainDom once html2canvas is processed. |
Just for future visitors, I also have the same issue. I ended up cloning the DOM node, inserting it as the first child of Also, @niklasvh, here's the jsfiddle if you'd still like to take a look: https://jsfiddle.net/bLwya8sf/1/ |
Hi, I met this problem, too. And when I trigger the html2canvas function, all the requests in my project are sent. Could you please tell me you solution? Thanks so much. This is my code: |
Same issue here: I had to wrap my SVG into a div to avoid this issue... |
Can talk about how to do it? |
Yes,we must work with rendered element,not work with dom as object in memory |
Sure! |
Why don't you just use the onclone callback? This will let you work with the documentClone before render and make changes to it. html2canvas(document.body, {
onclone: function(documentClone) {
// target elements you want to change on the "documentClone" object
})
.then(function(canvas) {
// print canvas with e.g: jsPDF
});
}; |
I've solved for IE11 here. |
Bug reports:
Using element.cloneNode(true) or angular.copy(element) on the HTMLElement before passing it to html2canvas returns this error.
html2canvas: Error finding the DIV in the cloned document
Uncaught (in promise) Error finding the DIV in the cloned document
Specifications:
The text was updated successfully, but these errors were encountered: