window.onload = function () {
document.getElementById("downloadButton")
.addEventListener("click", () => {
const invoice = this.document.getElementById("dashboardScreenid");
var opt = {
margin: 1,
filename: docTitle,
image: { type: 'jpeg', quality: 0.98 },
html2canvas: {type:'view', scale: 1 },
jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' }
};
html2pdf().from(invoice).set(opt).save();
})
}
这是我的代码。我正在尝试从我的 HTML 网页中下载 pdf,其中包含一些内容,但无论如何都无法正常工作。如果这个类似的代码与一些 1 页的 HTML 网页一起工作,它就像一个魅力,但我正在尝试不下载。