2024年5月9日发(作者:)
let abs = 0;
let position = 0;
let win_i = $(window).width();
let win_o = idth;
if (win_o > win_i) {
abs = (win_o - win_i) / 2;
}
= w * 2;
= h * 2;
let context = text("2d");
(2, 2);
ate(-offsetLeft - abs, -offsetTop);
html2canvas(element,{
onrendered:function (canvas) {
let contentWidth = ;
let contentHeight = ;
let pageHeight = contentHeight / 592.28 * 841.89;
let leftHeight = contentHeight;
let imgWidth = 595.28;
let imgHeight = 592.28 / contentWidth * contentHeight*1.5;
let pageData = URL('image/jpeg', 1.0);
let pdf = new jsPDF('', 'pt', 'a4');
if (leftHeight < pageHeight) {
ge(pageData, 'JPEG', 0, position, imgWidth, imgHeight)
} else {
while (leftHeight > 0) {
ge(pageData, 'JPEG', 0, position, imgWidth, imgHeight);
leftHeight -= pageHeight;
position -= 841.89;
if (leftHeight > 0) {
e();
}
}
}
mentById("iframe123").src = ('datauristring');
},background: '#FFF'
})
})
})