使用jsPDF将PDF包含在多个页面中

时间:2021-01-21 10:22:46

标签: jspdf angular9 html2canvas

我正在使用 jspdf 和 HTML2Canvas 从网页创建 pdf。我能够创建 pdf 页面,但包含 pdf 显示太小,可以创建多个页面,以便包含显示良好。 这是我的代码图片

saveAsPDF() {
    var data = document.getElementById('dashboard-container');
     html2canvas(data).then(canvas => {
    // Few necessary setting options 
    var imgWidth = 235;
    var imgHeight =  imgWidth;
    var heightLeft = imgHeight;
     
    const contentDataURL = canvas.toDataURL('image/png')
    let pdf = new jsPDF('p', 'mm', 'a4'); // A4 size page of PDF
    var position = 0;
    pdf.addImage(contentDataURL, 'PNG', 0, position, imgWidth, imgHeight)
    pdf.save('report.pdf'); // Generated PDF
    });
    }

and while running this pic of code giving me error message this(html2canvas)  "This expression is not callable".

Can any one please suggest
1:- How will remove the error message from "html2canvas"  error TS2349: This expression is not callable.
2:-create multiple PDF page so that contains looks good?

0 个答案:

没有答案
相关问题