How to get the finalY of lastAutoTable in jspdf-autoTable

Discussão em 'Angular' iniciado por aish.a, Março 26, 2025.

  1. aish.a

    aish.a Guest

    I am using angular 9.I have a requirement to convert a html table with some content above and below the table into pdf. I am using jspdf-autotable.I followed the examples in the link https://github.com/simonbengtsson/jsPDF-AutoTable/blob/master/examples/examples.js and I am able to write a heading and then generate the table.The problem is when I need to add some text lines below the table.

    My code is as below.

    generatePdf(){
    const doc = new jsPDF();
    doc.setFontSize(18)
    doc.text('ATTENDANCE REPORT FOR DEPOT - '+this.depotId, 14, 22);
    autoTable(doc, { html: '#report-per-depot',startY: 30, });
    doc.text(" ", 14, doc.lastAutoTable.finalY + 10)
    doc.save('AttandancePerDepot.pdf');

    }


    The error I get is

    Property 'lastAutoTable' does not exist on type 'jsPDF'.


    I tried to import lastAutoTable as, import lastAutoTable from 'jspdf-autotable';
    I doesnt show any error,but I am not sure how to get the finalY from it.

    lastAutoTable(doc,{});


    The above doesnt show error but its return type is void.So this is where I am stuck. How do I get the finalY position in angular 9 or 10?

    Continue reading...

Compartilhe esta Página