可以使用html2canvas
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>BFWONE.JS DEMO PAGE</title>
<script id="bfwone" data="dep=jquery.17&err=0" src="http://repo.bfw.wiki/bfwrepo/js/bfwone.js"></script>
</head>
<body>
<div id="capture" style="background: #f5da55;transform:scale(1)">
<img src="http://repo.bfw.wiki/bfwrepo/image/5d653be845a41.png?x-oss-process=image/auto-orient,1/resize,m_fill,w_100,h_100,/quality,q_90" />
<h4 style="color: #000; ">Hello world!</h4>
</div>
<script>
bready(function() {
use(["html2canvas.min"], function() {
html2canvas(document.querySelector("#capture"), {
useCORS: true,
backgroundColor: null
}).then(canvas => {
document.body.appendChild(canvas)
});
});
});
</script>
</body>
</html>
网友回复