parallax / jsPDF

Client-side JavaScript PDF generation for everyone.
https://parall.ax/products/jspdf
MIT License
29.18k stars 4.66k forks source link

How to Scale individual Pages to fit A4 Size using .html() method For Exporting multipage PDF #3524

Closed prasheel888 closed 1 year ago

prasheel888 commented 1 year ago

I've such a requirement where I've to export 6 Tabs (each tab in a separate page) into the PDF, I've got the HTML String For each individual Tabs, for exporting the PDF I'm using .html() method like these,

 const exportToPdf = () => {
    const doc = new jsPDF("l", "pt", "a4");
    var pageHeight = doc.internal.pageSize.getHeight();
    console.log(pageHeight);
    doc.html(page1 + page2 + page3 + page4 + page5 + page6, {
      callback: function (pdf) {
        pdf.save("FinancialStatement.pdf");
        },
      dompurify: dompurify,
    });
}

Here page1, page2, page3 , page4 ,page5 , page6 are the HTML strings for the individual tabs! each Pages are different in size. how do I scale/descale them to fit a4 paper size?

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 90 days with no activity. It will be closed soon. Please comment/reopen if this issue is still relevant.