私は非常に長いWebページを持っています。html2canvasが画像全体を取得しない
サイズはおよそ1100x6600です。html2canvasを使用するたびに、幅と長さはすべて取得されますが、画像は見たい部分の非常に小さい部分にすぎません。
イメージ全体を1100x6600領域に合わせる簡単な方法はありますか?
ここでは、画像の下部にヘッダーの一部を表示するコードスニペットを示します。
function getScreenshot(){
html2canvas(document.getElementById("entireBody")).then(function(canvas) {
var image = document.createElement("canvas");
image.setAttribute('width', 1163);
image.setAttribute('height', 6659);
var context = image.getContext("2d");
context.drawImage(canvas, 0, 0, 1163, 6659);
var dataURL = image.toDataURL();
window.open(dataURL);
});
}