📅  最后修改于: 2022-03-11 15:02:44.278000             🧑  作者: Mango
function genPDF() {
html2canvas(document.querySelector(".page"), {scale: "2"}).then(canvas => {
this.imgFile = canvas.toDataURL("image/jpeg", 0.3);
var doc = new jsPDF('p', 'mm', 'a4', true);
//and here is the trick, use FAST to add the canvas or any image:
doc.addImage(this.imgFile, "JPEG", 5, 0, 210, 297, undefined,'FAST');
doc.save('Test.pdf');
});
}