How to convert html from rich text to pdf?

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

.

clipboard.png
dom-to-image

clipboard.png

May.18,2022

html2canvas receives DOM elements and does not pass jquery.

you can insert html into the page first and get the picture in the following way

html2canvas(document.getElementById('node')).then(function(canvas) {
      document.body.appendChild(canvas);
  });
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eaae76-2014.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eaae76-2014.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?