我有两个 div (div1,div2) 我想在 pdf 第 1 页中导出 div1 并在 pdf 第 2 页中导出 div2 我的问题我只能使用 domtoimage.toPng 从它们中捕获一个 div 如何捕获两个 div 我的代码:`
<script>
$('#downloadPDF').click(function () {
domtoimage.toPng(document.getElementById('div1'))
// domtoimage.toJpeg(document.getElementById('div2'))
.then(function (blob) {
var pdf = new jsPDF('p', 'pt', [$('#div1').width(), $('#div1').height()]);
pdf.addImage(blob, 'PNG', 0, 0, $('#div2').width(), $('#div2').height());
pdf.addPage();
pdf.addImage(blob, 'PNG', 0, 0, $('#div1').width(), $('#div1').height());
pdf.save("report.pdf");
that.options.api.optionsChanged();
});
});
</script>`