How to prevent spliting of Table over mutliple pages in jspdf

前端 未结 1 1754
谎友^
谎友^ 2021-01-27 05:34

I am using jspdf for generating my pdf report. I have multiple tables which show the principle, but when I am generating the pdf, table\'s rows are splitting between different p

相关标签:
1条回答
  • 2021-01-27 06:01

    you have to check the actual page size always before adding new content

    doc = new jsPdf();
    ...
    pageHeight= doc.internal.pageSize.height;
    
    // Before adding new content
    y = 500 // Height position of new content
    if (y >= pageHeight)
    {
      doc.addPage();
      y = 0 // Restart height position
    }
    doc.text(x, y, "value");
    

    Source: MrRio/jsPDF/issues/101

    0 讨论(0)
提交回复
热议问题