How to convert html text to a picture?

recently I want to make a simple web page recording .
idea: convert html to picture , every 50ms a picture, finally picture into animation , but encounter a problem.
how do I convert html text to a picture?

html2canvas parameters can be passed to dom node but not html text. Try to parse html text into dom, but an error will be reported. ownerDocument.defaultView is null. If you copy dom, an error of clone.js will be reported in html2canvas.

//html2canvas
var ownerDocument = element.ownerDocument;
if (!ownerDocument) {
  return Promise.reject("Provided element is not within a Document");
}
var defaultView = ownerDocument.defaultView;

how to solve this problem if you continue to use html2canvas, or is there a recommendation from other third-party plug-ins?


well, the problem is solved. The second parameter of html2canvas, options , modifies the content of dom when cloning dom, and sells dog meat by hanging sheep's head.
it took a long time to try onclone before getting it right, gg.

let domText = `

`; let options = { logging: false, useCORS: true, onclone: (html)=>{ html.body.innerHTML = domText; } }; html2canvas(document.body,options);

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-1c253bc-3374d.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-1c253bc-3374d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?