problem description
I want to convert the final html from kindtor to pdf. One idea is to convert the obtained html into an image through dom-to-image or html2canvas. After converting to pdf, but after I get html, I can"t use dom-to-image conversion or html. I will report an error.
the environmental background of the problems and what methods you have tried
I study it myself. It may be due to the html obtained by rich text, which is a virtual dom element. It is not actually mounted on the page.
tried to select the entire editor. And then switch. Conversion to canvas succeeded.
related codes
var node="<div>"+editor.html()+"</div>";
console.log($(node))
node=$(node)[0];
// domtoimage.toPng(node)
// .then(function (dataUrl) {
// var img = new Image();
// img.src = dataUrl;
// document.body.appendChild(img);
// });
html2canvas(node).then(function(canvas) {
document.body.appendChild(canvas);
});
what result do you expect? What is the error message actually seen?
hope to get a solution or other reliable solution. The main task is to convert the content obtained from rich text to pdf, which requires
html2canvas to achieve the effect
dom-to-image