当我拍摄屏幕时,此代码中的图像较低
<!DOCTYPE html>
<html >
<head>
<div class="specific">
<title>Click to Take a Screenshot & Download it!</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<h1>Click to Take a Screenshot & Download it! <small>using html2canvas.js + canvas2image.js</small>
</h1> <p> مثال </p>
<p>
Use html2canvas.js to take a screenshot of a specific div and then use canvas2image.js to download the screenshot as an image
locally to your filesystem. </p>
<button type="button" class="btn
btn-default">Take a Screenshot!</button> <p>References: <a
href="https://html2canvas.hertzen.com/">html2canvas.js</a>
<a
href="https://github.com/SuperAL/canvas2image">canvas2image.js</a>
</p>
</div>
<script src='js/html2canvas.min.js'/>
<script
src='js/canvas2image.js'>
</script>
<script>
document.querySelector('button').addEventListener('click', function() {
html2canvas(document.querySelector('.specific'), {
onrendered: function(canvas) {
// document.body.appendChild(canvas);
return Canvas2Image.saveAsPNG(canvas);
}
});
});
</script>
</body>
</html>
我想设置图像质量和尺寸。